[PATCH] Staging: media: atomisp: Use kcalloc instead of kzalloc

2017-09-14 Thread Srishti Sharma
Use kcalloc instead of kzalloc to check for an overflow before
multiplication. Done using the following semantic patch by
coccinelle.

http://coccinelle.lip6.fr/rules/kzalloc.cocci

Signed-off-by: Srishti Sharma 
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
index 6358216..2f4b71a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
@@ -235,7 +235,9 @@ sh_css_load_firmware(const char *fw_data,
sh_css_blob_info = NULL;
}
 
-   fw_minibuffer = kzalloc(sh_css_num_binaries * sizeof(struct fw_param), 
GFP_KERNEL);
+   fw_minibuffer = kcalloc(sh_css_num_binaries, sizeof(struct fw_param),
+   GFP_KERNEL);
+
if (fw_minibuffer == NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
 
-- 
2.7.4

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


[PATCH] staging: rtl8723bs: Merge assignment with return

2017-09-14 Thread Harsha Sharma
Merge assignment with return statement to directly return the value.
Done using following coccinelle semantic patch

@@
local idexpression ret;
expression e;
@@

-ret =
+return
 e;
-return ret;

Signed-off-by: Harsha Sharma 
---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index ffbb35a..6a8f805 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -2123,12 +2123,9 @@ static int rtw_wx_set_gen_ie(struct net_device *dev,
 struct iw_request_info *info,
 union iwreq_data *wrqu, char *extra)
 {
-   int ret;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
 
-   ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length);
-
-   return ret;
+   return rtw_set_wpa_ie(padapter, extra, wrqu->data.length);
 }
 
 static int rtw_wx_set_auth(struct net_device *dev,
@@ -3857,7 +3854,6 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
 {
/* _irqL irqL; */
/* struct list_head *phead, *plist; */
-   int ret = 0;
/* struct sta_info *psta = NULL; */
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
/* struct sta_priv *pstapriv = &padapter->stapriv; */
@@ -3866,9 +3862,7 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
 
flush_all_cam_entry(padapter);  /* clear CAM */
 
-   ret = rtw_sta_flush(padapter);
-
-   return ret;
+   return rtw_sta_flush(padapter);
 
 }
 
@@ -4266,7 +4260,6 @@ static int rtw_set_hidden_ssid(struct net_device *dev, 
struct ieee_param *param,
 
 static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param 
*param, int len)
 {
-   int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
 
@@ -4279,15 +4272,12 @@ static int rtw_ioctl_acl_remove_sta(struct net_device 
*dev, struct ieee_param *p
return -EINVAL;
}
 
-   ret = rtw_acl_remove_sta(padapter, param->sta_addr);
-
-   return ret;
+   return rtw_acl_remove_sta(padapter, param->sta_addr);
 
 }
 
 static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param 
*param, int len)
 {
-   int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
 
@@ -4300,9 +4290,7 @@ static int rtw_ioctl_acl_add_sta(struct net_device *dev, 
struct ieee_param *para
return -EINVAL;
}
 
-   ret = rtw_acl_add_sta(padapter, param->sta_addr);
-
-   return ret;
+   return rtw_acl_add_sta(padapter, param->sta_addr);
 
 }
 
-- 
1.9.1

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


[PATCH] Staging: lustre: obdclass: Use kcalloc instead of kzalloc

2017-09-14 Thread Srishti Sharma
Use kcalloc instead of kzalloc to check for overflow before
multiplication. Done using the following semantic patch by
coccinelle.

http://coccinelle.lip6.fr/rules/kzalloc.cocci

Signed-off-by: Srishti Sharma 
---
 drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c 
b/drivers/staging/lustre/lustre/obdclass/cl_object.c
index 95c7fa3..28cb8489 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
@@ -1016,7 +1016,7 @@ int cl_global_init(void)
 {
int result;
 
-   cl_envs = kzalloc(sizeof(*cl_envs) * num_possible_cpus(), GFP_KERNEL);
+   cl_envs = kcalloc(num_possible_cpus(), sizeof(*cl_envs), GFP_KERNEL);
if (!cl_envs) {
result = -ENOMEM;
goto out;
-- 
2.7.4

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


[PATCH] Staging: ccree: Use kcalloc instead of kzalloc

2017-09-14 Thread Srishti Sharma
Use kcalloc instead of kzalloc to check for overflow before
multiplication. Done using the following semantic patch by
coccinelle.

http://coccinelle.lip6.fr/rules/kzalloc.cocci

Signed-off-by: Srishti Sharma 
---
 drivers/staging/ccree/ssi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_sysfs.c 
b/drivers/staging/ccree/ssi_sysfs.c
index 0655658..65a0529 100644
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct 
ssi_drvdata *drvdata,
return -ENOMEM;
/* allocate memory for directory's attributes list */
sys_dir->sys_dir_attr_list =
-   kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1),
+   kcalloc((num_of_attrs + 1), sizeof(struct attribute *),
GFP_KERNEL);
 
if (!(sys_dir->sys_dir_attr_list)) {
-- 
2.7.4

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


Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Merge assignment with return

2017-09-14 Thread Julia Lawall


On Thu, 14 Sep 2017, Harsha Sharma wrote:

> Merge assignment with return statement to directly return the value.
> Done using following coccinelle semantic patch
>
> @@
> local idexpression ret;
> expression e;
> @@
>
> -ret =
> +return
>  e;
> -return ret;

Acked-by: Julia Lawall 

Many of these examples have the property that ret is assigned to 0 but
that value is never used.  You could try using Coccinelle to see whether
that occurs in other cases.

julia


>
> Signed-off-by: Harsha Sharma 
> ---
>  drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 20 
>  1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
> b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index ffbb35a..6a8f805 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -2123,12 +2123,9 @@ static int rtw_wx_set_gen_ie(struct net_device *dev,
>struct iw_request_info *info,
>union iwreq_data *wrqu, char *extra)
>  {
> - int ret;
>   struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
>
> - ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length);
> -
> - return ret;
> + return rtw_set_wpa_ie(padapter, extra, wrqu->data.length);
>  }
>
>  static int rtw_wx_set_auth(struct net_device *dev,
> @@ -3857,7 +3854,6 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
>  {
>   /* _irqL irqL; */
>   /* struct list_head *phead, *plist; */
> - int ret = 0;
>   /* struct sta_info *psta = NULL; */
>   struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
>   /* struct sta_priv *pstapriv = &padapter->stapriv; */
> @@ -3866,9 +3862,7 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
>
>   flush_all_cam_entry(padapter);  /* clear CAM */
>
> - ret = rtw_sta_flush(padapter);
> -
> - return ret;
> + return rtw_sta_flush(padapter);
>
>  }
>
> @@ -4266,7 +4260,6 @@ static int rtw_set_hidden_ssid(struct net_device *dev, 
> struct ieee_param *param,
>
>  static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct 
> ieee_param *param, int len)
>  {
> - int ret = 0;
>   struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
>   struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
>
> @@ -4279,15 +4272,12 @@ static int rtw_ioctl_acl_remove_sta(struct net_device 
> *dev, struct ieee_param *p
>   return -EINVAL;
>   }
>
> - ret = rtw_acl_remove_sta(padapter, param->sta_addr);
> -
> - return ret;
> + return rtw_acl_remove_sta(padapter, param->sta_addr);
>
>  }
>
>  static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param 
> *param, int len)
>  {
> - int ret = 0;
>   struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
>   struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
>
> @@ -4300,9 +4290,7 @@ static int rtw_ioctl_acl_add_sta(struct net_device 
> *dev, struct ieee_param *para
>   return -EINVAL;
>   }
>
> - ret = rtw_acl_add_sta(padapter, param->sta_addr);
> -
> - return ret;
> + return rtw_acl_add_sta(padapter, param->sta_addr);
>
>  }
>
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1505390645-4461-1-git-send-email-harshasharmaiitr%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] Staging: lustre: obdclass: Use kcalloc instead of kzalloc

