[PATCH] staging: rtl8723bs: hal: move common code to macro

2019-06-09 Thread Hariprasad Kelam


As part of halbtc8723b2ant_TdmaDurationAdjust function below
piece of code is used many times.

halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, val);
pCoexDm->psTdmaDuAdjType = val;

This patch replaces this common code with MACRO
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 746 ++--
 1 file changed, 293 insertions(+), 453 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c 
b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
index cb62fc0..56d842e 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
@@ -7,6 +7,13 @@
 
 #include "Mp_Precomp.h"
 
+/* defines */
+#define HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(val)\
+do { \
+   halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, val);   \
+   pCoexDm->psTdmaDuAdjType = val;   \
+} while (0)
+
 /*  Global variables, these are static variables */
 static COEX_DM_8723B_2ANT GLCoexDm8723b2Ant;
 static PCOEX_DM_8723B_2ANT pCoexDm = &GLCoexDm8723b2Ant;
@@ -1599,64 +1606,44 @@ static void halbtc8723b2ant_TdmaDurationAdjust(
{
if (bScoHid) {
if (bTxPause) {
-   if (maxInterval == 1) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13);
-   pCoexDm->psTdmaDuAdjType = 13;
-   } else if (maxInterval == 2) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14);
-   pCoexDm->psTdmaDuAdjType = 14;
-   } else if (maxInterval == 3) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15);
-   pCoexDm->psTdmaDuAdjType = 15;
-   } else {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15);
-   pCoexDm->psTdmaDuAdjType = 15;
-   }
+   if (maxInterval == 1)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(13);
+   else if (maxInterval == 2)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(14);
+   else if (maxInterval == 3)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(15);
+   else
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(15);
} else {
-   if (maxInterval == 1) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9);
-   pCoexDm->psTdmaDuAdjType = 9;
-   } else if (maxInterval == 2) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10);
-   pCoexDm->psTdmaDuAdjType = 10;
-   } else if (maxInterval == 3) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11);
-   pCoexDm->psTdmaDuAdjType = 11;
-   } else {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11);
-   pCoexDm->psTdmaDuAdjType = 11;
-   }
+   if (maxInterval == 1)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(9);
+   else if (maxInterval == 2)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(10);
+   else if (maxInterval == 3)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(11);
+   else
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(11);
}
} else {
if (bTxPause) {
-   if (maxInterval == 1) {
- 

Re: [PATCH] staging: rtl8723bs: hal: move common code to macro

2019-06-09 Thread Greg Kroah-Hartman
On Sun, Jun 09, 2019 at 04:02:32PM +0530, Hariprasad Kelam wrote:
> 
> As part of halbtc8723b2ant_TdmaDurationAdjust function below
> piece of code is used many times.
> 
> halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, val);
> pCoexDm->psTdmaDuAdjType = val;
> 
> This patch replaces this common code with MACRO
> HAL_BTC8723B2ANT_DMA_DURATION_ADJUST

Why is all of this indented?  And line-wrapped at an odd column?  Please
use at lines around 72 characters long.

> 
> Signed-off-by: Hariprasad Kelam 
> ---
>  drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 746 
> ++--
>  1 file changed, 293 insertions(+), 453 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c 
> b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
> index cb62fc0..56d842e 100644
> --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
> +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
> @@ -7,6 +7,13 @@
>  
>  #include "Mp_Precomp.h"
>  
> +/* defines */
> +#define HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(val)  \
> +do {   \
> + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, val);   \
> + pCoexDm->psTdmaDuAdjType = val;   \
> +} while (0)

The goal is to move away from crazy macros, not add new ones :)

But this does make the code a lot simpler, so it's ok.  But please fix
up the changelog text and resend.

thanks,

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


Re: [PATCH] staging: isdn: To make hysdn_proc_entry static.

2019-06-09 Thread gre...@linuxfoundation.org
On Sun, Jun 09, 2019 at 12:24:59AM +, Rishiraj Manwatkar wrote:
>   Made hysdn_proc_entry static as suggested by Sparse tool.

Why is this indented?

