Re: [PATCH 15/18] staging: mt7621-pinctrl: refactor rt2880_pinctrl_dt_node_to_map function

2018-12-30 Thread Sergio Paracuellos
Hi again and sorry for the noise.

On Sun, Dec 30, 2018 at 8:37 AM Sergio Paracuellos
 wrote:
>
> Hi again,
>
> Sorry, Too early in the morning and I misunderstood the problem :-)
>
> On Sun, Dec 30, 2018 at 8:24 AM Sergio Paracuellos
>  wrote:
> >
> > Hi Neil,
> >
> > On Sun, Dec 30, 2018 at 4:58 AM NeilBrown  wrote:
> > >
> > > On Thu, Jun 07 2018, Sergio Paracuellos wrote:
> > >
> > > > Using 'function' and 'groups' bindings in the device tree give the
> > > > posibility of refactor 'rt2880_pinctrl_dt_node_to_map' and simplify
> > > > it a lot. Make use of the 'of_property_count_strings' function to get
> > > > number of groups for the node and iterate over the groups using
> > > > 'of_property_for_each_string' calling 'pinctrl_utils_add_map_mux'
> > > > function which is the same of the custom function in this driver code
> > > > 'rt2880_pinctrl_dt_subnode_to_map' which is not needed anymore.
> > > >
> > > > Signed-off-by: Sergio Paracuellos 
> > >
> > > Hi Sergio,
> > >  I've just noticed a problem with this code.  The problem existed before
> > >  your patch - you didn't introduce it.  But maybe you are more familiar
> > >  with the code and might like to fix it...
> > >
> > >
> > > > ---
> > > >  drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 60 
> > > > -
> > > >  1 file changed, 18 insertions(+), 42 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
> > > > b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> > > > index 84494a1..8291ec0 100644
> > > > --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> > > > +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> > > ...
> > >
> > > >  static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev,
> > > >struct device_node *np_config,
> > > >struct pinctrl_map **map,
> > > >unsigned int *num_maps)
> > >
> > > num_maps passed in ( from dt_to_map_one_config in
> > > drivers/pinctrl/devicetree.c)
> > > is the address of an uninitialised variable - has the value -1681671408 
> > > in one test
> > > run.
> > >
> > >
> > > >  {
> > > >   struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev);
> > > > + struct property *prop;
> > > > + const char *function_name, *group_name;
> > > >   int ret;
> > > > - int max_maps = 0;
> > > > + int ngroups;
> > > >   unsigned int reserved_maps = 0;
> > > > - struct pinctrl_map *tmp;
> > > > - struct device_node *np;
> > > >
> > > > - for_each_child_of_node(np_config, np) {
> > > > - int ret = of_property_count_strings(np, "ralink,group");
> > > > -
> > > > - if (ret >= 0)
> > > > - max_maps += ret;
> > > > + ngroups = of_property_count_strings(np_config, "groups");
> > > > + if (!ngroups) {
> > > > + dev_err(p->dev, "missing groups property in node %s\n",
> > > > + np_config->name);
> > > > + return -EINVAL;
> > > >   }
> > > >
> > > > - if (!max_maps)
> > > > - return max_maps;
> > > > -
> > > >   ret = pinctrl_utils_reserve_map(pctrldev, map, &reserved_maps,
> > > > - num_maps, max_maps);
> > > > + num_maps, ngroups);
> > >
> > > pinctrl_utils_reserve_map() expects *num_maps to be initialized here.
> > > It does a memory allocation based on the value, and triggers a warning
> > > for me:
> > > if (unlikely(order >= MAX_ORDER)) {
> > > WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN));
> > > return NULL;
> > > }
> > >
> > >
> > > >   if (ret) {
> > > >   dev_err(p->dev, "can't reserve map: %d\n", ret);
> > > >   return ret;
> > > >   }
> > > >
> > > > - tmp = *map;
> > > > -
> > > > - for_each_child_of_node(np_config, np)
> > > > - rt2880_pinctrl_dt_subnode_to_map(pctrldev, np, &tmp);
> > > > - *num_maps = max_maps;
> > >
> > > Previously *num_maps was initialised here - clearly too late.  Now it
> > > isn't initialised at all.
> > > Do you know what value it should be set to?
>
> So according the code before this PATCH the 'num_max' variable now
> should be set to value of 'ngroups'.
>
> So the following should fix the problem?
>
> diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> index aa98fbb17013..180f2afd7984 100644
> --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> @@ -88,6 +88,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct
> pinctrl_dev *pctrldev,
> for_each_node_with_property(np_config, "group")
> ngroups++;
>
> +   *num_maps = ngroups;

+   *num_maps = 0;

Looking other drivers and 'pinctrl_utils_reserve_map' code it seems
thi

[PATCH] staging: mt7621-pinctrl: initialize 'num_maps' variable to zero