2017-09-14 Thread Julia Lawall


On Thu, 14 Sep 2017, Srishti Sharma wrote:

> Use kcalloc instead of kzalloc to check for overflow before
> multiplication. Done using the following semantic patch by
> coccinelle.
>
> http://coccinelle.lip6.fr/rules/kzalloc.cocci
>
> Signed-off-by: Srishti Sharma 

Acked-by: Julia Lawall 

> ---
>  drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c 
> b/drivers/staging/lustre/lustre/obdclass/cl_object.c
> index 95c7fa3..28cb8489 100644
> --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
> +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
> @@ -1016,7 +1016,7 @@ int cl_global_init(void)
>  {
>   int result;
>
> - cl_envs = kzalloc(sizeof(*cl_envs) * num_possible_cpus(), GFP_KERNEL);
> + cl_envs = kcalloc(num_possible_cpus(), sizeof(*cl_envs), GFP_KERNEL);
>   if (!cl_envs) {
>   result = -ENOMEM;
>   goto out;
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1505390789-3814-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] Staging: ccree: Use kcalloc instead of kzalloc

2017-09-14 Thread Julia Lawall


On Thu, 14 Sep 2017, Srishti Sharma wrote:

> Use kcalloc instead of kzalloc to check for overflow before
> multiplication. Done using the following semantic patch by
> coccinelle.
>
> http://coccinelle.lip6.fr/rules/kzalloc.cocci
>
> Signed-off-by: Srishti Sharma 
> ---
>  drivers/staging/ccree/ssi_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ccree/ssi_sysfs.c 
> b/drivers/staging/ccree/ssi_sysfs.c
> index 0655658..65a0529 100644
> --- a/drivers/staging/ccree/ssi_sysfs.c
> +++ b/drivers/staging/ccree/ssi_sysfs.c
> @@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct 
> ssi_drvdata *drvdata,
>   return -ENOMEM;
>   /* allocate memory for directory's attributes list */
>   sys_dir->sys_dir_attr_list =
> - kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1),
> + kcalloc((num_of_attrs + 1), sizeof(struct attribute *),

You don't need the parentheses around the first argument.

julia

>   GFP_KERNEL);
>
>   if (!(sys_dir->sys_dir_attr_list)) {
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1505391353-4516-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: ccree: Use kcalloc instead of kzalloc

2017-09-14 Thread Srishti Sharma
Use kcalloc instead of kzalloc to check for overflow before
multiplication. Done using the following semantic patch by
coccinelle.

http://coccinelle.lip6.fr/rules/kzalloc.cocci

Signed-off-by: Srishti Sharma 
---
Changes in v2:
 - eliminate parentheses around the first argument

 drivers/staging/ccree/ssi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_sysfs.c 
b/drivers/staging/ccree/ssi_sysfs.c
index 0655658..f7e0c502 100644
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct 
ssi_drvdata *drvdata,
return -ENOMEM;
/* allocate memory for directory's attributes list */
sys_dir->sys_dir_attr_list =
-   kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1),
+   kcalloc(num_of_attrs + 1, sizeof(struct attribute *),
GFP_KERNEL);
 