> 
> Signed-off-by: Rishiraj Manwatkar 
> ---
>  drivers/staging/isdn/hysdn/hysdn_procconf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/isdn/hysdn/hysdn_procconf.c 
> b/drivers/staging/isdn/hysdn/hysdn_procconf.c
> index 73079213ec94..3d12c058a6f1 100644
> --- a/drivers/staging/isdn/hysdn/hysdn_procconf.c
> +++ b/drivers/staging/isdn/hysdn/hysdn_procconf.c
> @@ -349,7 +349,7 @@ static const struct file_operations conf_fops =
>  /*/
>  /* hysdn subdir in /proc/net */
>  /*/
> -struct proc_dir_entry *hysdn_proc_entry = NULL;
> +static struct proc_dir_entry *hysdn_proc_entry = NULL;

I will have to wait until after 5.3-rc1 before taking any
drivers/staging/isdn patches, sorry.

I suggest waiting until then before resending, and even then, the isdn
code is about to be deleted, try working on code that is being accepted.

thanks,

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


Re: [PATCH] staging: isdn: hysdn: fix symbol 'hysdn_proc_entry' was not declared.

2019-06-09 Thread Greg KH
On Wed, Jun 05, 2019 at 03:53:49PM +0200, Valerio Genovese wrote:
> This was reported by sparse:
> drivers/staging/isdn/hysdn/hysdn_procconf.c:352:23: warning: symbol 
> 'hysdn_proc_entry' was not declared. Should it be static?
> 
> Signed-off-by: Valerio Genovese 
> ---
>  drivers/staging/isdn/hysdn/hysdn_defs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/isdn/hysdn/hysdn_defs.h 
> b/drivers/staging/isdn/hysdn/hysdn_defs.h
> index cdac46a21692..a651686b1787 100644
> --- a/drivers/staging/isdn/hysdn/hysdn_defs.h
> +++ b/drivers/staging/isdn/hysdn/hysdn_defs.h
> @@ -221,7 +221,7 @@ typedef struct hycapictrl_info hycapictrl_info;
>  /* exported vars */
>  /*/
>  extern hysdn_card *card_root;/* pointer to first card */
> -
> +extern struct proc_dir_entry *hysdn_proc_entry; /* hysdn subdir in /proc/net

I can not take drivers/staging/isdn patches until 5.3-rc1.

thanks,

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


Re: [PATCH] staging: rtl8723bs: fix indentation issues

2019-06-09 Thread Greg Kroah-Hartman
On Sun, Jun 09, 2019 at 11:07:41AM +0530, Hariprasad Kelam wrote:
> fix below issues reported by checkpatch
> 
> CHECK: Please don't use multiple blank lines
> WARNING: space prohibited between function name and open parenthesis '('
> +void _rtw_open_pktfile (_pkt *pktptr, struct pkt_file *pfile)
> WARNING: space prohibited before semicolon
> WARNING: space prohibited between function name and open parenthesis '('
> CHECK: spaces preferred around that '-' (ctx:VxV)
> CHECK: Comparison to NULL could be written "!pxmitbuf->pallocated_buf"
> CHECK: spaces preferred around that '*' (ctx:VxV)
> CHECK: spaces preferred around that '/' (ctx:VxV)
> WARNING: Missing a blank line after declarations
> WARNING: braces {} are not necessary for single statement blocks
> CHECK: spaces preferred around that '/' (ctx:VxV)
> CHECK: Using comparison to true is error prone
> 
> Signed-off-by: Hariprasad Kelam 

That is a lot of different issues trying to be fixed in one patch.
Please break this up into "one logical type of fix per patch" and make a
patch series.

thanks,

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


Re: [PATCH] staging: rtl8723bs: core: rtw_mlme_ext.c: Remove unused variables

2019-06-09 Thread Greg KH
On Fri, Jun 07, 2019 at 12:41:23PM +0530, Nishka Dasgupta wrote:
> Remove variables that are declared and assigned values but not otherwise
> used.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta 
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 9 -
>  1 file changed, 9 deletions(-)

You sent me 8 patches for this driver, yet only 2 were ordered in a
series.  I have no idea what order to apply these in :(

Please resend them _all_ in a numbered patch series so I have a chance
to get this correct.

thanks,

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


[PATCH] Staging: ralink-gdma: fixed a brace coding style issue

2019-06-09 Thread Harold André
Fixed a coding style issue.

Signed-off-by: Harold André 
---
 drivers/staging/ralink-gdma/ralink-gdma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c 
b/drivers/staging/ralink-gdma/ralink-gdma.c
index de3e357b2640..5854551d0a52 100644
--- a/drivers/staging/ralink-gdma/ralink-gdma.c
+++ b/drivers/staging/ralink-gdma/ralink-gdma.c
@@ -814,9 +814,8 @@ static int gdma_dma_probe(struct platform_device *pdev)
dma_dev = devm_kzalloc(&pdev->dev,
   struct_size(dma_dev, chan, data->chancnt),
   GFP_KERNEL);
-   if (!dma_dev) {
+   if (!dma_dev)
return -EINVAL;
-   }
dma_dev->data = data;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
2.20.1

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


Re: [PATCH 1/2] staging: kpc2000: kpc2000_i2c: void* -> void *

2019-06-09 Thread Greg KH
On Sat, Jun 08, 2019 at 01:45:05PM +, Geordan Neukum wrote:
> On Sat, Jun 08, 2019 at 03:27:46PM +0800, Hao Xu wrote:
> > modify void* to void * for #define inb_p(a) readq((void*)a)
> > and #define outb_p(d,a) writeq(d,(void*)a)
> > 
> > Signed-off-by: Hao Xu 
> > ---
> >  drivers/staging/kpc2000/kpc2000_i2c.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c 
> > b/drivers/staging/kpc2000/kpc2000_i2c.c
> > index a434dd0..de3a0c8 100644
> > --- a/drivers/staging/kpc2000/kpc2000_i2c.c
> > +++ b/drivers/staging/kpc2000/kpc2000_i2c.c
> > @@ -124,9 +124,9 @@ struct i2c_device {
> >  
> >  // FIXME!
> >  #undef inb_p
> > -#define inb_p(a) readq((void*)a)
> > +#define inb_p(a) readq((void *)a)
> >  #undef outb_p
> > -#define outb_p(d,a) writeq(d,(void*)a)
> > +#define outb_p(d,a) writeq(d,(void *)a)
> 
> Alternatively to fixing up the style here, did you consider just
> removing these two macros altogether and calling [read|write]q
> directly throughout the kpc_i2c driver (per the '//FIXME' comment)?
> 
> Unless, I'm misunderstanding something, these macros are shadowing the
> functions [in|out]b_p, which already exist in io.h. [in|out]b_p are for
> 8-bit i/o transactions and [read|write]q are for 64-bit transactions, so
> shadowing the original [in|out]b_p with something that actually does
> 64-bit transactions is probably potentially misleading here.

Yes, these should be fixed up "properly".  But I'll take the coding
style cleanups for now.

thanks,

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


[Patch v2] staging: rtl8723bs: hal: move common code to macro

2019-06-09 Thread Hariprasad Kelam
In halbtc8723b2ant_TdmaDurationAdjust function,below piece of code is
repeated many times.

halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, val);
pCoexDm->psTdmaDuAdjType = val;

So replace the same with "HAL_BTC8723B2ANT_DMA_DURATION_ADJUST" MACRO.

Signed-off-by: Hariprasad Kelam 
-
changes in v2: clean the changelog with proper indent
-
---
 drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 742 ++--
 1 file changed, 291 insertions(+), 451 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c 
b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
index cb62fc0..02da0a8 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
@@ -7,6 +7,13 @@
 
 #include "Mp_Precomp.h"
 
+/* defines */
+#define HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(val)\
+do { \
+   halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, val);   \
+   pCoexDm->psTdmaDuAdjType = val;   \
+} while (0)
+
 /*  Global variables, these are static variables */
 static COEX_DM_8723B_2ANT GLCoexDm8723b2Ant;
 static PCOEX_DM_8723B_2ANT pCoexDm = &GLCoexDm8723b2Ant;