2018-12-30 Thread Sergio Paracuellos
Function 'rt2880_pinctrl_dt_node_to_map' calls internally
'pinctrl_utils_reserve_map' which expects 'num_maps' to be initialized.
It does a memory allocation based on the value, and triggers the following
warning if is not properly set:

if (unlikely(order >= MAX_ORDER)) {
WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN));
return NULL;
}

Initialize it to zero to avoid this problem.

Fixes: e12a1a6e087b ("staging: mt7621-pinctrl: refactor 
rt2880_pinctrl_dt_node_to_map function")
Reported-by: NeilBrown 
Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index aa98fbb17013..b663ca43a525 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -88,6 +88,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev 
*pctrldev,
for_each_node_with_property(np_config, "group")
ngroups++;
 
+   *num_maps = 0;
*map = NULL;
ret = pinctrl_utils_reserve_map(pctrldev, map, &reserved_maps,
num_maps, ngroups);
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 15/18] staging: mt7621-pinctrl: refactor rt2880_pinctrl_dt_node_to_map function

2018-12-30 Thread NeilBrown
On Sun, Dec 30 2018, Sergio Paracuellos wrote:

> Hi again and sorry for the noise.

A bit of noise is no problem, especially when it leads to the right
answer.

>
> +   *num_maps = 0;

Yes, this works.
I had tried other numbers like ngroups, and got strange errors.
With this, it all works.

>
> Looking other drivers and 'pinctrl_utils_reserve_map' code it seems
> this should be first set to zero.

Yes, I can see that now in pinconf_generic_dt_node_to_map() which is a
lot of driver use ... I wonder if we can use the 'generic' one too.

Anyway,
  Reported-and-tested-by: NeilBrown 

for the addition of
  *num_maps = 0;

Thanks!
NeilBrown


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: mt7621-pinctrl: initialize 'num_maps' variable to zero

2018-12-30 Thread Sergio Paracuellos
Function 'rt2880_pinctrl_dt_node_to_map' calls internally
'pinctrl_utils_reserve_map' which expects 'num_maps' to be initialized.
It does a memory allocation based on the value, and triggers the following
warning if is not properly set:

if (unlikely(order >= MAX_ORDER)) {
WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN));
return NULL;
}

Initialize it to zero to avoid this problem.

Fixes: e12a1a6e087b ("staging: mt7621-pinctrl: refactor 
rt2880_pinctrl_dt_node_to_map function")
Reported-by: NeilBrown 
Tested-by: NeilBrown 
Signed-off-by: Sergio Paracuellos 
---
Changes v2:
- Collect Tested-by tags. See:
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-December/130259.html

 drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index aa98fbb17013..b663ca43a525 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -88,6 +88,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev 
*pctrldev,
for_each_node_with_property(np_config, "group")
ngroups++;
 
+   *num_maps = 0;
*map = NULL;
ret = pinctrl_utils_reserve_map(pctrldev, map, &reserved_maps,
num_maps, ngroups);
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/8] reduce indentation

2018-12-30 Thread Julia Lawall
These patches fix cases where a subsequent statement is aligned
with the right hand side of an assignment rather than the left
hand side.  This was done using the following semantic match
(http://coccinelle.lip6.fr/).  It has a lot of false positives,
because Coccinelle doesn't record the difference between a space
and a tab, but these issues are easy to skip over.

// 
@r@
expression x,e;
statement S;
position p0,p1,p2;
@@
x@p0 = e@p1;
S@p2

@script:ocaml@
p0 << r.p0;
p1 << r.p1;
p2 << r.p2;
@@
if ((List.hd p0).col < (List.hd p1).col &&
(List.hd p1).col = (List.hd p2).col)
then Coccilib.print_main "" p1
// 

---

 drivers/firmware/stratix10-svc.c  |   12 ++--
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |2 +-
 drivers/iommu/msm_iommu.c |8 
 drivers/net/ethernet/amazon/ena/ena_eth_com.c |4 ++--
 drivers/net/ethernet/intel/i40e/i40e_main.c   |2 +-
 drivers/scsi/pm8001/pm8001_sas.c  |2 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c|6 +++---
 drivers/usb/gadget/udc/snps_udc_core.c|   17 -
 8 files changed, 26 insertions(+), 27 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/8] staging: rtl8192e: reduce indentation

2018-12-30 Thread Julia Lawall
Delete tab aligning a statement with the right hand side of a
preceding assignment rather than the left hand side.

Found with the help of Coccinelle.

Signed-off-by: Julia Lawall 