if (!(sys_dir->sys_dir_attr_list)) {
-- 
2.7.4

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


Re: [Outreachy kernel] [PATCH v2] Staging: ccree: Use kcalloc instead of kzalloc

2017-09-14 Thread Julia Lawall


On Thu, 14 Sep 2017, Srishti Sharma wrote:

> Use kcalloc instead of kzalloc to check for overflow before
> multiplication. Done using the following semantic patch by
> coccinelle.
>
> http://coccinelle.lip6.fr/rules/kzalloc.cocci
>
> Signed-off-by: Srishti Sharma 

Acked-by: Julia Lawall 

> ---
> Changes in v2:
>  - eliminate parentheses around the first argument
>
>  drivers/staging/ccree/ssi_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ccree/ssi_sysfs.c 
> b/drivers/staging/ccree/ssi_sysfs.c
> index 0655658..f7e0c502 100644
> --- a/drivers/staging/ccree/ssi_sysfs.c
> +++ b/drivers/staging/ccree/ssi_sysfs.c
> @@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct 
> ssi_drvdata *drvdata,
>   return -ENOMEM;
>   /* allocate memory for directory's attributes list */
>   sys_dir->sys_dir_attr_list =
> - kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1),
> + kcalloc(num_of_attrs + 1, sizeof(struct attribute *),
>   GFP_KERNEL);
>
>   if (!(sys_dir->sys_dir_attr_list)) {
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1505393293-5941-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: iio: ad7192: Use the dedicated reset function

2017-09-14 Thread Lars-Peter Clausen
On 09/14/2017 03:50 PM, Stefan Popa wrote:
> SPI host drivers can use DMA to transfer data, so the buffer should be 
> properly allocated.
> Keeping it on the stack could cause an undefined behavior.
> 
> The dedicated reset function solves this issue.
> 
> Signed-off-by: Stefan Popa 

Acked-by: Lars-Peter Clausen 

Thanks.

> ---
>  drivers/staging/iio/adc/ad7192.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7192.c 
> b/drivers/staging/iio/adc/ad7192.c
> index d11c6de..6150d27 100644
> --- a/drivers/staging/iio/adc/ad7192.c
> +++ b/drivers/staging/iio/adc/ad7192.c
> @@ -223,11 +223,9 @@ static int ad7192_setup(struct ad7192_state *st,
>   struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
>   unsigned long long scale_uv;
>   int i, ret, id;
> - u8 ones[6];
>  
>   /* reset the serial interface */
> - memset(&ones, 0xFF, 6);
> - ret = spi_write(st->sd.spi, &ones, 6);
> + ret = ad_sd_reset(&st->sd, 48);
>   if (ret < 0)
>   goto out;
>   usleep_range(500, 1000); /* Wait for at least 500us */
> 

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


Re: [PATCH] staging: rtl8712: Fix unbalanced braces around else statement

2017-09-14 Thread Liam Ryan
On Wed, Sep 13, 2017 at 08:58:26AM -0700, Tobin C. Harding wrote:
> On Wed, Sep 13, 2017 at 04:14:29PM +0100, Liam Ryan wrote:
> > On Wed, Sep 13, 2017 at 08:47:39AM +0200, Frans Klaver wrote:
> > > On Tue, Sep 12, 2017 at 2:40 AM, Liam Ryan  wrote:
> > > > Fix checkpath-reported unbalanced braces in the following areas
> > > >
> > > > 221: FILE: drivers/staging/rtl8712/hal_init.c:221:
> > > > 392: FILE: drivers/staging/rtl8712/os_intfs.c:392:
> > > > 363: FILE: drivers/staging/rtl8712/rtl8712_cmd.c:363:
> > > > 889: FILE: drivers/staging/rtl8712/rtl8712_recv.c:889:
> > > > 902: FILE: drivers/staging/rtl8712/rtl871x_cmd.c:902:
> > > > 84: FILE: drivers/staging/rtl8712/rtl871x_ioctl_set.c:84:
> > > > 580: FILE: drivers/staging/rtl8712/rtl871x_mlme.c:580:
> > > > 593: FILE: drivers/staging/rtl8712/usb_intf.c:593:
> > > >
> > > > Signed-off-by: Liam Ryan 
> > > > ---
> > > > This is my first patch and I have several doubts about style choices
> > > >
> > > > At line 216 of hal_init.c should opening brace follow comment instead?
> > > >
> > > > At line 577 of rtl871x_mlme.c should I bring logic to one line instead 
> > > > of
> > > > opening the brace on the continued line?
> > > >
> > > > At line 353 of rtl8712_cmd.c the if/else is technically only 1 line 
> > > > each.
> > > > Should the braces still have been added per checkpath for readability?
> > > >
> > > >  drivers/staging/rtl8712/hal_init.c  | 4 ++--
> > > >  drivers/staging/rtl8712/os_intfs.c  | 4 ++--
> > > >  drivers/staging/rtl8712/rtl8712_cmd.c   | 4 ++--
> > > >  drivers/staging/rtl8712/rtl8712_recv.c  | 4 ++--
> > > >  drivers/staging/rtl8712/rtl871x_cmd.c   | 3 ++-
> > > >  drivers/staging/rtl8712/rtl871x_ioctl_set.c | 4 ++--
> > > >  drivers/staging/rtl8712/rtl871x_mlme.c  | 4 ++--
> > > >  drivers/staging/rtl8712/usb_intf.c  | 3 ++-
> > > >  8 files changed, 16 insertions(+), 14 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/rtl8712/hal_init.c 
> > > > b/drivers/staging/rtl8712/hal_init.c
> > > > index c83d7eb..de832b0b5 100644
> > > > --- a/drivers/staging/rtl8712/hal_init.c
> > > > +++ b/drivers/staging/rtl8712/hal_init.c
> > > > @@ -216,9 +216,9 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
> > > > emem_sz = fwhdr.img_SRAM_size;
> > > > do {
> > > > memset(ptx_desc, 0, TXDESC_SIZE);
> > > > -   if (emem_sz >  MAX_DUMP_FWSZ) /* max=48k */
> > > > +   if (emem_sz >  MAX_DUMP_FWSZ) { /* max=48k */
> > > 
> > > I would not have the comment there in the first place. It doesn't add
> > > any new information and just messes up the style.
> > I'm happy to remove the comment, the patch was accepted so I'm not sure
> > of procedure, should it be a new patch or a revision to this patch? 
> > 
> > In general I don't have the knowledge to decide which comments are worth 
> > keeping in the source 
> > code.
> 
> While you are getting started, if you are unsure of things I tend to lean 
> towards making the minimal
> change to improve the code. A patch will be rejected if there are obvious 
> extra fixes that need
> doing. Review will point these out, reviewers generally don't mind doing this 
> because that is how you
> learn. Please be sure to carefully study these suggestions and learn from 
> them so review does not
> have to point them out again unnecessarily. 
> 
> > is there a rule of thumb for brace placement near inline comments such as 
> > this?
> 
> Like Frans said; If there is more than one line of code (irrelevant to 
> whether it is comments or a
> single statement over two lines) braces make the code cleaner.
Thanks Tobin, my question was re the brace placement if a comment is on the
same line as the conditional. i.e. 

if(foo) /*comment*/
bar

If I understand correctly the patch I submitted will be reviewed and
I'll be told if my choice to resolve this( if (foo) { /.. ) was incorrect. 

Thanks everyone for the guidance and patience thus far. 

If somebody requires an action from me at this point please assume that I have 
missed it and let me know. 

I'm very new to all of this so please do let me know if I'm sending unnecessary 
mails ( this one included ) or breaking netiquette in my replies

Thanks,
Liam
> 
> Hope this helps,
> Tobin.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: iio: ad7192: Use the dedicated reset function

2017-09-14 Thread Michael Hennerich

On 14.09.2017 15:50, Stefan Popa wrote:

SPI host drivers can use DMA to transfer data, so the buffer should be properly 
allocated.
Keeping it on the stack could cause an undefined behavior.

The dedicated reset function solves this issue.

Signed-off-by: Stefan Popa 


Acked-by: Michael Hennerich 

Well done!



---
  drivers/staging/iio/adc/ad7192.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index d11c6de..6150d27 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -223,11 +223,9 @@ static int ad7192_setup(struct ad7192_state *st,
struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
unsigned long long scale_uv;
int i, ret, id;
-   u8 ones[6];
  
  	/* reset the serial interface */

-   memset(&ones, 0xFF, 6);
-   ret = spi_write(st->sd.spi, &ones, 6);
+   ret = ad_sd_reset(&st->sd, 48);
if (ret < 0)
goto out;
usleep_range(500, 1000); /* Wait for at least 500us */




--
Greetings,
Michael

--
Analog Devices GmbH  Otl-Aicher Strasse 60-64  80807 München
Sitz der Gesellschaft München, Registergericht München HRB 40368,
Geschäftsführer: Peter Kolberg, Ali Raza Husain, Eileen Wynne
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8723bs: Remove unused variable ret

2017-09-14 Thread Harsha Sharma
Remove unused variable ret as it is not used anywhere.
Remove multiple blank lines.
Done using following coccinelle semantic patch

@@
type T;
identifier i;
constant C;
@@

(
extern T i;
|
- T i;
  <+... when != i
- i = C;
  ...+>
)

Signed-off-by: Harsha Sharma 
---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index ffbb35a..7935dc5 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -2337,10 +2337,6 @@ static int rtw_wx_read32(struct net_device *dev,
u32 data32;
u32 bytes;
u8 *ptmp;
-   int ret;
-
-
-   ret = 0;
padapter = (struct adapter *)rtw_netdev_priv(dev);
p = &wrqu->data;
len = p->length;
@@ -2352,7 +2348,6 @@ static int rtw_wx_read32(struct net_device *dev,
return -ENOMEM;
 
if (copy_from_user(ptmp, p->pointer, len)) {
-   ret = -EFAULT;
goto exit;
}
 
@@ -2375,7 +2370,6 @@ static int rtw_wx_read32(struct net_device *dev,
break;
default:
DBG_871X(KERN_INFO "%s: usage> read 
[bytes],[address(hex)]\n", __func__);
-   ret = -EINVAL;
goto exit;
}
DBG_871X(KERN_INFO "%s: addr = 0x%08X data =%s\n", __func__, addr, 
extra);
-- 
1.9.1

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


Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove unused variable ret

2017-09-14 Thread Julia Lawall


On Thu, 14 Sep 2017, Harsha Sharma wrote:

> Remove unused variable ret as it is not used anywhere.
> Remove multiple blank lines.
> Done using following coccinelle semantic patch
>
> @@
> type T;
> identifier i;
> constant C;
> @@
>
> (
> extern T i;
> |
> - T i;
>   <+... when != i
> - i = C;
>   ...+>
> )
>
> Signed-off-by: Harsha Sharma 
> ---
>  drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 --
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
> b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index ffbb35a..7935dc5 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -2337,10 +2337,6 @@ static int rtw_wx_read32(struct net_device *dev,
>   u32 data32;
>   u32 bytes;
>   u8 *ptmp;
> - int ret;
> -
> -
> - ret = 0;
>   padapter = (struct adapter *)rtw_netdev_priv(dev);
>   p = &wrqu->data;
>   len = p->length;
> @@ -2352,7 +2348,6 @@ static int rtw_wx_read32(struct net_device *dev,
>   return -ENOMEM;
>
>   if (copy_from_user(ptmp, p->pointer, len)) {
> - ret = -EFAULT;
>   goto exit;
>   }
>
> @@ -2375,7 +2370,6 @@ static int rtw_wx_read32(struct net_device *dev,
>   break;
>   default:
>   DBG_871X(KERN_INFO "%s: usage> read 
> [bytes],[address(hex)]\n", __func__);
> - ret = -EINVAL;
>   goto exit;

One could have the impression that the function should instead return ret.
One would have to figure out where the function is called from and what
happens there to the return value.

julia

>   }
>   DBG_871X(KERN_INFO "%s: addr = 0x%08X data =%s\n", __func__, addr, 
> extra);
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1505404910-11548-1-git-send-email-harshasharmaiitr%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net] netvsc: increase default receive buffer size

2017-09-14 Thread Stephen Hemminger
The default receive buffer size was reduced by recent change
to a value which was appropriate for 10G and Windows Server 2016.
But the value is too small for full performance with 40G on Azure.
Increase the default back to maximum supported by host.

Fixes: 8b5327975ae1 ("netvsc: allow controlling send/recv buffer size")
Signed-off-by: Stephen Hemminger 
---
 drivers/net/hyperv/netvsc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index c538a4f15f3b..d4902ee5f260 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -49,7 +49,7 @@
 #define NETVSC_MIN_TX_SECTIONS 10
 #define NETVSC_DEFAULT_TX  192 /* ~1M */
 #define NETVSC_MIN_RX_SECTIONS 10  /* ~64K */
-#define NETVSC_DEFAULT_RX  2048/* ~4M */
+#define NETVSC_DEFAULT_RX  10485   /* Max ~16M */
 
 #define LINKCHANGE_INT (2 * HZ)
 #define VF_TAKEOVER_INT (HZ / 10)
-- 
2.11.0

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


Re: [PATCH net] netvsc: increase default receive buffer size

2017-09-14 Thread David Miller
From: Stephen Hemminger 
Date: Thu, 14 Sep 2017 09:31:07 -0700

> The default receive buffer size was reduced by recent change
> to a value which was appropriate for 10G and Windows Server 2016.
> But the value is too small for full performance with 40G on Azure.
> Increase the default back to maximum supported by host.
> 
> Fixes: 8b5327975ae1 ("netvsc: allow controlling send/recv buffer size")
> Signed-off-by: Stephen Hemminger 

What other side effects are there to making this buffer so large?

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


[PATCH] staging: iio: ad7192: Use the dedicated reset function

2017-09-14 Thread Stefan Popa
SPI host drivers can use DMA to transfer data, so the buffer should be properly 
allocated.
Keeping it on the stack could cause an undefined behavior.

The dedicated reset function solves this issue.

Signed-off-by: Stefan Popa 
---
 drivers/staging/iio/adc/ad7192.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index d11c6de..6150d27 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -223,11 +223,9 @@ static int ad7192_setup(struct ad7192_state *st,
struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
unsigned long long scale_uv;
int i, ret, id;
-   u8 ones[6];
 
/* reset the serial interface */
-   memset(&ones, 0xFF, 6);
-   ret = spi_write(st->sd.spi, &ones, 6);
+   ret = ad_sd_reset(&st->sd, 48);
if (ret < 0)
goto out;
usleep_range(500, 1000); /* Wait for at least 500us */
-- 
2.7.4

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


Re: [PATCH net] netvsc: increase default receive buffer size

2017-09-14 Thread Stephen Hemminger
On Thu, 14 Sep 2017 10:02:03 -0700 (PDT)
David Miller  wrote:

> From: Stephen Hemminger 
> Date: Thu, 14 Sep 2017 09:31:07 -0700
> 
> > The default receive buffer size was reduced by recent change
> > to a value which was appropriate for 10G and Windows Server 2016.
> > But the value is too small for full performance with 40G on Azure.
> > Increase the default back to maximum supported by host.
> > 
> > Fixes: 8b5327975ae1 ("netvsc: allow controlling send/recv buffer size")
> > Signed-off-by: Stephen Hemminger   
> 
> What other side effects are there to making this buffer so large?
> 
> Just curious...

It increase latency and exercises bufferbloat avoidance on TCP.
The problem was the smaller buffer caused regressions in UDP
benchmarks on 40G Azure. One could argue that this is not a reasonable
benchmark but people run it. Apparently, Windows already went
the same thing and uses an even bigger buffer.

Longer term there will be more internal discussion with different
teams about what the receive latency and buffering needs to be.
Also, the issue goes away when doing accelerated networking (SR-IOV)
is more widely used.

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


[PATCH v2] android: binder: Drop lru lock in isolate callback

2017-09-14 Thread Sherry Yang
Drop the global lru lock in isolate callback
before calling zap_page_range which calls
cond_resched, and re-acquire the global lru
lock before returning. Also change return
code to LRU_REMOVED_RETRY.

Use mmput_async when fail to acquire mmap sem
in an atomic context.

Fix "BUG: sleeping function called from invalid context"
errors when CONFIG_DEBUG_ATOMIC_SLEEP is enabled.

Also restore mmput_async, which was initially introduced in
ec8d7c14e ("mm, oom_reaper: do not mmput synchronously from
the oom reaper context"), and was removed in 212925802
("mm: oom: let oom_reap_task and exit_mmap run concurrently").

Fixes: f2517eb76f1f2 ("android: binder: Add global lru shrinker to binder")
Reported-by: Kyle Yan 
Acked-by: Arve Hjønnevåg 
Signed-off-by: Sherry Yang 
---
Changes in v2:
Combined '[PATCH] android: binder: Drop lru lock in isolate callback'
with '[PATCH] mm: Restore mmput_async'.

 drivers/android/binder_alloc.c | 18 --
 include/linux/sched/mm.h   |  6 ++
 kernel/fork.c  | 18 ++
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index 8fe165844e47..064f5e31ec55 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -913,6 +913,7 @@ enum lru_status binder_alloc_free_page(struct list_head 
*item,
struct binder_alloc *alloc;
uintptr_t page_addr;
size_t index;
+   struct vm_area_struct *vma;
 
alloc = page->alloc;
if (!mutex_trylock(&alloc->mutex))
@@ -923,16 +924,22 @@ enum lru_status binder_alloc_free_page(struct list_head 
*item,
 
index = page - alloc->pages;
page_addr = (uintptr_t)alloc->buffer + index * PAGE_SIZE;
-   if (alloc->vma) {
+   vma = alloc->vma;
+   if (vma) {
mm = get_task_mm(alloc->tsk);
if (!mm)
goto err_get_task_mm_failed;
if (!down_write_trylock(&mm->mmap_sem))
goto err_down_write_mmap_sem_failed;
+   }
+
+   list_lru_isolate(lru, item);
+   spin_unlock(lock);
 
+   if (vma) {
trace_binder_unmap_user_start(alloc, index);
 
-   zap_page_range(alloc->vma,
+   zap_page_range(vma,
   page_addr + alloc->user_buffer_offset,
   PAGE_SIZE);
 
@@ -950,13 +957,12 @@ enum lru_status binder_alloc_free_page(struct list_head 
*item,
 
trace_binder_unmap_kernel_end(alloc, index);
 
-   list_lru_isolate(lru, item);
-
+   spin_lock(lock);
mutex_unlock(&alloc->mutex);
-   return LRU_REMOVED;
+   return LRU_REMOVED_RETRY;
 
 err_down_write_mmap_sem_failed:
-   mmput(mm);
+   mmput_async(mm);
 err_get_task_mm_failed:
 err_page_already_freed:
mutex_unlock(&alloc->mutex);
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
index 3a19c253bdb1..ae53e413fb13 100644
--- a/include/linux/sched/mm.h
+++ b/include/linux/sched/mm.h
@@ -84,6 +84,12 @@ static inline bool mmget_not_zero(struct mm_struct *mm)
 
 /* mmput gets rid of the mappings and all user-space */
 extern void mmput(struct mm_struct *);
+#ifdef CONFIG_MMU
+/* same as above but performs the slow path from the async context. Can
+ * be called from the atomic context as well
+ */
+void mmput_async(struct mm_struct *);
+#endif
 
 /* Grab a reference to a task's mm, if it is not already going away */
 extern struct mm_struct *get_task_mm(struct task_struct *task);
diff --git a/kernel/fork.c b/kernel/fork.c
index 10646182440f..e702cb9ffbd8 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -946,6 +946,24 @@ void mmput(struct mm_struct *mm)
 }
 EXPORT_SYMBOL_GPL(mmput);
 
+#ifdef CONFIG_MMU
+static void mmput_async_fn(struct work_struct *work)
+{
+   struct mm_struct *mm = container_of(work, struct mm_struct,
+   async_put_work);
+
+   __mmput(mm);
+}
+
+void mmput_async(struct mm_struct *mm)
+{
+   if (atomic_dec_and_test(&mm->mm_users)) {
+   INIT_WORK(&mm->async_put_work, mmput_async_fn);
+   schedule_work(&mm->async_put_work);
+   }
+}
+#endif
+
 /**
  * set_mm_exe_file - change a reference to the mm's executable file
  *
-- 
2.11.0 (Apple Git-81)

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


[PATCH 1/3] staging: rtl8188eu: Fix a typo ("deflaut")

2017-09-14 Thread Valentine Sinitsyn
This improves spelling in the comment line to make things easier to get
for future rtl8188eu developers.

Fixes: ee5f8a431ea (staging: rtl8188eu: Move all efuse related code to
rtw_efuse.c)
Signed-off-by: Wolfgang Hartmann 
Signed-off-by: Manish Shrestha 
Signed-off-by: Valentine Sinitsyn 
---
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c 
b/drivers/staging/rtl8188eu/core/rtw_efuse.c
index b9bdff0..2c4c8c4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
+++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
@@ -48,7 +48,7 @@ void Efuse_PowerSwitch(
if (PwrState) {
usb_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON);
 
-   /*  1.2V Power: From VDDON with Power Cut(0xh[15]), defualt 
valid */
+   /*  1.2V Power: From VDDON with Power Cut(0xh[15]), default 
valid */
tmpV16 = usb_read16(pAdapter, REG_SYS_ISO_CTRL);
if (!(tmpV16 & PWC_EV12V)) {
tmpV16 |= PWC_EV12V;
-- 
2.7.4

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


[PATCH 2/3] staging: rtl8188eu: Fix a typo ("faliure")

2017-09-14 Thread Valentine Sinitsyn
This improves spelling in the comment line to make things easier to get
for future rtl8188eu developers.

Fixes: 7b464c9fa5cc (staging: r8188eu: Add files for new driver - part
4)
Signed-off-by: Wolfgang Hartmann 
Signed-off-by: Manish Shrestha 
Signed-off-by: Valentine Sinitsyn 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index f663e6c..0d2381d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1329,7 +1329,7 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 
*pbuf)
 }
 
 /*
- * _rtw_join_timeout_handler - Timeout/faliure handler for CMD JoinBss
+ * _rtw_join_timeout_handler - Timeout/failure handler for CMD JoinBss
  * @adapter: pointer to struct adapter structure
  */
 void _rtw_join_timeout_handler (unsigned long data)
-- 
2.7.4

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


[PATCH 0/3] Spelling fixes for rtl8188eu

2017-09-14 Thread Valentine Sinitsyn
There are some fixes for typos we discovered in rtl8188eu staging driver
as a part of our Open Source Summit North America 2017 tutorial session.

Valentine Sinitsyn (3):
  staging: rtl8188eu: Fix a typo ("deflaut")
  staging: rtl8188eu: Fix a typo ("faliure")
  taging: rtl8188eu: Fix a typo ("cacluated")

 drivers/staging/rtl8188eu/core/rtw_efuse.c   | 2 +-
 drivers/staging/rtl8188eu/core/rtw_mlme.c| 2 +-
 drivers/staging/rtl8188eu/hal/odm_HWConfig.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4

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


[PATCH 3/3] taging: rtl8188eu: Fix a typo ("cacluated")

2017-09-14 Thread Valentine Sinitsyn
This improves spelling in the comment line to make things easier to get
for future rtl8188eu developers.

Fixes: 6c984c81fe27 (staging: r8188eu: Add files for new driver - part
12)
Signed-off-by: Wolfgang Hartmann 
Signed-off-by: Manish Shrestha 
Signed-off-by: Valentine Sinitsyn 
---
 drivers/staging/rtl8188eu/hal/odm_HWConfig.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c 
b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
index 0555e42..5fcbe56 100644
--- a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
@@ -109,7 +109,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct 
odm_dm_struct *dm_odm,
 
dm_odm->PhyDbgInfo.NumQryPhyStatusCCK++;
/*  (1)Hardware does not provide RSSI for CCK */
-   /*  (2)PWDB, Average PWDB cacluated by hardware (for rate 
adaptive) */
+   /*  (2)PWDB, Average PWDB calculated by hardware (for rate 
adaptive) */
 
cck_highpwr = dm_odm->bCckHighPower;
 
@@ -223,7 +223,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct 
odm_dm_struct *dm_odm,
pPhyInfo->RxSNR[i] = (s32)(pPhyStaRpt->path_rxsnr[i]/2);
dm_odm->PhyDbgInfo.RxSNRdB[i] = 
(s32)(pPhyStaRpt->path_rxsnr[i]/2);
}
-   /*  (2)PWDB, Average PWDB cacluated by hardware (for rate 
adaptive) */
+   /*  (2)PWDB, Average PWDB calculated by hardware (for rate 
adaptive) */
rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1) & 
0x7f) - 110;
 
PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
-- 
2.7.4

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


Re: [PATCH v2] android: binder: Drop lru lock in isolate callback

2017-09-14 Thread Andrew Morton
On Thu, 14 Sep 2017 14:22:25 -0400 Sherry Yang  wrote:

> Drop the global lru lock in isolate callback
> before calling zap_page_range which calls
> cond_resched, and re-acquire the global lru
> lock before returning. Also change return
> code to LRU_REMOVED_RETRY.
> 
> Use mmput_async when fail to acquire mmap sem
> in an atomic context.
> 
> Fix "BUG: sleeping function called from invalid context"
> errors when CONFIG_DEBUG_ATOMIC_SLEEP is enabled.
> 
> Also restore mmput_async, which was initially introduced in
> ec8d7c14e ("mm, oom_reaper: do not mmput synchronously from
> the oom reaper context"), and was removed in 212925802
> ("mm: oom: let oom_reap_task and exit_mmap run concurrently").

Ho hum, OK.  It's a bit sad to bring this back for one caller but
mm.async_put_work is there and won't be going away.

The mmdrop_async stuff should be moved into fork.c (and maybe made
static) as well.  It's pointless having this stuff global and inlined,
especially mmdrop_async_fn().


Something like the below, not yet tested...


From: Andrew Morton 
Subject: include/linux/sched/mm.h: uninline mmdrop_async(), etc

mmdrop_async() is only used in fork.c.  Move that and its support functions
into fork.c, uninline it all.



Signed-off-by: Andrew Morton 
---

 include/linux/sched/mm.h |   24 +--
 kernel/fork.c|   58 +
 2 files changed, 42 insertions(+), 40 deletions(-)

diff -puN include/linux/sched/mm.h~a include/linux/sched/mm.h
--- a/include/linux/sched/mm.h~a
+++ a/include/linux/sched/mm.h
@@ -10,7 +10,7 @@
 /*
  * Routines for handling mm_structs
  */
-extern struct mm_struct * mm_alloc(void);
+extern struct mm_struct *mm_alloc(void);
 
 /**
  * mmgrab() - Pin a &struct mm_struct.
@@ -34,27 +34,7 @@ static inline void mmgrab(struct mm_stru
atomic_inc(&mm->mm_count);
 }
 
-/* mmdrop drops the mm and the page tables */
-extern void __mmdrop(struct mm_struct *);
-static inline void mmdrop(struct mm_struct *mm)
-{
-   if (unlikely(atomic_dec_and_test(&mm->mm_count)))
-   __mmdrop(mm);
-}
-
-static inline void mmdrop_async_fn(struct work_struct *work)
-{
-   struct mm_struct *mm = container_of(work, struct mm_struct, 
async_put_work);
-   __mmdrop(mm);
-}
-
-static inline void mmdrop_async(struct mm_struct *mm)
-{
-   if (unlikely(atomic_dec_and_test(&mm->mm_count))) {
-   INIT_WORK(&mm->async_put_work, mmdrop_async_fn);
-   schedule_work(&mm->async_put_work);
-   }
-}
+extern void mmdrop(struct mm_struct *mm);
 
 /**
  * mmget() - Pin the address space associated with a &struct mm_struct.
diff -puN kernel/fork.c~a kernel/fork.c
--- a/kernel/fork.c~a
+++ a/kernel/fork.c
@@ -386,6 +386,46 @@ void free_task(struct task_struct *tsk)
 }
 EXPORT_SYMBOL(free_task);
 
+/*
+ * Called when the last reference to the mm
+ * is dropped: either by a lazy thread or by
+ * mmput. Free the page directory and the mm.
+ */
+static void __mmdrop(struct mm_struct *mm)
+{
+   BUG_ON(mm == &init_mm);
+   mm_free_pgd(mm);
+   destroy_context(mm);
+   hmm_mm_destroy(mm);
+   mmu_notifier_mm_destroy(mm);
+   check_mm(mm);
+   put_user_ns(mm->user_ns);
+   free_mm(mm);
+}
+
+void mmdrop(struct mm_struct *mm)
+{
+   if (unlikely(atomic_dec_and_test(&mm->mm_count)))
+   __mmdrop(mm);
+}
+EXPORT_SYMBOL_GPL(mmdrop)
+
+static void mmdrop_async_fn(struct work_struct *work)
+{
+   struct mm_struct *mm;
+
+   mm = container_of(work, struct mm_struct, async_put_work);
+   __mmdrop(mm);
+}
+
+static void mmdrop_async(struct mm_struct *mm)
+{
+   if (unlikely(atomic_dec_and_test(&mm->mm_count))) {
+   INIT_WORK(&mm->async_put_work, mmdrop_async_fn);
+   schedule_work(&mm->async_put_work);
+   }
+}
+
 static inline void free_signal_struct(struct signal_struct *sig)
 {
taskstats_tgid_free(sig);
@@ -895,24 +935,6 @@ struct mm_struct *mm_alloc(void)
return mm_init(mm, current, current_user_ns());
 }
 
-/*
- * Called when the last reference to the mm
- * is dropped: either by a lazy thread or by
- * mmput. Free the page directory and the mm.
- */
-void __mmdrop(struct mm_struct *mm)
-{
-   BUG_ON(mm == &init_mm);
-   mm_free_pgd(mm);
-   destroy_context(mm);
-   hmm_mm_destroy(mm);
-   mmu_notifier_mm_destroy(mm);
-   check_mm(mm);
-   put_user_ns(mm->user_ns);
-   free_mm(mm);
-}
-EXPORT_SYMBOL_GPL(__mmdrop);
-
 static inline void __mmput(struct mm_struct *mm)
 {
VM_BUG_ON(atomic_read(&mm->mm_users));
_

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


Re: [PATCH 1/3] staging: rtl8188eu: Fix a typo ("deflaut")

2017-09-14 Thread Tobin C. Harding
Good work getting this set submitted.

On Thu, Sep 14, 2017 at 12:05:18PM -0700, Valentine Sinitsyn wrote:
> This improves spelling in the comment line to make things easier to get
> for future rtl8188eu developers.
> 
> Fixes: ee5f8a431ea (staging: rtl8188eu: Move all efuse related code to
> rtw_efuse.c)

You may like to re-read Documentation/process/submitting-patches.rst to check 
the format for commit
logs. Preferred style is

1. what is wrong with the code i.e why the patch is necessary.
2. what the patch does to fix the above described problem.

Also, prefer imperative mood i.e 'Do XYZ' instead of 'This patch does XYZ'

> Signed-off-by: Wolfgang Hartmann 
> Signed-off-by: Manish Shrestha 
> Signed-off-by: Valentine Sinitsyn 
> ---
>  drivers/staging/rtl8188eu/core/rtw_efuse.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c 
> b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> index b9bdff0..2c4c8c4 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> @@ -48,7 +48,7 @@ void Efuse_PowerSwitch(
>   if (PwrState) {
>   usb_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON);
>  
> - /*  1.2V Power: From VDDON with Power Cut(0xh[15]), defualt 
> valid */
> + /*  1.2V Power: From VDDON with Power Cut(0xh[15]), default 
> valid */
>   tmpV16 = usb_read16(pAdapter, REG_SYS_ISO_CTRL);
>   if (!(tmpV16 & PWC_EV12V)) {
>   tmpV16 |= PWC_EV12V;
> -- 
> 2.7.4
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/3] Spelling fixes for rtl8188eu

2017-09-14 Thread Tobin C. Harding
On Thu, Sep 14, 2017 at 12:05:17PM -0700, Valentine Sinitsyn wrote:
> There are some fixes for typos we discovered in rtl8188eu staging driver
> as a part of our Open Source Summit North America 2017 tutorial session.
> 
> Valentine Sinitsyn (3):
>   staging: rtl8188eu: Fix a typo ("deflaut")
>   staging: rtl8188eu: Fix a typo ("faliure")
>   taging: rtl8188eu: Fix a typo ("cacluated")

All three of these changes could have been done in a single patch. The saying 
goes 'one thing per
patch', since all three patches in this set fix typos they could all be in a 
single patch.

Good luck,
Tobin.

>  drivers/staging/rtl8188eu/core/rtw_efuse.c   | 2 +-
>  drivers/staging/rtl8188eu/core/rtw_mlme.c| 2 +-
>  drivers/staging/rtl8188eu/hal/odm_HWConfig.c | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> -- 
> 2.7.4
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v1] Spelling fixes for rtl8188eu

2017-09-14 Thread Valentine Sinitsyn
There are some fixes for typos we discovered in rtl8188eu staging driver
as a part of our Open Source Summit North America 2017 tutorial session.

Changes in v1:
  - Merge patches into one
  - Better commit log message

Valentine Sinitsyn (1):
  staging: rtl8188eu: Fix spelling

 drivers/staging/rtl8188eu/core/rtw_efuse.c| 2 +-
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +-
 drivers/staging/rtl8188eu/hal/odm_HWConfig.c  | 4 ++--
 drivers/staging/rtl8188eu/include/odm.h   | 2 +-
 drivers/staging/rtl8188eu/include/rtl8188e_spec.h | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.7.4

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


[PATCH v1] staging: rtl8188eu: Fix spelling

2017-09-14 Thread Valentine Sinitsyn
rtl8188eu contains some spelling errors in comment lines as well as in
constants. Harmless as they are, they still make the code feel a bit
unclean, which is not something we want in the kernel.

Improve this by fixing typos so they won't catch eyes of future driver
developers anymore.

Signed-off-by: Wolfgang Hartmann 
Signed-off-by: Manish Shrestha 
Signed-off-by: Valentine Sinitsyn 
---
 drivers/staging/rtl8188eu/core/rtw_efuse.c| 2 +-
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +-
 drivers/staging/rtl8188eu/hal/odm_HWConfig.c  | 4 ++--
 drivers/staging/rtl8188eu/include/odm.h   | 2 +-
 drivers/staging/rtl8188eu/include/rtl8188e_spec.h | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c 
b/drivers/staging/rtl8188eu/core/rtw_efuse.c
index b9bdff0..2c4c8c4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
+++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
@@ -48,7 +48,7 @@ void Efuse_PowerSwitch(
if (PwrState) {
usb_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON);
 
-   /*  1.2V Power: From VDDON with Power Cut(0xh[15]), defualt 
valid */
+   /*  1.2V Power: From VDDON with Power Cut(0xh[15]), default 
valid */
tmpV16 = usb_read16(pAdapter, REG_SYS_ISO_CTRL);
if (!(tmpV16 & PWC_EV12V)) {
tmpV16 |= PWC_EV12V;
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index f663e6c..0d2381d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1329,7 +1329,7 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 
*pbuf)
 }
 
 /*
- * _rtw_join_timeout_handler - Timeout/faliure handler for CMD JoinBss
+ * _rtw_join_timeout_handler - Timeout/failure handler for CMD JoinBss
  * @adapter: pointer to struct adapter structure
  */
 void _rtw_join_timeout_handler (unsigned long data)
diff --git a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c 
b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
index 0555e42..5fcbe56 100644
--- a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
@@ -109,7 +109,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct 
odm_dm_struct *dm_odm,
 
dm_odm->PhyDbgInfo.NumQryPhyStatusCCK++;
/*  (1)Hardware does not provide RSSI for CCK */
-   /*  (2)PWDB, Average PWDB cacluated by hardware (for rate 
adaptive) */
+   /*  (2)PWDB, Average PWDB calculated by hardware (for rate 
adaptive) */
 
cck_highpwr = dm_odm->bCckHighPower;
 
@@ -223,7 +223,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct 
odm_dm_struct *dm_odm,
pPhyInfo->RxSNR[i] = (s32)(pPhyStaRpt->path_rxsnr[i]/2);
dm_odm->PhyDbgInfo.RxSNRdB[i] = 
(s32)(pPhyStaRpt->path_rxsnr[i]/2);
}
-   /*  (2)PWDB, Average PWDB cacluated by hardware (for rate 
adaptive) */
+   /*  (2)PWDB, Average PWDB calculated by hardware (for rate 
adaptive) */
rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1) & 
0x7f) - 110;
 
PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
diff --git a/drivers/staging/rtl8188eu/include/odm.h 
b/drivers/staging/rtl8188eu/include/odm.h
index 4fb3bb0..50e2673 100644
--- a/drivers/staging/rtl8188eu/include/odm.h
+++ b/drivers/staging/rtl8188eu/include/odm.h
@@ -478,7 +478,7 @@ enum odm_operation_mode {
 
 /*  ODM_CMNINFO_WM_MODE */
 enum odm_wireless_mode {
-   ODM_WM_UNKNOW   = 0x0,
+   ODM_WM_UNKNOWN  = 0x0,
ODM_WM_B= BIT(0),
ODM_WM_G= BIT(1),
ODM_WM_A= BIT(2),
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_spec.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_spec.h
index c93e19d..c33d312 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_spec.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_spec.h
@@ -15,7 +15,7 @@
 #ifndef __RTL8188E_SPEC_H__
 #define __RTL8188E_SPEC_H__
 
-/*8192C Regsiter offset definition */
+/*8192C Register offset definition */
 
 #defineHAL_PS_TIMER_INT_DELAY  50  /*   50 microseconds */
 #defineHAL_92C_NAV_UPPER_UNIT  128 /*  micro-second */
@@ -701,7 +701,7 @@ Current IOREG MAP
 
 #define REG_USB_HRPWM  0xFE58
 #define REG_USB_HCPWM  0xFE57
-/*8192C Regsiter Bit and Content definition */
+/*8192C Register Bit and Content definition */
 /* 0xh ~ 0x00FFh   System Configuration */
 
 /* 2 SYS_ISO_CTRL */
-- 
2.7.4

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