@@ -1599,63 +1606,43 @@ static void halbtc8723b2ant_TdmaDurationAdjust(
{
if (bScoHid) {
if (bTxPause) {
-   if (maxInterval == 1) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13);
-   pCoexDm->psTdmaDuAdjType = 13;
-   } else if (maxInterval == 2) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14);
-   pCoexDm->psTdmaDuAdjType = 14;
-   } else if (maxInterval == 3) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15);
-   pCoexDm->psTdmaDuAdjType = 15;
-   } else {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15);
-   pCoexDm->psTdmaDuAdjType = 15;
-   }
+   if (maxInterval == 1)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(13);
+   else if (maxInterval == 2)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(14);
+   else if (maxInterval == 3)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(15);
+   else
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(15);
} else {
-   if (maxInterval == 1) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9);
-   pCoexDm->psTdmaDuAdjType = 9;
-   } else if (maxInterval == 2) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10);
-   pCoexDm->psTdmaDuAdjType = 10;
-   } else if (maxInterval == 3) {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11);
-   pCoexDm->psTdmaDuAdjType = 11;
-   } else {
-   
halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11);
-   pCoexDm->psTdmaDuAdjType = 11;
-   }
+   if (maxInterval == 1)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(9);
+   else if (maxInterval == 2)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(10);
+   else if (maxInterval == 3)
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(11);
+   else
+   
HAL_BTC8723B2ANT_DMA_DURATION_ADJUST(11);
}
} else {
if (bTxPause) {
-   if (maxInterval == 1) {
-   

[PATCH 1/3] staging: rtl8723bs: fix warning comparison to NULL

2019-06-09 Thread Hariprasad Kelam
This patch fixes below issue reported by checkpatch

CHECK: Comparison to NULL could be written "!pxmitbuf->pallocated_buf"
+   if (pxmitbuf->pallocated_buf == NULL)

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c 
b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 4e4e565..c125ac2 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -50,7 +50,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, 
struct xmit_buf *pxmitb
 {
if (alloc_sz > 0) {
pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
-   if (pxmitbuf->pallocated_buf == NULL)
+   if (!pxmitbuf->pallocated_buf)
return _FAIL;
 
pxmitbuf->pbuf = (u8 
*)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
-- 
2.7.4

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


[PATCH 2/3] staging: rtl8723bs: fix issue "Using comparison to true is error prone"

2019-06-09 Thread Hariprasad Kelam
this patch fixes below issue reported by checkpatch

CHECK: Using comparison to true is error prone
+   if (res == true)

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c 
b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index c125ac2..4da5617 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -231,7 +231,7 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
&& padapter->registrypriv.wifi_spec == 0) {
if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4)) {
res = rtw_mlcst2unicst(padapter, pkt);
-   if (res == true)
+   if (res)
goto exit;
} else {
/* DBG_871X("Stop M2U(%d, %d)! ", 
pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmitbuf_cnt); */
-- 
2.7.4

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


[PATCH 3/3] staging: rtl8723bs: provide spaces around unary operators

2019-06-09 Thread Hariprasad Kelam
This patch fixes below issues reported by checkpatch

CHECK: spaces preferred around that '-' (ctx:VxV)
+   skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len,
rmem, len);

CHECK: spaces preferred around that '*' (ctx:VxV)
+#define WMM_XMIT_THRESHOLD (NR_XMITFRAME*2/5)
 ^

CHECK: spaces preferred around that '/' (ctx:VxV)
+#define WMM_XMIT_THRESHOLD (NR_XMITFRAME*2/5)
   ^
CHECK: spaces preferred around that '/' (ctx:VxV)
+   if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4)) {
 ^

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c 
b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 4da5617..4e81bc1 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -32,7 +32,7 @@ uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, 
uint rlen)
len = (rlen > len) ? len : rlen;
 
if (rmem)
-   skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, 
len);
+   skb_copy_bits(pfile->pkt, pfile->buf_len - pfile->pkt_len, 
rmem, len);
 
pfile->cur_addr += len;
pfile->pkt_len -= len;
@@ -65,7 +65,7 @@ void rtw_os_xmit_resource_free(struct adapter *padapter, 
struct xmit_buf *pxmitb
kfree(pxmitbuf->pallocated_buf);
 }
 
-#define WMM_XMIT_THRESHOLD (NR_XMITFRAME*2/5)
+#define WMM_XMIT_THRESHOLD (NR_XMITFRAME * 2 / 5)
 
 void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt)
 {
@@ -229,7 +229,7 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
#endif
)
&& padapter->registrypriv.wifi_spec == 0) {
-   if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4)) {
+   if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME / 4)) {
res = rtw_mlcst2unicst(padapter, pkt);
if (res)
goto exit;
-- 
2.7.4

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


Re: [PATCH 00/34] treewide: simplify getting the adapter of an I2C client

2019-06-09 Thread Peter Rosin
On 2019-06-08 12:55, Wolfram Sang wrote:
> While preparing a refactoring series, I noticed that some drivers use a
> complicated way of determining the adapter of a client. The easy way is
> to use the intended pointer: client->adapter
> 
> These drivers do:
>   to_i2c_adapter(client->dev.parent);
> 
> The I2C core populates the parent pointer as:
>   client->dev.parent = &client->adapter->dev;
> 
> Now take into consideration that
>   to_i2c_adapter(&adapter->dev);
> 
> is a complicated way of saying 'adapter', then we can even formally
> prove that the complicated expression can be simplified by using
> client->adapter.
> 
> The conversion was done using a coccinelle script with some manual
> indentation fixes applied on top.
> 
> To avoid a brown paper bag mistake, I double checked this on a Renesas
> Salvator-XS board (R-Car M3N) and verified both expression result in the
> same pointer. Other than that, the series is only build tested.

Similar things go on in:

drivers/hwmon/lm90.c
drivers/leds/leds-is31fl319x.c
drivers/of/unittest.c

Those have this pattern:

struct device *dev = &client->dev;
struct i2c_adapter *adapter = to_i2c_adapter(dev->parent);

And drivers/rtc/rtc-fm3130.c has a couple of these:

tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
...);

where fm3130->client is of type "struct i2c_client *"

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


Re: [PATCH 1/2] staging: rtl8712: r8712_setdatarate_cmd(): Change

2019-06-09 Thread Nishka Dasgupta

On 07/06/19 7:45 PM, Dan Carpenter wrote:

Probably you sent this patch unintentionally.  The subject doesn't make
any sort of sense.  :P


So the problem with the subject line is that git send-email and vim (as 
configured on my laptop) tend to line-wrap even the subject line. Since 
I have two patches that do the same thing for different functions, I 
felt I should have the driver and the function name in the subject line 
(to avoid confusion between the patches and to allow for easy searching 
later). But that doesn't leave enough space in the subject line for 
"Change return values/type" or any other descriptive message. What 
should I do?




On Fri, Jun 07, 2019 at 07:36:57PM +0530, Nishka Dasgupta wrote:

Change the return values of function r8712_setdatarate_cmd from _SUCCESS
and _FAIL to 0 and -ENOMEM respectively.
Change the return type of the function from u8 to int to reflect this.
Change the call site of the function to check for 0 instead of _SUCCESS.
(Checking that the return value != 0 is not necessary; the return value

   ^^^

itself can simply be passed into the conditional.)

   ^





This is obvious.  No need to mention it in the commit message.


Okay, I'll amend that.


diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index b424b8436fcf..761e2ba68a42 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1367,7 +1367,7 @@ static int r8711_wx_set_rate(struct net_device *dev,
datarates[i] = 0xff;
}
}
-   if (r8712_setdatarate_cmd(padapter, datarates) != _SUCCESS)
+   if (r8712_setdatarate_cmd(padapter, datarates))
ret = -ENOMEM;

return ret;



It would be better to write this like so:

ret = r8712_setdatarate_cmd(padapter, datarates);
if (ret)
return ret;

return 0;

Or you could write it like:

return r8712_setdatarate_cmd(padapter, datarates);


Okay, since this is the only point at which a return happens in this 
function, I can do this.



Which ever one you prefer is fine

Thanking you,
Nishka


regards,
dan carpenter



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


Re: [PATCH] staging: rtl8723bs: core: rtw_mlme_ext.c: Remove unused variables

2019-06-09 Thread Nishka Dasgupta

On 09/06/19 4:32 PM, Greg KH wrote:

On Fri, Jun 07, 2019 at 12:41:23PM +0530, Nishka Dasgupta wrote:

Remove variables that are declared and assigned values but not otherwise
used.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 9 -
  1 file changed, 9 deletions(-)


You sent me 8 patches for this driver, yet only 2 were ordered in a
series.  I have no idea what order to apply these in :(

Please resend them _all_ in a numbered patch series so I have a chance
to get this correct.


Yes, I can do that. Who do I send the patch series to in that case? The 
maintainers list is slightly different for each file, and most of the 
patches in this driver are for different and unrelated files (except, I 
think, the two that I did send as a patch series). Do I combine the 
maintainers lists and send the entire patch series to everyone listed as 
a maintainer for any one of the patches in it?


Thanking you,
Nishka


thanks,

greg k-h



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


[PATCH] staging: kpc2000: remove extra white space in kpc2000_spi.c

2019-06-09 Thread Naoto Kobayashi
Since whitespace should not appear between asterisk and
variable name in a declaration statement, remove it and
fix checkpatch.pl error "foo * bar" should be "foo *bar".

Signed-off-by: Naoto Kobayashi 
---
 drivers/staging/kpc2000/kpc2000_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c 
b/drivers/staging/kpc2000/kpc2000_spi.c
index 28132e9e260d..c3e5c1848f53 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -496,7 +496,7 @@ kp_spi_probe(struct platform_device *pldev)
static int
 kp_spi_remove(struct platform_device *pldev)
 {
-   struct spi_master * master = platform_get_drvdata(pldev);
+   struct spi_master *master = platform_get_drvdata(pldev);
spi_unregister_master(master);
return 0;
 }
--
2.16.5

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


Re: [PATCH] staging: rtl8723bs: core: rtw_mlme_ext.c: Remove unused variables

2019-06-09 Thread Greg KH
On Mon, Jun 10, 2019 at 10:08:21AM +0530, Nishka Dasgupta wrote:
> On 09/06/19 4:32 PM, Greg KH wrote:
> > On Fri, Jun 07, 2019 at 12:41:23PM +0530, Nishka Dasgupta wrote:
> > > Remove variables that are declared and assigned values but not otherwise
> > > used.
> > > Issue found with Coccinelle.
> > > 
> > > Signed-off-by: Nishka Dasgupta 
> > > ---
> > >   drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 9 -
> > >   1 file changed, 9 deletions(-)
> > 
> > You sent me 8 patches for this driver, yet only 2 were ordered in a
> > series.  I have no idea what order to apply these in :(
> > 
> > Please resend them _all_ in a numbered patch series so I have a chance
> > to get this correct.
> 
> Yes, I can do that. Who do I send the patch series to in that case? The
> maintainers list is slightly different for each file, and most of the
> patches in this driver are for different and unrelated files (except, I
> think, the two that I did send as a patch series). Do I combine the
> maintainers lists and send the entire patch series to everyone listed as a
> maintainer for any one of the patches in it?

The maintainer and mailing list is the same for all of the files in a
single driver.  If not, then something is wrong.

And yes, you can combine the list of people if you wish but be sure you
are not just randomly including people who happened to touch the driver
"last".

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


[PATCH] staging: kpc2000: To make symbols static

2019-06-09 Thread Rishiraj Manwatkar
This patch makes 4 symbols static as suggested by Sparse tool.

Signed-off-by: Rishiraj Manwatkar 
---
 drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c 
b/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
index cda057569163..e4056607af0b 100644
--- a/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
+++ b/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
@@ -36,14 +36,14 @@ struct kpc_dma_device *kpc_dma_lookup_device(int minor)
return c;
 }
 
-void  kpc_dma_add_device(struct kpc_dma_device *ldev)
+static void  kpc_dma_add_device(struct kpc_dma_device *ldev)
 {
mutex_lock(&kpc_dma_mtx);
list_add(&ldev->list, &kpc_dma_list);
mutex_unlock(&kpc_dma_mtx);
 }
 
-void kpc_dma_del_device(struct kpc_dma_device *ldev)
+static void kpc_dma_del_device(struct kpc_dma_device *ldev)
 {
mutex_lock(&kpc_dma_mtx);
list_del(&ldev->list);
@@ -88,7 +88,7 @@ static const struct attribute *ndd_attr_list[] = {
NULL,
 };
 
-struct class *kpc_dma_class;
+static struct class *kpc_dma_class;
 
 /**  Platform Driver Functions  **/
 static
@@ -196,7 +196,7 @@ int  kpc_dma_remove(struct platform_device *pldev)
 }
 
 /**  Driver Functions  **/
-struct platform_driver kpc_dma_plat_driver_i = {
+static struct platform_driver kpc_dma_plat_driver_i = {
.probe= kpc_dma_probe,
.remove   = kpc_dma_remove,
.driver = {
-- 
2.17.1

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