---
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 843e874b8a06..b798cde0ce47 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -1049,9 +1049,9 @@ static int _rtl92e_wx_set_promisc_mode(struct net_device 
*dev,
(bPromiscuousOn) ? (true) : (false);
ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame =
(bFilterSourceStationFrame) ? (true) : (false);
-   (bPromiscuousOn) ?
-   (rtllib_EnableIntelPromiscuousMode(dev, false)) :
-   (rtllib_DisableIntelPromiscuousMode(dev, false));
+   (bPromiscuousOn) ?
+   (rtllib_EnableIntelPromiscuousMode(dev, false)) :
+   (rtllib_DisableIntelPromiscuousMode(dev, false));
 
netdev_info(dev,
"===>%s(), on = %d, filter src sta = %d\n",

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Revert "staging:r8188eu: use lib80211 CCMP decrypt"

2018-12-30 Thread Michael Straube
Commit 6bd082af7e36 ("staging:r8188eu: use lib80211 CCMP decrypt")
is causing hardfreeze whenever the driver tries to connect to my wifi
network. That makes the driver unusable on my system. Reverting the
commit fixes the issue and the driver works properly.

Dec 29 19:21:17 gentoo kernel: BUG: scheduling while atomic: 
swapper/6/0/0x0100
Dec 29 19:21:17 gentoo kernel: Modules linked in: vfat r8188eu(C) lib80211 
cfg80211 rfkill snd_hda_codec_realtek amdgpu
snd_hda_codec_generic snd_hda_codec_hdmi mfd_core chash edac_mce_amd gpu_sched 
snd_hda_intel ttm wmi_bmof kvm
drm_kms_helper snd_hda_codec irqbypass snd_hwdep crc32c_intel snd_hda_core drm 
snd_pcm ghash_clmulni_intel snd_timer
syscopyarea cryptd snd sysfillrect pcspkr sysimgblt k10temp fb_sys_fops 
soundcore wmi video xts cbc ixgb ixgbe tulip
cxgb3 cxgb mdio cxgb4 vxge bonding vxlan ip6_udp_tunnel udp_tunnel macvlan 
vmxnet3 tg3 sky2 r8169 libphy pcnet32 mii igb
dca i2c_algo_bit i2c_core e1000 bnx2 atl1c msdos fat efivarfs configfs cramfs 
squashfs fuse nfs lockd grace sunrpc
fscache ext4 jbd2 ext2 mbcache linear raid10 raid1 raid0 dm_zero dm_verity 
reed_solomon dm_thin_pool dm_switch
dm_snapshot dm_raid raid456 async_raid6_recov async_memcpy async_pq raid6_pq 
dm_mirror dm_region_hash dm_log_writes
dm_log_userspace dm_log dm_integrity async_xor xor async_tx dm_flakey dm_era 
dm_delay dm_crypt
Dec 29 19:21:17 gentoo kernel:  dm_cache_smq dm_cache dm_persistent_data 
libcrc32c dm_bufio dm_bio_prison dm_mod
firewire_core crc_itu_t sl811_hcd xhci_pci xhci_hcd usb_storage mpt3sas 
raid_class aic94xx libsas lpfc qla2xxx
megaraid_sas megaraid_mbox megaraid_mm aacraid sx8 hpsa 3w_9xxx 3w_ 3w_sas 
mptsas scsi_transport_sas mptfc
scsi_transport_fc mptspi mptscsih mptbase imm parport sym53c8xx initio arcmsr 
aic7xxx aic79xx scsi_transport_spi sr_mod
cdrom sg sd_mod pdc_adma sata_inic162x sata_mv ata_piix ahci libahci sata_qstor 
sata_vsc sata_uli sata_sis sata_sx4
sata_nv sata_via sata_svw sata_sil24 sata_sil sata_promise pata_via 
pata_jmicron pata_marvell pata_sis pata_netcell
pata_pdc202xx_old pata_atiixp pata_amd pata_ali pata_it8213 pata_pcmcia 
pata_serverworks pata_oldpiix pata_artop
pata_it821x pata_hpt3x2n pata_hpt3x3 pata_hpt37x pata_hpt366 pata_cmd64x 
pata_sil680 pata_pdc2027x nvme nvme_core
virtio_net net_failover failover virtio_crypto crypto_engine virtio_mmio 
virtio_pci virtio_balloon virtio_rng
Dec 29 19:21:17 gentoo kernel:  virtio_console virtio_blk virtio_scsi 
virtio_ring virtio
Dec 29 19:21:17 gentoo kernel: CPU: 6 PID: 0 Comm: swapper/6 Tainted: G
WC4.20.0-gentoo #1
Dec 29 19:21:17 gentoo kernel: Hardware name: Gigabyte Technology Co., Ltd. 
A320M-S2H/A320M-S2H-CF, BIOS F23 08/08/2018
Dec 29 19:21:17 gentoo kernel: Call Trace:
Dec 29 19:21:17 gentoo kernel:  
Dec 29 19:21:17 gentoo kernel:  dump_stack+0x67/0x9b
Dec 29 19:21:17 gentoo kernel:  __schedule_bug+0x4c/0x70
Dec 29 19:21:17 gentoo kernel:  __schedule+0x6d7/0x840
Dec 29 19:21:17 gentoo kernel:  ? enqueue_task_fair+0xa8/0x6d0
Dec 29 19:21:17 gentoo kernel:  schedule+0x28/0x80
Dec 29 19:21:17 gentoo kernel:  schedule_timeout+0x1f9/0x440
Dec 29 19:21:17 gentoo kernel:  ? _raw_spin_unlock_irqrestore+0x21/0x30
Dec 29 19:21:17 gentoo kernel:  ? wait_for_common+0xb5/0x180
Dec 29 19:21:17 gentoo kernel:  wait_for_common+0xbe/0x180
Dec 29 19:21:17 gentoo kernel:  ? wake_up_q+0x80/0x80
Dec 29 19:21:17 gentoo kernel:  ? rtw_aes_decrypt+0x1b9/0x200 [r8188eu]
Dec 29 19:21:17 gentoo kernel:  wait_for_completion_killable+0x19/0x30
Dec 29 19:21:17 gentoo kernel:  call_usermodehelper_exec+0xeb/0x170
Dec 29 19:21:17 gentoo kernel:  __request_module+0x1a1/0x430
Dec 29 19:21:17 gentoo kernel:  ? fetch_pte.isra.1+0x5/0x180
Dec 29 19:21:17 gentoo kernel:  ? iommu_unmap_page+0x6b/0x100
Dec 29 19:21:17 gentoo kernel:  ? _raw_spin_unlock_irqrestore+0x16/0x30
Dec 29 19:21:17 gentoo kernel:  rtw_aes_decrypt+0x1b9/0x200 [r8188eu]
Dec 29 19:21:17 gentoo kernel:  recv_func_posthandle+0x346/0x960 [r8188eu]
Dec 29 19:21:17 gentoo kernel:  rtw_recv_entry+0x48e/0x980 [r8188eu]
Dec 29 19:21:17 gentoo kernel:  rtl8188eu_recv_tasklet+0xac/0x5b0 [r8188eu]
Dec 29 19:21:17 gentoo kernel:  ? tasklet_action_common.isra.5+0x2e/0xb0
Dec 29 19:21:17 gentoo kernel:  ? tasklet_action_common.isra.5+0x4c/0xb0
Dec 29 19:21:17 gentoo kernel:  tasklet_action_common.isra.5+0x4c/0xb0
Dec 29 19:21:17 gentoo kernel:  __do_softirq+0x104/0x365
Dec 29 19:21:17 gentoo kernel:  irq_exit+0xd1/0xe0
Dec 29 19:21:17 gentoo kernel:  do_IRQ+0x85/0xd0
Dec 29 19:21:17 gentoo kernel:  common_interrupt+0xf/0xf
Dec 29 19:21:17 gentoo kernel:  
Dec 29 19:21:17 gentoo kernel: RIP: 0010:cpuidle_enter_state+0xba/0x320
Dec 29 19:21:17 gentoo kernel: Code: 1f 44 00 00 31 ff e8 75 89 b3 ff 45 84 f6 
74 12 9c 58 f6 c4 02 0f 85 3b 02 00 00 31
ff e8 9e dd b8 ff e8 e9 ad bd ff fb 85 ed <0f> 88 19 02 00 00 4c 29 fb 48 ba cf 
f7 53 e3 a5 9b c4 20 48 89 d8
Dec 29 19:21:17 gentoo kernel: RSP: 0018:b6fd800c3ea0 EFLAGS: 0202 
ORIG_RAX

ALLIANCE LOAN OFFER/PROJECT FUNDING

2018-12-30 Thread FUND ALLIANCE INTERNATIONAL




Good Day,

I'm Olivia Austin a consultant from Fund Alliance International, We are
currently offering 95% Non-Recourse Loan with our BG Leased Monetization
Program for trade finance, constructions, credit enhancement, government
funding, property investment and all-round range of funding, with 2%
interest rate per annul for a period of 10-years + 1 year grace period
with no pre-payment penalties. .

TERMS:

2 % INTEREST RATE YEARLY
10 YEARS DURATION
1M-50B USD / EUR REQUIREMENT:

1.  CLIENT MUST OWN OR REPRESENT A COMPANY.

2.  CLIENT MUST BE ABLE TO PROVIDE BUSINESS PLAN OR EXECUTIVE
SUMMARY OR SUMMARY PURPOSE OF THE LOAN.

Let us know if you are interested in our services and meet up with the
requirements? so as to provide you with more information.

Regards,
Olivia Austin
Fund Alliance
Lutzowplatz 17 10785, Berlin
Germany
Phone: +49 (322) 2109 7890
Email:olistin...@gmail.com



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel