Re: [PATCH] fs: Call kmap_local_page() in copy_string_kernel()

2022-07-22 Thread Fabio M. De Francesco
On venerdì 22 luglio 2022 02:14:20 CEST Ira Weiny wrote:
> On Sun, Jul 10, 2022 at 12:01:36PM +0200, Fabio M. De Francesco wrote:
> > The use of kmap_atomic() is being deprecated in favor of 
kmap_local_page().
> > 
> > With kmap_local_page(), the mappings are per thread, CPU local, not
> > globally visible and can take page faults. Furthermore, the mappings 
can be
> > acquired from any context (including interrupts).
> > 
> > Therefore, use kmap_local_page() in copy_string_kernel() instead of
> > kmap_atomic().
> > 
> > Tested with xfstests on a QEMU + KVM 32-bits VM booting a kernel with
> > HIGHMEM64GB enabled.
> > 
> > Suggested-by: Ira Weiny 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> > I sent a first patch to fs/exec.c for converting kmap() and 
kmap_atomic()
> > to kmap_local_page():
> > https://lore.kernel.org/lkml/20220630163527.9776-1-fmdefrance...@gmail.com/
> > 
> > Some days ago, Ira Weiny, while he was reviewing that patch, made me 
notice
> > that I had overlooked a second kmap_atomic() in the same file (thanks):
> > https://lore.kernel.org/lkml/YsiQptk19txHrG4c@iweiny-desk3/
> > 
> > I've been asked to send this as an additional change. This is why there 
will
> > not be any second version of that previous patch.
> > 
> >  fs/exec.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/exec.c b/fs/exec.c
> > index 4a2129c0d422..5fa652ca5823 100644
> > --- a/fs/exec.c
> > +++ b/fs/exec.c
> > @@ -639,11 +639,11 @@ int copy_string_kernel(const char *arg, struct 
linux_binprm *bprm)
> > page = get_arg_page(bprm, pos, 1);
> > if (!page)
> > return -E2BIG;
> > -   kaddr = kmap_atomic(page);
> > +   kaddr = kmap_local_page(page);
> > flush_arg_page(bprm, pos & PAGE_MASK, page);
> 
> I really question why we can't use memcpy_to_page() here and move the
> flush_arg_page() prior to the mapping?
> 
> flush_arg_page() only calls flush_cache_page() which does not need the
> mapping to work correctly AFAICT.

You're right here. I'm sorry for being so lazy and not checking that 
flush_arg_page() does not need to be called while the task holds the local 
mapping :-(

In v2 I'll move flush_arg_page() one line above memcpy_to_page().

Thanks for your comment,

Fabio

> 
> Ira
> 
> > memcpy(kaddr + offset_in_page(pos), arg, 
bytes_to_copy);
> > flush_dcache_page(page);
> > -   kunmap_atomic(kaddr);
> > +   kunmap_local(kaddr);
> > put_arg_page(page);
> > }
> >  
> > -- 
> > 2.36.1
> > 
> 







[PATCH] fs: Call kmap_local_page() in copy_string_kernel()

2022-07-10 Thread Fabio M. De Francesco
The use of kmap_atomic() is being deprecated in favor of kmap_local_page().

With kmap_local_page(), the mappings are per thread, CPU local, not
globally visible and can take page faults. Furthermore, the mappings can be
acquired from any context (including interrupts).

Therefore, use kmap_local_page() in copy_string_kernel() instead of
kmap_atomic().

Tested with xfstests on a QEMU + KVM 32-bits VM booting a kernel with
HIGHMEM64GB enabled.

Suggested-by: Ira Weiny 
Signed-off-by: Fabio M. De Francesco 
---

I sent a first patch to fs/exec.c for converting kmap() and kmap_atomic()
to kmap_local_page():
https://lore.kernel.org/lkml/20220630163527.9776-1-fmdefrance...@gmail.com/

Some days ago, Ira Weiny, while he was reviewing that patch, made me notice
that I had overlooked a second kmap_atomic() in the same file (thanks):
https://lore.kernel.org/lkml/YsiQptk19txHrG4c@iweiny-desk3/

I've been asked to send this as an additional change. This is why there will
not be any second version of that previous patch.

 fs/exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 4a2129c0d422..5fa652ca5823 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -639,11 +639,11 @@ int copy_string_kernel(const char *arg, struct 
linux_binprm *bprm)
page = get_arg_page(bprm, pos, 1);
if (!page)
return -E2BIG;
-   kaddr = kmap_atomic(page);
+   kaddr = kmap_local_page(page);
flush_arg_page(bprm, pos & PAGE_MASK, page);
memcpy(kaddr + offset_in_page(pos), arg, bytes_to_copy);
flush_dcache_page(page);
-   kunmap_atomic(kaddr);
+   kunmap_local(kaddr);
put_arg_page(page);
}
 
-- 
2.36.1




Re: [PATCH] fs: Replace kmap{,_atomic}() with kmap_local_page()

2022-07-09 Thread Fabio M. De Francesco
On venerdì 8 luglio 2022 22:18:35 CEST Ira Weiny wrote:
> On Thu, Jun 30, 2022 at 06:35:27PM +0200, Fabio M. De Francesco wrote:
> > The use of kmap() and kmap_atomic() are being deprecated in favor of
> > kmap_local_page().
> > 
> > With kmap_local_page(), the mappings are per thread, CPU local and not
> > globally visible. Furthermore, the mappings can be acquired from any
> > context (including interrupts).
> > 
> > Therefore, use kmap_local_page() in exec.c because these mappings are 
per
> > thread, CPU local, and not globally visible.
> > 
> > Tested with xfstests on a QEMU + KVM 32-bits VM booting a kernel with
> > HIGHMEM64GB enabled.
> > 
> > Suggested-by: Ira Weiny 
> 
> This looks good but there is a kmap_atomic() in this file which I _think_ 
can
> be converted as well.  But that is good as a separate patch.
> 
> Reviewed-by: Ira Weiny 
> 

Thanks for your review!

I didn't notice that kmap_atomic(). I'll send a conversion with a separate 
patch.

Fabio






Re: [PATCH] fs: Replace kmap{,_atomic}() with kmap_local_page()

2022-07-01 Thread Fabio M. De Francesco
On giovedì 30 giugno 2022 19:38:08 CEST Eric W. Biederman wrote:
> "Fabio M. De Francesco"  writes:
> 
> > The use of kmap() and kmap_atomic() are being deprecated in favor of
> > kmap_local_page().
> >
> > With kmap_local_page(), the mappings are per thread, CPU local and not
> > globally visible. Furthermore, the mappings can be acquired from any
> > context (including interrupts).
> >
> > Therefore, use kmap_local_page() in exec.c because these mappings are 
per
> > thread, CPU local, and not globally visible.
> >
> > Tested with xfstests on a QEMU + KVM 32-bits VM booting a kernel with
> > HIGHMEM64GB enabled.
> 
> Can someone please refresh my memory on what is going on.
> 
> I remember there were limitations that kmap_atomic had that are hard to
> meet so something I think it was kmap_local was invented and created
> to be the kmap_atomic replacement.

Please read highmem.rst. I've updated that document weeks ago:
https://docs.kernel.org/vm/highmem.html?highlight=highmem

Currently it contains many more information I can ever place here in order 
to answer your questions.

Believe me, this is not by any means a way to elude your questions. I'm 
pretty sure that by reading that document you'll have a clear vision on 
what is going on :-)

> 
> What are the requirements on kmap_local?  In copy_strings
> kmap is called in contexts that can sleep in page faults

No problems with kmap_local_page() with regard to page faults (again, 
please read the above-mentioned document).

From that document...

"It’s valid to take pagefaults in a local kmap region []".

"Each call of kmap_atomic() in the kernel creates a non-preemptible section 
and disable pagefaults. This could be a source of unwanted latency. 
Therefore users should prefer kmap_local_page() instead of kmap_atomic().".

> so any
> nearly any requirement except a thread local use is invalidated.
> 
> As you have described kmap_local above it does not sound like kmap_local
> is safe in this context,

Sorry, probably I should add that taking page faults is allowed. Would you 
prefer I send a v2 and add this information?

Thanks,

Fabio

> but that could just be a problem in description
> that my poor memory does is not recalling the necessary details to
> correct.
> 
> Eric
> 
> > Suggested-by: Ira Weiny 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> >  fs/exec.c | 14 +++---
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/fs/exec.c b/fs/exec.c
> > index 0989fb8472a1..4a2129c0d422 100644
> > --- a/fs/exec.c
> > +++ b/fs/exec.c
> > @@ -583,11 +583,11 @@ static int copy_strings(int argc, struct 
user_arg_ptr argv,
> >  
> > if (kmapped_page) {
> > 
flush_dcache_page(kmapped_page);
> > -   kunmap(kmapped_page);
> > +   kunmap_local(kaddr);
> > 
put_arg_page(kmapped_page);
> > }
> > kmapped_page = page;
> > -   kaddr = kmap(kmapped_page);
> > +   kaddr = 
kmap_local_page(kmapped_page);
> > kpos = pos & PAGE_MASK;
> > flush_arg_page(bprm, kpos, 
kmapped_page);
> > }
> > @@ -601,7 +601,7 @@ static int copy_strings(int argc, struct 
user_arg_ptr argv,
> >  out:
> > if (kmapped_page) {
> > flush_dcache_page(kmapped_page);
> > -   kunmap(kmapped_page);
> > +   kunmap_local(kaddr);
> > put_arg_page(kmapped_page);
> > }
> > return ret;
> > @@ -883,11 +883,11 @@ int transfer_args_to_stack(struct linux_binprm 
*bprm,
> >  
> > for (index = MAX_ARG_PAGES - 1; index >= stop; index--) {
> > unsigned int offset = index == stop ? bprm->p & 
~PAGE_MASK : 0;
> > -   char *src = kmap(bprm->page[index]) + offset;
> > +   char *src = kmap_local_page(bprm->page[index]) + 
offset;
> > sp -= PAGE_SIZE - offset;
> > if (copy_to_user((void *) sp, src, PAGE_SIZE - offset) 
!= 0)
> > ret = -EFAULT;
> > -   kunmap(bprm->page[index]);
> > +   kunmap_local(src);
> > if (ret)
> > goto out;
> > }
> > @@ -1680,13 +1680,13 @@ int remove_arg_zero(struct linux_binprm *bprm)
> > ret = -EFAULT;
> > goto out;
> > }
> > -   kaddr = kmap_atomic(page);
> > +   kaddr = kmap_local_page(page);
> >  
> > for (; offset < PAGE_SIZE && kaddr[offset];
> > offset++, bprm->p++)
> > ;
> >  
> > -   kunmap_atomic(kaddr);
> > +   kunmap_local(kaddr);
> > put_arg_page(page);
> > } while (offset == PAGE_SIZE);
> 







[PATCH] fs: Replace kmap{,_atomic}() with kmap_local_page()

2022-06-30 Thread Fabio M. De Francesco
The use of kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

With kmap_local_page(), the mappings are per thread, CPU local and not
globally visible. Furthermore, the mappings can be acquired from any
context (including interrupts).

Therefore, use kmap_local_page() in exec.c because these mappings are per
thread, CPU local, and not globally visible.

Tested with xfstests on a QEMU + KVM 32-bits VM booting a kernel with
HIGHMEM64GB enabled.

Suggested-by: Ira Weiny 
Signed-off-by: Fabio M. De Francesco 
---
 fs/exec.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 0989fb8472a1..4a2129c0d422 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -583,11 +583,11 @@ static int copy_strings(int argc, struct user_arg_ptr 
argv,
 
if (kmapped_page) {
flush_dcache_page(kmapped_page);
-   kunmap(kmapped_page);
+   kunmap_local(kaddr);
put_arg_page(kmapped_page);
}
kmapped_page = page;
-   kaddr = kmap(kmapped_page);
+   kaddr = kmap_local_page(kmapped_page);
kpos = pos & PAGE_MASK;
flush_arg_page(bprm, kpos, kmapped_page);
}
@@ -601,7 +601,7 @@ static int copy_strings(int argc, struct user_arg_ptr argv,
 out:
if (kmapped_page) {
flush_dcache_page(kmapped_page);
-   kunmap(kmapped_page);
+   kunmap_local(kaddr);
put_arg_page(kmapped_page);
}
return ret;
@@ -883,11 +883,11 @@ int transfer_args_to_stack(struct linux_binprm *bprm,
 
for (index = MAX_ARG_PAGES - 1; index >= stop; index--) {
unsigned int offset = index == stop ? bprm->p & ~PAGE_MASK : 0;
-   char *src = kmap(bprm->page[index]) + offset;
+   char *src = kmap_local_page(bprm->page[index]) + offset;
sp -= PAGE_SIZE - offset;
if (copy_to_user((void *) sp, src, PAGE_SIZE - offset) != 0)
ret = -EFAULT;
-   kunmap(bprm->page[index]);
+   kunmap_local(src);
if (ret)
goto out;
}
@@ -1680,13 +1680,13 @@ int remove_arg_zero(struct linux_binprm *bprm)
ret = -EFAULT;
goto out;
}
-   kaddr = kmap_atomic(page);
+   kaddr = kmap_local_page(page);
 
for (; offset < PAGE_SIZE && kaddr[offset];
offset++, bprm->p++)
;
 
-   kunmap_atomic(kaddr);
+   kunmap_local(kaddr);
put_arg_page(page);
} while (offset == PAGE_SIZE);
 
-- 
2.36.1




Re: [Outreachy kernel] [PATCH v4] staging: rtl8723bs: Remove led_blink_hdl() and everything related

2021-04-15 Thread Fabio M. De Francesco
On Thursday, April 15, 2021 9:28:46 AM CEST Greg Kroah-Hartman wrote:
> On Thu, Apr 15, 2021 at 09:17:31AM +0200, Fabio M. De Francesco wrote:
> > Removed useless led_blink_hdl() prototype and definition.
> > Removed struct LedBlink_param. Removed LedBlink entries in
> > rtw_cmd_callback[] and in wlancmds[]. Everything related to LedBlink is
> > not anymore needed. Index of slots changed in arrays comments to
> > reflect
> > current positions.
> > 
> > Reported-by: Julia Lawall 
> > Reported-by: Fabio Aiuto 
> > Reported-by: Greg Kroah-Hartman 
> > Suggested-by: Matthew Wilcox 
> > Suggested-by: Dan Carpenter 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> > Changes from v3: Merged the series into one single patch for avoiding
> > unnecessary intermediate stages.
> 
> Much better, thanks for sticking with this.  
>
I think it was worth doing this job well and getting it done, despite the 
difficulties I had.

I really appreciate your message.

Thanks so much,

Fabio
>
> Now queued up, and I think
> this is going to be the last patch I take for 5.13-rc1.  The rest I'll
> store up for the next kernel release after that...
> 
> thanks,
> 
> greg k-h






[Outreachy kernel] [PATCH v4] staging: rtl8723bs: Remove led_blink_hdl() and everything related

2021-04-15 Thread Fabio M. De Francesco
Removed useless led_blink_hdl() prototype and definition.
Removed struct LedBlink_param. Removed LedBlink entries in
rtw_cmd_callback[] and in wlancmds[]. Everything related to LedBlink is
not anymore needed. Index of slots changed in arrays comments to reflect
current positions.

Reported-by: Julia Lawall 
Reported-by: Fabio Aiuto 
Reported-by: Greg Kroah-Hartman 
Suggested-by: Matthew Wilcox 
Suggested-by: Dan Carpenter 
Signed-off-by: Fabio M. De Francesco 
---

Changes from v3: Merged the series into one single patch for avoiding
unnecessary intermediate stages.
Changes from v2: Made a series and added another patch (2/2).
Changes from v1: Corrected a bad solution to this issue that made use of
an unnecessary dummy function.

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 16 +++-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c|  9 -
 drivers/staging/rtl8723bs/include/rtw_cmd.h  | 14 --
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h |  1 -
 4 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 0297fbad7bce..d834a82aaf55 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -78,13 +78,12 @@ static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/
{GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
{GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
-   {GEN_CMD_CODE(_LedBlink), NULL},/*60*/
 
-   {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
-   {GEN_CMD_CODE(_TDLS), NULL},/*62*/
-   {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/
+   {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*60*/
+   {GEN_CMD_CODE(_TDLS), NULL},/*61*/
+   {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*62*/
 
-   {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
+   {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*63*/
 };
 
 static struct cmd_hdl wlancmds[] = {
@@ -150,11 +149,10 @@ static struct cmd_hdl wlancmds[] = {
 
GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), 
set_chplan_hdl) /*59*/
-   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), led_blink_hdl) 
/*60*/
 
-   GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), 
set_csa_hdl) /*61*/
-   GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*62*/
-   GEN_MLME_EXT_HANDLER(0, chk_bmc_sleepq_hdl) /*63*/
+   GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), 
set_csa_hdl) /*60*/
+   GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*61*/
+   GEN_MLME_EXT_HANDLER(0, chk_bmc_sleepq_hdl) /*62*/
GEN_MLME_EXT_HANDLER(sizeof(struct RunInThread_param), 
run_in_thread_hdl) /*63*/
 };
 
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 873d3792ac8e..963ea80083c8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -6189,15 +6189,6 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned 
char *pbuf)
return  H2C_SUCCESS;
 }
 
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf)
-{
-
-   if (!pbuf)
-   return H2C_PARAMETERS_ERROR;
-
-   return  H2C_SUCCESS;
-}
-
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
return  H2C_REJECTED;
diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h 
b/drivers/staging/rtl8723bs/include/rtw_cmd.h
index 517ae3b51386..28d2d2732374 100644
--- a/drivers/staging/rtl8723bs/include/rtw_cmd.h
+++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h
@@ -537,11 +537,6 @@ struct SetChannelPlan_param {
u8 channel_plan;
 };
 
-/*H2C Handler index: 60 */
-struct LedBlink_param {
-   void *pLed;
-};
-
 /*H2C Handler index: 61 */
 struct SetChannelSwitch_param {
u8 new_ch_no;
@@ -709,13 +704,12 @@ enum {
GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
 
GEN_CMD_CODE(_SetChannelPlan), /*59*/
-   GEN_CMD_CODE(_LedBlink), /*60*/
 
-   GEN_CMD_CODE(_SetChannelSwitch), /*61*/
-   GEN_CMD_CODE(_TDLS), /*62*/
-   GEN_CMD_CODE(_ChkBMCSleepq), /*63*/
+   GEN_CMD_CODE(_SetChannelSwitch), /*60*/
+   GEN_CMD_CODE(_TDLS), /*61*/
+   GEN_CMD_CODE(_ChkBMCSleepq), /*62*/
 
-   GEN_CMD_CODE(_RunInThreadCMD), /*64*/
+   GEN_CMD_CODE(_RunInThreadCMD), /*63*/
 
MAX_H2CCMD
 };
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 5e6cf63956b8..472818c5fd83 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -745,7 +745,6 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned 
char *pbuf);
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
 u8

[Outreachy kernel] [PATCH v3 2/2] staging: rtl8723bs: Remove everything related with LedBlink

2021-04-14 Thread Fabio M. De Francesco
Removed struct LedBlink_param. Removed LedBlink entries in
rtw_cmd_callback[] and in wlancmds[]. Everything related to LedBlink is
not anymore needed. Removed extra blank lines in the two mentioned
arrays and changend the numbers set in comments for having them in line
with the shift.

Reported-by: Fabio Aiuto 
Reported-by: Greg Kroah-Hartman 
Suggested-by: Dan Carpenter 
Signed-off-by: Fabio M. De Francesco 
---

Changes from v2: Added this patch as 2/2.
Changes from v1: No changes.

 drivers/staging/rtl8723bs/core/rtw_cmd.c| 27 ++---
 drivers/staging/rtl8723bs/include/rtw_cmd.h | 14 +++
 2 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index f82dbd4f4c3d..a74e6846f2df 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -22,7 +22,6 @@ static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_Write_EEPROM), NULL},
{GEN_CMD_CODE(_Read_EFUSE), NULL},
{GEN_CMD_CODE(_Write_EFUSE), NULL},
-
{GEN_CMD_CODE(_Read_CAM),   NULL},  /*10*/
{GEN_CMD_CODE(_Write_CAM),   NULL},
{GEN_CMD_CODE(_setBCNITV), NULL},
@@ -33,7 +32,6 @@ static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_SetOpMode), NULL},
{GEN_CMD_CODE(_SiteSurvey), _survey_cmd_callback}, /*18*/
{GEN_CMD_CODE(_SetAuth), NULL},
-
{GEN_CMD_CODE(_SetKey), NULL},  /*20*/
{GEN_CMD_CODE(_SetStaKey), _setstaKey_cmdrsp_callback},
{GEN_CMD_CODE(_SetAssocSta), _setassocsta_cmdrsp_callback},
@@ -44,7 +42,6 @@ static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_SetDataRate), NULL},
{GEN_CMD_CODE(_GetDataRate), NULL},
{GEN_CMD_CODE(_SetPhyInfo), NULL},
-
{GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
{GEN_CMD_CODE(_SetPhy), NULL},
{GEN_CMD_CODE(_GetPhy), NULL},
@@ -55,7 +52,6 @@ static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_JoinbssRpt), NULL},
{GEN_CMD_CODE(_SetRaTable), NULL},
{GEN_CMD_CODE(_GetRaTable), NULL},
-
{GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
{GEN_CMD_CODE(_GetDTMReport),   NULL},
{GEN_CMD_CODE(_GetTXRateStatistics), NULL},
@@ -67,24 +63,19 @@ static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_SwitchAntenna), NULL},
{GEN_CMD_CODE(_SetCrystalCap), NULL},
{GEN_CMD_CODE(_SetSingleCarrierTx), NULL},  /*50*/
-
{GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/
{GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
{GEN_CMD_CODE(_SetContinuousTx), NULL},
{GEN_CMD_CODE(_SwitchBandwidth), NULL}, /*54*/
{GEN_CMD_CODE(_TX_Beacon), NULL},/*55*/
-
{GEN_CMD_CODE(_Set_MLME_EVT), NULL},/*56*/
{GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/
{GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
{GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
-   {GEN_CMD_CODE(_LedBlink), NULL},/*60*/
-
-   {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
-   {GEN_CMD_CODE(_TDLS), NULL},/*62*/
-   {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/
-
-   {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
+   {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*60*/
+   {GEN_CMD_CODE(_TDLS), NULL},/*61*/
+   {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*62*/
+   {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*63*/
 };
 
 static struct cmd_hdl wlancmds[] = {
@@ -144,17 +135,13 @@ static struct cmd_hdl wlancmds[] = {
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(sizeof(struct Tx_Beacon_param), tx_beacon_hdl) 
/*55*/
-
GEN_MLME_EXT_HANDLER(0, mlme_evt_hdl) /*56*/
GEN_MLME_EXT_HANDLER(0, rtw_drvextra_cmd_hdl) /*57*/
-
GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), 
set_chplan_hdl) /*59*/
-   GEN_MLME_EXT_HANDLER(0, NULL) /*60*/
-
-   GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), 
set_csa_hdl) /*61*/
-   GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*62*/
-   GEN_MLME_EXT_HANDLER(0, chk_bmc_sleepq_hdl) /*63*/
+   GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), 
set_csa_hdl) /*60*/
+   GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*61*/
+   GEN_MLME_EXT_HANDLER(0, chk_bmc_sleepq_hdl) /*62*/
GEN_MLME_EXT_HANDLER(sizeof(struct RunInThread_param), 
run_in_thread_hdl) /*63*/
 };
 
diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h 
b/drivers/staging/rtl8723bs/include/rtw_cmd.h
index 517ae3b51386..28d2d2732374 100644
--- a/drivers/staging/rtl8723bs/include/rtw_cmd.h
+++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h
@@ -537,11 +537,6 @@ struct SetChannelPlan_param {
u8 channel_plan;
 };
 
-/*H2C Handler index: 60 */
-struct LedBlink_param

[Outreachy patch] [PATCH v3 1/2] staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
Removed useless led_blink_hdl() prototype and definition. In wlancmds[]
the slot #60 is now set to NULL using the macro GEN_MLME_EXT_HANDLER. This
change has not unwanted side effects because the code in rtw_cmd.c checks
if the function pointer is valid before using it.

Reported-by: Julia Lawall 
Suggested-by: Matthew Wilcox 
Suggested-by: Dan Carpenter 
Signed-off-by: Fabio M. De Francesco 
---

Changes from v2: no changes.
Changes from v1: Corrected a bad solution to this issue that made use of
an unnecessary dummy function.

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 0297fbad7bce..f82dbd4f4c3d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -150,7 +150,7 @@ static struct cmd_hdl wlancmds[] = {
 
GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), 
set_chplan_hdl) /*59*/
-   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), led_blink_hdl) 
/*60*/
+   GEN_MLME_EXT_HANDLER(0, NULL) /*60*/
 
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), 
set_csa_hdl) /*61*/
GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*62*/
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 873d3792ac8e..963ea80083c8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -6189,15 +6189,6 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned 
char *pbuf)
return  H2C_SUCCESS;
 }
 
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf)
-{
-
-   if (!pbuf)
-   return H2C_PARAMETERS_ERROR;
-
-   return  H2C_SUCCESS;
-}
-
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
return  H2C_REJECTED;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 5e6cf63956b8..472818c5fd83 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -745,7 +745,6 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned 
char *pbuf);
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
 u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf); /* Kurt: 
Handling DFS channel switch announcement ie. */
 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf);
-- 
2.31.1



[Outreachy kernel] [PATCH v3 0/2] Remove led_blink_hdl and other related symbols

2021-04-14 Thread Fabio M. De Francesco
Removed useless led_blink_hdl() prototype and definition.
Removed struct LedBlink_param. Removed LedBlink entries in
rtw_cmd_callback[] and in wlancmds[]. Everything related to LedBlink is
not anymore needed. Removed extra blank lines in the two mentioned
arrays and changend the numbers set in comments for having them in line
with the shift. 

Fabio M. De Francesco (2):
  staging: rtl8723bs: Remove useless led_blink_hdl()
  staging: rtl8723bs: Remove everything related with LedBlink

 drivers/staging/rtl8723bs/core/rtw_cmd.c  | 27 +--
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c |  9 ---
 drivers/staging/rtl8723bs/include/rtw_cmd.h   | 14 +++---
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  1 -
 4 files changed, 11 insertions(+), 40 deletions(-)

-- 
2.31.1



Re: [Outreachy kernel] [PATCH v2] staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
On Wednesday, April 14, 2021 8:05:59 PM CEST Fabio M. De Francesco wrote:
> On Wednesday, April 14, 2021 7:57:03 PM CEST Greg Kroah-Hartman wrote:
> > On Wed, Apr 14, 2021 at 08:48:09PM +0300, Dan Carpenter wrote:
> > > On Wed, Apr 14, 2021 at 07:00:41PM +0200, Greg Kroah-Hartman wrote:
> > > > On Wed, Apr 14, 2021 at 06:26:14PM +0200, Fabio M. De Francesco
> 
> wrote:
> > > > > Removed useless led_blink_hdl() prototype and definition. In
> > > > > wlancmds[]
> > > > > the slot #60 is now set to NULL using the macro
> > > > > GEN_MLME_EXT_HANDLER. This change has not unwanted side effects
> > > > > because the code in rtw_cmd.c checks if the function pointer is
> > > > > valid before using it.
> > > > > 
> > > > > Reported-by: Julia Lawall 
> > > > > Suggested-by: Dan Carpenter 
> > > > > Signed-off-by: Fabio M. De Francesco 
> > > > > ---
> > > > > 
> > > > > Changes since v1: Corrected a bad solution to this issue that
> > > > > made
> > > > > use of an unnecessary dummy function.
> > > > > 
> > > > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
> > > > >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
> > > > >  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
> > > > >  3 files changed, 1 insertion(+), 11 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > > 0297fbad7bce..f82dbd4f4c3d 100644
> > > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > @@ -150,7 +150,7 @@ static struct cmd_hdl wlancmds[] = {
> > > > > 
> > > > >   GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
> > > > >   GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param),
> > > > >   set_chplan_hdl) /*59*/> > >
> > > > > 
> > > > > - GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param),
> > > > > led_blink_hdl) /*60*/ +   GEN_MLME_EXT_HANDLER(0, NULL) /
*60*/
> > > > 
> > > > Better, but you really do not need to keep this here, right? 
> > > > Remove
> > > > the
> > > > "led blink command" entirely, you didn't do that here.
> > > 
> > > No, this is right.  We have to put a NULL function pointer in the
> > > array
> > > or the indexing will be off.  But Fabio is correct that the struct
> > > type should be removed.
> > 
> > The indexing can be off, just remove the other place where the
> > "command"
> > is in the index and all is good as rebuilding will fix it.  These are
> > not external "values" we have to keep stable.
> > 
> > This has been done for other drivers exactly like this, there are loads
> > of "odd" commands in there that should not be.
> > 
> > thanks,
> > 
> > greg k-h
> 
> I'm not sure if this task is so close related to deserve a v3 or if I
> should make a new v1 patch with a different "Subject".
> 
> Thanks,
> 
> Fabio
I'll make a v3 series, submitting this patch again (as 1/2) and adding the 
above-mentioned changes in another one (as 2/2).

Fabio




Re: [Outreachy kernel] [PATCH v2] staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
On Wednesday, April 14, 2021 7:57:03 PM CEST Greg Kroah-Hartman wrote:
> On Wed, Apr 14, 2021 at 08:48:09PM +0300, Dan Carpenter wrote:
> > On Wed, Apr 14, 2021 at 07:00:41PM +0200, Greg Kroah-Hartman wrote:
> > > On Wed, Apr 14, 2021 at 06:26:14PM +0200, Fabio M. De Francesco 
wrote:
> > > > Removed useless led_blink_hdl() prototype and definition. In
> > > > wlancmds[]
> > > > the slot #60 is now set to NULL using the macro
> > > > GEN_MLME_EXT_HANDLER. This change has not unwanted side effects
> > > > because the code in rtw_cmd.c checks if the function pointer is
> > > > valid before using it.
> > > > 
> > > > Reported-by: Julia Lawall 
> > > > Suggested-by: Dan Carpenter 
> > > > Signed-off-by: Fabio M. De Francesco 
> > > > ---
> > > > 
> > > > Changes since v1: Corrected a bad solution to this issue that made
> > > > use of an unnecessary dummy function.
> > > > 
> > > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
> > > >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
> > > >  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
> > > >  3 files changed, 1 insertion(+), 11 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > 0297fbad7bce..f82dbd4f4c3d 100644
> > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > @@ -150,7 +150,7 @@ static struct cmd_hdl wlancmds[] = {
> > > > 
> > > > GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
> > > > GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param),
> > > > set_chplan_hdl) /*59*/> > > 
> > > > -   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param),
> > > > led_blink_hdl) /*60*/ + GEN_MLME_EXT_HANDLER(0, NULL) /*60*/
> > > 
> > > Better, but you really do not need to keep this here, right?  Remove
> > > the
> > > "led blink command" entirely, you didn't do that here.
> > 
> > No, this is right.  We have to put a NULL function pointer in the array
> > or the indexing will be off.  But Fabio is correct that the struct
> > type should be removed.
> 
> The indexing can be off, just remove the other place where the "command"
> is in the index and all is good as rebuilding will fix it.  These are
> not external "values" we have to keep stable.
> 
> This has been done for other drivers exactly like this, there are loads
> of "odd" commands in there that should not be.
> 
> thanks,
> 
> greg k-h
I'm not sure if this task is so close related to deserve a v3 or if I 
should make a new v1 patch with a different "Subject".

Thanks,

Fabio






[Outreachy kernel] [PATCH v2] staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
Removed useless led_blink_hdl() prototype and definition. In wlancmds[]
the slot #60 is now set to NULL using the macro GEN_MLME_EXT_HANDLER. This
change has not unwanted side effects because the code in rtw_cmd.c checks
if the function pointer is valid before using it.

Reported-by: Julia Lawall 
Suggested-by: Dan Carpenter 
Signed-off-by: Fabio M. De Francesco 
---

Changes since v1: Corrected a bad solution to this issue that made use of
an unnecessary dummy function.

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 0297fbad7bce..f82dbd4f4c3d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -150,7 +150,7 @@ static struct cmd_hdl wlancmds[] = {
 
GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), 
set_chplan_hdl) /*59*/
-   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), led_blink_hdl) 
/*60*/
+   GEN_MLME_EXT_HANDLER(0, NULL) /*60*/
 
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), 
set_csa_hdl) /*61*/
GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*62*/
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 873d3792ac8e..963ea80083c8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -6189,15 +6189,6 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned 
char *pbuf)
return  H2C_SUCCESS;
 }
 
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf)
-{
-
-   if (!pbuf)
-   return H2C_PARAMETERS_ERROR;
-
-   return  H2C_SUCCESS;
-}
-
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
return  H2C_REJECTED;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 5e6cf63956b8..472818c5fd83 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -745,7 +745,6 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned 
char *pbuf);
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
 u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf); /* Kurt: 
Handling DFS channel switch announcement ie. */
 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf);
-- 
2.31.1



Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
On Wednesday, April 14, 2021 3:24:14 PM CEST Dan Carpenter wrote:
> On Wed, Apr 14, 2021 at 01:52:43PM +0200, Fabio M. De Francesco wrote:
> > Removed the led_blink_hdl() function (declaration and definition).
> > Declared dummy_function() in include/rtw_mlme_ext.h and defined it in
> > core/rtw_cmd.c. Changed the second parameter of GEN_MLME_EXT_HANDLER
> > macro to make use of dummy_function().
> > 
> > Reported-by: Julia Lawall 
> > Suggested-by: Dan Carpenter 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +++-
> >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
> >  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 3 ++-
> >  3 files changed, 5 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > 0297fbad7bce..7b6102a2bb2c 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -87,6 +87,8 @@ static struct _cmd_callback rtw_cmd_callback[] = {
> > 
> > {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
> >  
> >  };
> > 
> > +u8 dummy_functioni(struct adapter *var0, u8 *var1) { return 0; }
> > +
> > 
> >  static struct cmd_hdl wlancmds[] = {
> >  
> > GEN_DRV_CMD_HANDLER(0, NULL) /*0*/
> > GEN_DRV_CMD_HANDLER(0, NULL)
> > 
> > @@ -150,7 +152,7 @@ static struct cmd_hdl wlancmds[] = {
> > 
> > GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
> > GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param),
> > set_chplan_hdl) /*59*/> 
> > -   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), 
led_blink_hdl)
> > /*60*/ +GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param),
> > dummy_function) /*60*/
> No, no.  Don't create a dummy function. Do it like so:
> 
>   GEN_DRV_CMD_HANDLER(0, NULL) /* 60 */
> 
> regards,
> dan carpenter
>
I'm replying late because I didn't want to blindly use that solution; I 
mean that I wanted to understand why I can simply put 0 and NULL into that 
macro. I had seen it made in other lines that initialize wlancmds[] 
elements, but I wasn't sure if it could work for the specific slot where 
the pointer to led_blinck_hdl was supposed to be placed.

Now I think that it is why, in this case, cmd_hdl would be set to NULL by 
the call to wlancmds[pcmd->cmdcode].h2cfuns and the cmd_hdl() function 
wouldn't be called because cmd_hdl is tested within an "if" statement.

Therefore a simple GEN_DRV_CMD_HANDLER(0, NULL) at slot number would be the 
simplest and most obvious solution.

Is the above argument sound?

Thanks for your kind help,

Fabio





Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
On Wednesday, April 14, 2021 2:18:13 PM CEST Greg Kroah-Hartman wrote:
> On Wed, Apr 14, 2021 at 01:52:43PM +0200, Fabio M. De Francesco wrote:
> > Removed the led_blink_hdl() function (declaration and definition).
> > Declared dummy_function() in include/rtw_mlme_ext.h and defined it in
> > core/rtw_cmd.c. Changed the second parameter of GEN_MLME_EXT_HANDLER
> > macro to make use of dummy_function().
> 
> No no no.
> 
> If you want to remove is function declaration and use, then do it
> properly.
> 
> The code is crazy, I agree, but it should not be difficult to just
> remove this correctly instead of papering over this mess.
> 
> Also note that no one actually calls this function if you look at the
> logic here.  
>
> It might take some good knowledge of C to unwind this crud,
> but once done, you should be able to "prove" it's not called
>
Proving that no one actually calls it it's beyond my 
current knowledge of programming with C.

Matthew W., who is for sure more experienced than I am , 
wrote that that function pointer in the array is used somewhere else. 

Copied and pasted here from his message:

"Here's where the driver calls that function:
$ git grep wlancmds drivers/staging/rtl8723bs/
drivers/staging/rtl8723bs/core/rtw_cmd.c:static struct cmd_hdl wlancmds[] = {
drivers/staging/rtl8723bs/core/rtw_cmd.c:   if (pcmd->cmdcode < 
ARRAY_SIZE(wlancmds)) {
drivers/staging/rtl8723bs/core/rtw_cmd.c:   cmd_hdl = 
wlancmds[pcmd->cmdcode].h2cfuns;
>
> and how to
> remove it correctly.
>
I think that doing it correctly depends on the "prove" which you requested.
Doesn't it?
> 
> And no, I'm not going to say how to do it, that's an exercise best left
> for the reader.
>
It sounds perfectly reasonable and I agree in full.
>
> But I will hint that this was done in the past, in
> 2014, in another driver in the tree with a codebase much like this one,
> so it shouldn't be hard to find an example of it.  Only took me a few
> minutes...
>
I'm sure it took you only a few minutes. If this can be accomplished by using 
grep 
on git log output I need some time to read this command manual again. I suppose 
that the search should be made by combining "remove", "function", 
"drivers/staging",
and "2014". At the moment I don't know how to do that.

Notwithstanding I have said all that you read above, you can be sure that I 
won't give
up so easily even if it will take days :) 
> 
> good luck!
>
Thanks, 

Fabio
> 
> greg k-h





[Outreachy kernel] [PATCH] staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
Removed the led_blink_hdl() function (declaration and definition).
Declared dummy_function() in include/rtw_mlme_ext.h and defined it in
core/rtw_cmd.c. Changed the second parameter of GEN_MLME_EXT_HANDLER
macro to make use of dummy_function().

Reported-by: Julia Lawall 
Suggested-by: Dan Carpenter 
Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +++-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 3 ++-
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 0297fbad7bce..7b6102a2bb2c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -87,6 +87,8 @@ static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
 };
 
+u8 dummy_functioni(struct adapter *var0, u8 *var1) { return 0; }
+
 static struct cmd_hdl wlancmds[] = {
GEN_DRV_CMD_HANDLER(0, NULL) /*0*/
GEN_DRV_CMD_HANDLER(0, NULL)
@@ -150,7 +152,7 @@ static struct cmd_hdl wlancmds[] = {
 
GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), 
set_chplan_hdl) /*59*/
-   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), led_blink_hdl) 
/*60*/
+   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), dummy_function) 
/*60*/
 
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), 
set_csa_hdl) /*61*/
GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*62*/
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 873d3792ac8e..963ea80083c8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -6189,15 +6189,6 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned 
char *pbuf)
return  H2C_SUCCESS;
 }
 
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf)
-{
-
-   if (!pbuf)
-   return H2C_PARAMETERS_ERROR;
-
-   return  H2C_SUCCESS;
-}
-
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
return  H2C_REJECTED;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 5e6cf63956b8..57977da78eb3 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -745,11 +745,12 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned 
char *pbuf);
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
 u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf); /* Kurt: 
Handling DFS channel switch announcement ie. */
 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf);
 
+/* Dummy function used to fill elements of an array of function pointers */
+u8 dummy_function(struct adapter *, u8 *);
 
 #define GEN_DRV_CMD_HANDLER(size, cmd) {size,  ## _hdl},
 #define GEN_MLME_EXT_HANDLER(size, cmd){size, cmd},
-- 
2.31.1



Re: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
On Wednesday, April 14, 2021 9:00:25 AM CEST Dan Carpenter wrote:
> On Wed, Apr 14, 2021 at 08:33:48AM +0200, Fabio M. De Francesco wrote:
> > On Wednesday, April 14, 2021 7:21:50 AM CEST Dan Carpenter wrote:
> > > On Tue, Apr 13, 2021 at 10:08:32PM +0200, Fabio M. De Francesco 
wrote:
> > > > On Tuesday, April 13, 2021 9:48:44 PM CEST Matthew Wilcox wrote:
> > > > > On Tue, Apr 13, 2021 at 09:45:03PM +0200, Fabio M. De Francesco
> > 
> > wrote:
> > > > > > 1) The driver doesn't call that function from anywhere else
> > > > > > than
> > > > > > the
> > > > > > macro. 2) You have explained that the macro add its symbol to a
> > > > > > slot
> > > > > > in an array that would shift all the subsequent elements down
> > > > > > if
> > > > > > that
> > > > > > macro is not used exactly in the line where it is.
> > > > > > 3) Dan Carpenter said that that array is full of null functions
> > > > > > (or
> > > > > > empty slots?).
> > > > > > 
> > > > > > Unless that function is called anonymously dereferencing its
> > > > > > address
> > > > > > from the position it occupies in the array, I'm not able to see
> > > > > > what
> > > > > > else means can any caller use.
> > > > > > 
> > > > > > I know I have much less experience than you with C: what can go
> > > > > > wrong?
> > > > > 
> > > > > Here's where the driver calls that function:
> > > > > 
> > > > > $ git grep wlancmds drivers/staging/rtl8723bs/
> > > > > drivers/staging/rtl8723bs/core/rtw_cmd.c:static struct cmd_hdl
> > > > > 
> > > > > wlancmds[] = { drivers/staging/rtl8723bs/core/rtw_cmd.c:
> > > > >   if
> > > > > 
> > > > > (pcmd->cmdcode < ARRAY_SIZE(wlancmds)) {
> > > > > drivers/staging/rtl8723bs/core/rtw_cmd.c:
> > > > > cmd_hdl
> > > > > = wlancmds[pcmd->cmdcode].h2cfuns;
> > > > 
> > > > OK, I had imagined an anonymous call from its location in the array
> > > > (as
> > > > I wrote in the last phrase of my message). However, I thought that
> > > > it
> > > > could have been an improbable possibility, not a real one.
> > > > 
> > > > Linux uses a lot of interesting ideas that newcomers like me should
> > > > learn. Things here are trickier than they appear at first sight.
> > > 
> > > One trick would be to build the Smatch cross function database.
> > > 
> > > https://www.spinics.net/lists/smatch/msg00568.html
> > > 
> > > Then you could do:
> > > 
> > > $ ~/path/to/smatch_data/db/smdb.py led_blink_hdl
> > > file | caller | function | type | parameter | key | value |
> > > drivers/staging/rtl8723bs/core/rtw_cmd.c |   rtw_cmd_thread |
> > > rtw_cmd_thread ptr cmd_hdl |   INTERNAL | -1 |   
> > >  |
> > > uchar(*)(struct adapter*, uchar*)
> > > drivers/staging/rtl8188eu/core/rtw_cmd.c |   rtw_cmd_thread |
> > > rtw_cmd_thread ptr cmd_hdl |   INTERNAL | -1 |   
> > >  |
> > > uchar(*)(struct adapter*, uchar*)
> > > drivers/staging/rtl8188eu/core/rtw_cmd.c |   rtw_cmd_thread |
> > > rtw_cmd_thread ptr cmd_hdl |   BUF_SIZE |  1 |   
> > > pbuf |
> > > 1,4,6,8,12,14,16,19-20,23-24,48,740,884,892,900,960
> > > 
> > > 
> > > Which says that led_blink_hdl() is called as a function pointer
> > > called
> > > "cmd_hdl" from rtw_cmd_thread().
> > > 
> > > Hm...  It says it can be called from either rtw_cmd_thread() function
> > > (the rtl8723bs or rtl8188eu version) which is not ideal.  But also
> > > basically harmless so whatever...
> > > 
> > > regards,
> > > dan carpenter
> > 
> > Nice tool, thanks. I'll surely use it when it is needed to find out
> > which callers use a function pointer.
> > 
> > However I cannot see how it can help in this context. That function
> > *does* something, even if I cannot understand why someone needs a
> > function to test the initialization of a pointer. Furthermore it is
> > actually called by rtw_cmd_thread() (as you found out by using smatch)
> > that expect one 

Re: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-14 Thread Fabio M. De Francesco
On Wednesday, April 14, 2021 7:21:50 AM CEST Dan Carpenter wrote:
> On Tue, Apr 13, 2021 at 10:08:32PM +0200, Fabio M. De Francesco wrote:
> > On Tuesday, April 13, 2021 9:48:44 PM CEST Matthew Wilcox wrote:
> > > On Tue, Apr 13, 2021 at 09:45:03PM +0200, Fabio M. De Francesco 
wrote:
> > > > 1) The driver doesn't call that function from anywhere else than
> > > > the
> > > > macro. 2) You have explained that the macro add its symbol to a
> > > > slot
> > > > in an array that would shift all the subsequent elements down if
> > > > that
> > > > macro is not used exactly in the line where it is.
> > > > 3) Dan Carpenter said that that array is full of null functions (or
> > > > empty slots?).
> > > > 
> > > > Unless that function is called anonymously dereferencing its
> > > > address
> > > > from the position it occupies in the array, I'm not able to see
> > > > what
> > > > else means can any caller use.
> > > > 
> > > > I know I have much less experience than you with C: what can go
> > > > wrong?
> > > 
> > > Here's where the driver calls that function:
> > > 
> > > $ git grep wlancmds drivers/staging/rtl8723bs/
> > > drivers/staging/rtl8723bs/core/rtw_cmd.c:static struct cmd_hdl
> > > wlancmds[] = { drivers/staging/rtl8723bs/core/rtw_cmd.c:
> > >   if
> > > (pcmd->cmdcode < ARRAY_SIZE(wlancmds)) {
> > > drivers/staging/rtl8723bs/core/rtw_cmd.c:  
> > > cmd_hdl
> > > = wlancmds[pcmd->cmdcode].h2cfuns;
> > 
> > OK, I had imagined an anonymous call from its location in the array (as
> > I wrote in the last phrase of my message). However, I thought that it
> > could have been an improbable possibility, not a real one.
> > 
> > Linux uses a lot of interesting ideas that newcomers like me should
> > learn. Things here are trickier than they appear at first sight.
> 
> One trick would be to build the Smatch cross function database.
> 
> https://www.spinics.net/lists/smatch/msg00568.html
> 
> Then you could do:
> 
> $ ~/path/to/smatch_data/db/smdb.py led_blink_hdl
> file | caller | function | type | parameter | key | value |
> drivers/staging/rtl8723bs/core/rtw_cmd.c |   rtw_cmd_thread |
> rtw_cmd_thread ptr cmd_hdl |   INTERNAL | -1 | |
> uchar(*)(struct adapter*, uchar*)
> drivers/staging/rtl8188eu/core/rtw_cmd.c |   rtw_cmd_thread |
> rtw_cmd_thread ptr cmd_hdl |   INTERNAL | -1 | |
> uchar(*)(struct adapter*, uchar*)
> drivers/staging/rtl8188eu/core/rtw_cmd.c |   rtw_cmd_thread |
> rtw_cmd_thread ptr cmd_hdl |   BUF_SIZE |  1 |pbuf |
> 1,4,6,8,12,14,16,19-20,23-24,48,740,884,892,900,960
> 
> 
> Which says that led_blink_hdl() is called as a function pointer called
> "cmd_hdl" from rtw_cmd_thread().
> 
> Hm...  It says it can be called from either rtw_cmd_thread() function
> (the rtl8723bs or rtl8188eu version) which is not ideal.  But also
> basically harmless so whatever...
> 
> regards,
> dan carpenter
>
Nice tool, thanks. I'll surely use it when it is needed to find out which  
callers use a function pointer.

However I cannot see how it can help in this context. That function *does* 
something, even if I cannot understand why someone needs a function to test 
the initialization of a pointer. Furthermore it is actually called by 
rtw_cmd_thread() (as you found out by using smatch) that expect one of the 
two possible values that led_blink_hdl() returns.

That said, what trick could I use for the purpose of getting rid of that 
function? At this point I'm not sure it could be made.

Regards,

Fabio
 








[Outreachy kernel] [PATCH v2] staging: rtl8723bs: hal: Remove four set but not used variables

2021-04-14 Thread Fabio M. De Francesco
Removed four variables that were set but not used.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: deleted one blank line.

 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c 
b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 77f8353c5ce5..63f7f673aefb 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -3199,13 +3199,10 @@ static void hw_var_set_mlme_join(struct adapter 
*padapter, u8 variable, u8 *val)
 
 void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len)
 {
-   u8 seq_no;
 
 #defineGET_8723B_C2H_TX_RPT_LIFE_TIME_OVER(_Header)
LE_BITS_TO_1BYTE((_Header + 0), 6, 1)
 #defineGET_8723B_C2H_TX_RPT_RETRY_OVER(_Header)
LE_BITS_TO_1BYTE((_Header + 0), 7, 1)
 
-   seq_no = *(pdata+6);
-
if (GET_8723B_C2H_TX_RPT_RETRY_OVER(pdata) | 
GET_8723B_C2H_TX_RPT_LIFE_TIME_OVER(pdata)) {
rtw_ack_tx_done(>xmitpriv, 
RTW_SCTX_DONE_CCX_PKT_FAIL);
}
@@ -3357,17 +3354,15 @@ void SetHwReg8723B(struct adapter *padapter, u8 
variable, u8 *val)
case HW_VAR_BASIC_RATE:
{
struct mlme_ext_info *mlmext_info = 
>mlmeextpriv.mlmext_info;
-   u16 input_b = 0, masked = 0, ioted = 0, BrateCfg = 0;
+   u16 BrateCfg = 0;
u16 rrsr_2g_force_mask = (RRSR_11M|RRSR_5_5M|RRSR_1M);
u16 rrsr_2g_allow_mask = 
(RRSR_24M|RRSR_12M|RRSR_6M|RRSR_CCK_RATES);
 
HalSetBrateCfg(padapter, val, );
-   input_b = BrateCfg;
 
/* apply force and allow mask */
BrateCfg |= rrsr_2g_force_mask;
BrateCfg &= rrsr_2g_allow_mask;
-   masked = BrateCfg;
 
/* IOT consideration */
if (mlmext_info->assoc_AP_vendor == HT_IOT_PEER_CISCO) {
@@ -3375,7 +3370,6 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, 
u8 *val)
if ((BrateCfg & (RRSR_24M|RRSR_12M|RRSR_6M)) == 0)
BrateCfg |= RRSR_6M;
}
-   ioted = BrateCfg;
 
pHalData->BasicRateSet = BrateCfg;
 
-- 
2.31.1



Re: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 9:48:44 PM CEST Matthew Wilcox wrote:
> On Tue, Apr 13, 2021 at 09:45:03PM +0200, Fabio M. De Francesco wrote:
> > 1) The driver doesn't call that function from anywhere else than the
> > macro. 2) You have explained that the macro add its symbol to a slot
> > in an array that would shift all the subsequent elements down if that
> > macro is not used exactly in the line where it is.
> > 3) Dan Carpenter said that that array is full of null functions (or
> > empty slots?).
> > 
> > Unless that function is called anonymously dereferencing its address
> > from the position it occupies in the array, I'm not able to see what
> > else means can any caller use.
> > 
> > I know I have much less experience than you with C: what can go wrong?
> 
> Here's where the driver calls that function:
> 
> $ git grep wlancmds drivers/staging/rtl8723bs/
> drivers/staging/rtl8723bs/core/rtw_cmd.c:static struct cmd_hdl wlancmds[]
> = { drivers/staging/rtl8723bs/core/rtw_cmd.c:   if
> (pcmd->cmdcode < ARRAY_SIZE(wlancmds)) {
> drivers/staging/rtl8723bs/core/rtw_cmd.c:   cmd_hdl
> = wlancmds[pcmd->cmdcode].h2cfuns;
>
OK, I had imagined an anonymous call from its location in the array (as I 
wrote in the last phrase of my message). However, I thought that it could 
have been an improbable possibility, not a real one.

Linux uses a lot of interesting ideas that newcomers like me should learn. 
Things here are trickier than they appear at first sight.

Thanks,

Fabio





Re: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 9:25:05 PM CEST Julia Lawall wrote:
> On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > On Tuesday, April 13, 2021 8:57:20 PM CEST Julia Lawall wrote:
> > > On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > > > On Tuesday, April 13, 2021 8:20:50 PM CEST Dan Carpenter wrote:
> > > > > On Tue, Apr 13, 2021 at 06:47:06PM +0200, Fabio M. De Francesco
> > 
> > wrote:
> > > > > > On Tuesday, April 13, 2021 6:27:17 PM CEST Julia Lawall wrote:
> > > > > > > On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > > > > > > > On Tuesday, April 13, 2021 6:04:16 PM CEST Julia Lawall 
wrote:
> > > > > > > > > On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > > > > > > > > > Removed the led_blink_hdl() function (declaration,
> > > > > > > > > > definition,
> > > > > > > > > > and
> > > > > > > > > > caller code) because it's useless. It only seems to
> > > > > > > > > > check
> > > > > > > > > > whether
> > > > > > > > > > or
> > > > > > > > > > not a given pointer is NULL. There are other (simpler)
> > > > > > > > > > means
> > > > > > > > > > for
> > > > > > > > > > that
> > > > > > > > > > purpose.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Fabio M. De Francesco
> > > > > > > > > > 
> > > > > > > > > > ---
> > > > > > > > > > 
> > > > > > > > > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 1 -
> > > > > > > > > >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9
> > > > > > > > > >  -
> > > > > > > > > >  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
> > > > > > > > > >  3 files changed, 11 deletions(-)
> > > > > > > > > > 
> > > > > > > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > > > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > > > > > > > 0297fbad7bce..4c44dfd21514 100644
> > > > > > > > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > > > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > > > > > @@ -150,7 +150,6 @@ static struct cmd_hdl wlancmds[] =
> > > > > > > > > > {
> > > > > > > > > > 
> > > > > > > > > > GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
> > > > > > > > > > GEN_MLME_EXT_HANDLER(sizeof(struct
> > 
> > SetChannelPlan_param),
> > 
> > > > > > > > > > set_chplan_hdl) /*59*/>
> > > > > > > > > > 
> > > > > > > > > > -   GEN_MLME_EXT_HANDLER(sizeof(struct
> > 
> > LedBlink_param),
> > 
> > > > > > > > led_blink_hdl)
> > > > > > > > 
> > > > > > > > > > /*60*/
> > > > > > > > > 
> > > > > > > > > This is worrisome.  Doyou fully understand the impact of
> > > > > > > > > this?
> > > > > > > > > If
> > > > > > > > > not,
> > > > > > > > > the change is probably not a good idea.
> > > > > > > > 
> > > > > > > > This is that macro definition:
> > > > > > > > 
> > > > > > > > #define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
> > > > > > > > 
> > > > > > > > struct C2HEvent_Header {
> > > > > > > > 
> > > > > > > > #ifdef __LITTLE_ENDIAN
> > > > > > > > 
> > > > > > > > unsigned int len:16;
> > > > > > > > unsigned int ID:8;
> > > > > > > > unsigned int seq:8;
> > > > > > > > 
> > > > > > > > #else
> > > &

Re: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 8:57:20 PM CEST Julia Lawall wrote:
> On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > On Tuesday, April 13, 2021 8:20:50 PM CEST Dan Carpenter wrote:
> > > On Tue, Apr 13, 2021 at 06:47:06PM +0200, Fabio M. De Francesco 
wrote:
> > > > On Tuesday, April 13, 2021 6:27:17 PM CEST Julia Lawall wrote:
> > > > > On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > > > > > On Tuesday, April 13, 2021 6:04:16 PM CEST Julia Lawall wrote:
> > > > > > > On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > > > > > > > Removed the led_blink_hdl() function (declaration,
> > > > > > > > definition,
> > > > > > > > and
> > > > > > > > caller code) because it's useless. It only seems to check
> > > > > > > > whether
> > > > > > > > or
> > > > > > > > not a given pointer is NULL. There are other (simpler)
> > > > > > > > means
> > > > > > > > for
> > > > > > > > that
> > > > > > > > purpose.
> > > > > > > > 
> > > > > > > > Signed-off-by: Fabio M. De Francesco
> > > > > > > > 
> > > > > > > > ---
> > > > > > > > 
> > > > > > > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 1 -
> > > > > > > >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9
> > > > > > > >  -
> > > > > > > >  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
> > > > > > > >  3 files changed, 11 deletions(-)
> > > > > > > > 
> > > > > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > > > > > 0297fbad7bce..4c44dfd21514 100644
> > > > > > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > > > @@ -150,7 +150,6 @@ static struct cmd_hdl wlancmds[] = {
> > > > > > > > 
> > > > > > > > GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
> > > > > > > > GEN_MLME_EXT_HANDLER(sizeof(struct 
SetChannelPlan_param),
> > > > > > > > set_chplan_hdl) /*59*/>
> > > > > > > > 
> > > > > > > > -   GEN_MLME_EXT_HANDLER(sizeof(struct 
LedBlink_param),
> > > > > > 
> > > > > > led_blink_hdl)
> > > > > > 
> > > > > > > > /*60*/
> > > > > > > 
> > > > > > > This is worrisome.  Doyou fully understand the impact of
> > > > > > > this?
> > > > > > > If
> > > > > > > not,
> > > > > > > the change is probably not a good idea.
> > > > > > 
> > > > > > This is that macro definition:
> > > > > > 
> > > > > > #define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
> > > > > > 
> > > > > > struct C2HEvent_Header {
> > > > > > 
> > > > > > #ifdef __LITTLE_ENDIAN
> > > > > > 
> > > > > > unsigned int len:16;
> > > > > > unsigned int ID:8;
> > > > > > unsigned int seq:8;
> > > > > > 
> > > > > > #else
> > > > > > 
> > > > > > unsigned int seq:8;
> > > > > > unsigned int ID:8;
> > > > > > unsigned int len:16;
> > > > > > 
> > > > > > #endif
> > > > > > 
> > > > > > unsigned int rsvd;
> > > > > > 
> > > > > > };
> > > > > > 
> > > > > > It's a bit convoluted with regard to my experience. Probably I
> > > > > > don't
> > > > > > understand it fully, but it seems to me to not having effects
> > > > > > to
> > > > > > the
> > > > > > code where I removed its use within core/rtw_cmd.c.
> > > > > > 
> > > > > > What am I missing?
> > > > > 
> > > > > It seems that the function is being put into an array.  Probably
> > > > > someone
> > > > > expects to find it there.  Probably you have shifted all of the
> > > > > functions that come afterwards back one slot so that they are all
> > > > > in
> > > > > the wrong places.
> > > > > 
> > > > > julia
> > > > 
> > > > Thanks for your explanation. Obviously this implies that the
> > > > function
> > > > cannot be removed, unless one fill the slot that is deleted by to
> > > > not
> > > > calling this macro at the right moment.
> > > > 
> > > > I also suppose that providing a function pointer with a NULL value
> > > > wouldn't work either.
> > > 
> > > It would work.  That array is full of NULL function pointers.
> > 
> > Interesting, thanks.
> > 
> > I'm going to remove that function and replace its name in the macro
> > with a NULL function pointer.
> > 
> > I couldn't believe it would work when I wrote about that.
> 
> Have you checked that a value of NULL in that place is going to have the
> same effect as the function?
>
No, I have not, but perhaps is not relevant.

I want to give to the macro the name of an empty function that I define in 
the same header where there the prototype of led_blink_hdl() is defined 
now: something like "u8 empty_function { return 0; }"

Can it work
What do you think about it?

Fabio
> 
> julia






[Outreachy kernel] [PATCH] staging: rtl8723bs: hal: Remove four set but not used variables

2021-04-13 Thread Fabio M. De Francesco
Removed four variables that were set but not used.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c 
b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 77f8353c5ce5..fad6a3bfe07c 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -3199,12 +3199,10 @@ static void hw_var_set_mlme_join(struct adapter 
*padapter, u8 variable, u8 *val)
 
 void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len)
 {
-   u8 seq_no;
 
 #defineGET_8723B_C2H_TX_RPT_LIFE_TIME_OVER(_Header)
LE_BITS_TO_1BYTE((_Header + 0), 6, 1)
 #defineGET_8723B_C2H_TX_RPT_RETRY_OVER(_Header)
LE_BITS_TO_1BYTE((_Header + 0), 7, 1)
 
-   seq_no = *(pdata+6);
 
if (GET_8723B_C2H_TX_RPT_RETRY_OVER(pdata) | 
GET_8723B_C2H_TX_RPT_LIFE_TIME_OVER(pdata)) {
rtw_ack_tx_done(>xmitpriv, 
RTW_SCTX_DONE_CCX_PKT_FAIL);
@@ -3357,17 +3355,15 @@ void SetHwReg8723B(struct adapter *padapter, u8 
variable, u8 *val)
case HW_VAR_BASIC_RATE:
{
struct mlme_ext_info *mlmext_info = 
>mlmeextpriv.mlmext_info;
-   u16 input_b = 0, masked = 0, ioted = 0, BrateCfg = 0;
+   u16 BrateCfg = 0;
u16 rrsr_2g_force_mask = (RRSR_11M|RRSR_5_5M|RRSR_1M);
u16 rrsr_2g_allow_mask = 
(RRSR_24M|RRSR_12M|RRSR_6M|RRSR_CCK_RATES);
 
HalSetBrateCfg(padapter, val, );
-   input_b = BrateCfg;
 
/* apply force and allow mask */
BrateCfg |= rrsr_2g_force_mask;
BrateCfg &= rrsr_2g_allow_mask;
-   masked = BrateCfg;
 
/* IOT consideration */
if (mlmext_info->assoc_AP_vendor == HT_IOT_PEER_CISCO) {
@@ -3375,7 +3371,6 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, 
u8 *val)
if ((BrateCfg & (RRSR_24M|RRSR_12M|RRSR_6M)) == 0)
BrateCfg |= RRSR_6M;
}
-   ioted = BrateCfg;
 
pHalData->BasicRateSet = BrateCfg;
 
-- 
2.31.1



Re: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 8:20:50 PM CEST Dan Carpenter wrote:
> On Tue, Apr 13, 2021 at 06:47:06PM +0200, Fabio M. De Francesco wrote:
> > On Tuesday, April 13, 2021 6:27:17 PM CEST Julia Lawall wrote:
> > > On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > > > On Tuesday, April 13, 2021 6:04:16 PM CEST Julia Lawall wrote:
> > > > > On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > > > > > Removed the led_blink_hdl() function (declaration, definition,
> > > > > > and
> > > > > > caller code) because it's useless. It only seems to check
> > > > > > whether
> > > > > > or
> > > > > > not a given pointer is NULL. There are other (simpler) means
> > > > > > for
> > > > > > that
> > > > > > purpose.
> > > > > > 
> > > > > > Signed-off-by: Fabio M. De Francesco 
> > > > > > ---
> > > > > > 
> > > > > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 1 -
> > > > > >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
> > > > > >  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
> > > > > >  3 files changed, 11 deletions(-)
> > > > > > 
> > > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > > > 0297fbad7bce..4c44dfd21514 100644
> > > > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > @@ -150,7 +150,6 @@ static struct cmd_hdl wlancmds[] = {
> > > > > > 
> > > > > > GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
> > > > > > GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param),
> > > > > > set_chplan_hdl) /*59*/>
> > > > > > 
> > > > > > -   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param),
> > > > 
> > > > led_blink_hdl)
> > > > 
> > > > > > /*60*/
> > > > > 
> > > > > This is worrisome.  Doyou fully understand the impact of this? 
> > > > > If
> > > > > not,
> > > > > the change is probably not a good idea.
> > > > 
> > > > This is that macro definition:
> > > > 
> > > > #define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
> > > > 
> > > > struct C2HEvent_Header {
> > > > 
> > > > #ifdef __LITTLE_ENDIAN
> > > > 
> > > > unsigned int len:16;
> > > > unsigned int ID:8;
> > > > unsigned int seq:8;
> > > > 
> > > > #else
> > > > 
> > > > unsigned int seq:8;
> > > > unsigned int ID:8;
> > > > unsigned int len:16;
> > > > 
> > > > #endif
> > > > 
> > > > unsigned int rsvd;
> > > > 
> > > > };
> > > > 
> > > > It's a bit convoluted with regard to my experience. Probably I
> > > > don't
> > > > understand it fully, but it seems to me to not having effects to
> > > > the
> > > > code where I removed its use within core/rtw_cmd.c.
> > > > 
> > > > What am I missing?
> > > 
> > > It seems that the function is being put into an array.  Probably
> > > someone
> > > expects to find it there.  Probably you have shifted all of the
> > > functions that come afterwards back one slot so that they are all in
> > > the wrong places.
> > > 
> > > julia
> > 
> > Thanks for your explanation. Obviously this implies that the function
> > cannot be removed, unless one fill the slot that is deleted by to not
> > calling this macro at the right moment.
> > 
> > I also suppose that providing a function pointer with a NULL value
> > wouldn't work either.
> 
> It would work.  That array is full of NULL function pointers.
> 
Interesting, thanks.

I'm going to remove that function and replace its name in the macro with a 
NULL function pointer.

I couldn't believe it would work when I wrote about that.

Thanks a lot,

Fabio
>
> regards,
> dan carpenter





Re: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 6:27:17 PM CEST Julia Lawall wrote:
> On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > On Tuesday, April 13, 2021 6:04:16 PM CEST Julia Lawall wrote:
> > > On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > > > Removed the led_blink_hdl() function (declaration, definition, and
> > > > caller code) because it's useless. It only seems to check whether
> > > > or
> > > > not a given pointer is NULL. There are other (simpler) means for
> > > > that
> > > > purpose.
> > > > 
> > > > Signed-off-by: Fabio M. De Francesco 
> > > > ---
> > > > 
> > > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 1 -
> > > >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
> > > >  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
> > > >  3 files changed, 11 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > 0297fbad7bce..4c44dfd21514 100644
> > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > @@ -150,7 +150,6 @@ static struct cmd_hdl wlancmds[] = {
> > > > 
> > > > GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
> > > > GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param),
> > > > set_chplan_hdl) /*59*/>
> > > > 
> > > > -   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param),
> > 
> > led_blink_hdl)
> > 
> > > > /*60*/
> > > 
> > > This is worrisome.  Doyou fully understand the impact of this?  If
> > > not,
> > > the change is probably not a good idea.
> > 
> > This is that macro definition:
> > 
> > #define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
> > 
> > struct C2HEvent_Header {
> > 
> > #ifdef __LITTLE_ENDIAN
> > 
> > unsigned int len:16;
> > unsigned int ID:8;
> > unsigned int seq:8;
> > 
> > #else
> > 
> > unsigned int seq:8;
> > unsigned int ID:8;
> > unsigned int len:16;
> > 
> > #endif
> > 
> > unsigned int rsvd;
> > 
> > };
> > 
> > It's a bit convoluted with regard to my experience. Probably I don't
> > understand it fully, but it seems to me to not having effects to the
> > code where I removed its use within core/rtw_cmd.c.
> > 
> > What am I missing?
> 
> It seems that the function is being put into an array.  Probably someone
> expects to find it there.  Probably you have shifted all of the functions
> that come afterwards back one slot so that they are all in the wrong
> places.
> 
> julia
>
Thanks for your explanation. Obviously this implies that the function 
cannot be removed, unless one fill the slot that is deleted by to not 
calling this macro at the right moment. 

I also suppose that providing a function pointer with a NULL value wouldn't 
work either.

OK, h2c_msg_hdl() cannot be deleted.

Thanks,

Fabio
  






Re: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 6:04:16 PM CEST Julia Lawall wrote:
> On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > Removed the led_blink_hdl() function (declaration, definition, and
> > caller code) because it's useless. It only seems to check whether or
> > not a given pointer is NULL. There are other (simpler) means for that
> > purpose.
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 1 -
> >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
> >  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
> >  3 files changed, 11 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > 0297fbad7bce..4c44dfd21514 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -150,7 +150,6 @@ static struct cmd_hdl wlancmds[] = {
> > 
> > GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
> > GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param),
> > set_chplan_hdl) /*59*/> 
> > -   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), 
led_blink_hdl)
> > /*60*/
> This is worrisome.  Doyou fully understand the impact of this?  If not,
> the change is probably not a good idea.
>
This is that macro definition:

#define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},

struct C2HEvent_Header {

#ifdef __LITTLE_ENDIAN

unsigned int len:16;
unsigned int ID:8;
unsigned int seq:8;
#else
unsigned int seq:8;
unsigned int ID:8;
unsigned int len:16;
#endif
unsigned int rsvd;
};

It's a bit convoluted with regard to my experience. Probably I don't 
understand it fully, but it seems to me to not having effects to the code 
where I removed its use within core/rtw_cmd.c.

What am I missing?

Thanks for your kind help,

Fabio
> 
> julia
> 
> > GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param),
> > set_csa_hdl) /*61*/ GEN_MLME_EXT_HANDLER(sizeof(struct
> > TDLSoption_param), tdls_hdl) /*62*/> 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index
> > 440e22922106..6f2a0584f977 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > @@ -6189,15 +6189,6 @@ u8 set_chplan_hdl(struct adapter *padapter,
> > unsigned char *pbuf)> 
> > return  H2C_SUCCESS;
> >  
> >  }
> > 
> > -u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf)
> > -{
> > -
> > -   if (!pbuf)
> > -   return H2C_PARAMETERS_ERROR;
> > -
> > -   return  H2C_SUCCESS;
> > -}
> > -
> > 
> >  u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
> >  {
> >  
> > return  H2C_REJECTED;
> > 
> > diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> > b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h index
> > 5e6cf63956b8..472818c5fd83 100644
> > --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> > +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> > @@ -745,7 +745,6 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter,
> > unsigned char *pbuf);> 
> >  u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
> >  u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
> >  u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
> > 
> > -u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf);
> > 
> >  u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf); 
/*
> >  Kurt: Handling DFS channel switch announcement ie. */ u8
> >  tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
> >  u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf);
> > 
> > --
> > 2.31.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 view this discussion
> > on the web visit
> > https://groups.google.com/d/msgid/outreachy-kernel/20210413155908.8691
> > -1-fmdefrancesco%40gmail.com.






[Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-13 Thread Fabio M. De Francesco
Removed the led_blink_hdl() function (declaration, definition, and
caller code) because it's useless. It only seems to check whether or not a
given pointer is NULL. There are other (simpler) means for that purpose.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 1 -
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 -
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
 3 files changed, 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 0297fbad7bce..4c44dfd21514 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -150,7 +150,6 @@ static struct cmd_hdl wlancmds[] = {
 
GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), 
set_chplan_hdl) /*59*/
-   GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), led_blink_hdl) 
/*60*/
 
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), 
set_csa_hdl) /*61*/
GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*62*/
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 440e22922106..6f2a0584f977 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -6189,15 +6189,6 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned 
char *pbuf)
return  H2C_SUCCESS;
 }
 
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf)
-{
-
-   if (!pbuf)
-   return H2C_PARAMETERS_ERROR;
-
-   return  H2C_SUCCESS;
-}
-
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
return  H2C_REJECTED;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 5e6cf63956b8..472818c5fd83 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -745,7 +745,6 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned 
char *pbuf);
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
 u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
-u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf); /* Kurt: 
Handling DFS channel switch announcement ie. */
 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf);
-- 
2.31.1



Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: core: Remove unused but set variable

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 5:16:17 PM CEST Julia Lawall wrote:
> On Tue, 13 Apr 2021, Fabio M. De Francesco wrote:
> > Removed "ledBlink_param" because it was set to the value of "pbuf" but
> > was never reused. This set was made by direct assignment (no helper
> > had been called), therefore it had no side effect to the location
> > pointed by "pbuf".
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index
> > f19a15a3924b..440e22922106 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > @@ -6191,12 +6191,10 @@ u8 set_chplan_hdl(struct adapter *padapter,
> > unsigned char *pbuf)> 
> >  u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf)
> >  {
> > 
> > -   struct LedBlink_param *ledBlink_param;
> > 
> > if (!pbuf)
> > 
> > return H2C_PARAMETERS_ERROR;
> > 
> > -   ledBlink_param = (struct LedBlink_param *)pbuf;
> > 
> > return  H2C_SUCCESS;
> >  
> >  }
> 
> Is this function actually useful?
> 
> julia
>
Actually, it is completely useless.
We should ask the original authors for explanations :)

I'm about to grep the whole driver for the purpose to check if there are 
callers elsewhere and then delete any call and the function itself.

Thanks,

Fabio





[Outreachy kernel] [PATCH] staging: rtl8723bs: core: Remove unused but set variable

2021-04-13 Thread Fabio M. De Francesco
Removed "ledBlink_param" because it was set to the value of "pbuf" but was
never reused. This set was made by direct assignment (no helper had been
called), therefore it had no side effect to the location pointed by "pbuf".

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index f19a15a3924b..440e22922106 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -6191,12 +6191,10 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned 
char *pbuf)
 
 u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
-   struct LedBlink_param *ledBlink_param;
 
if (!pbuf)
return H2C_PARAMETERS_ERROR;
 
-   ledBlink_param = (struct LedBlink_param *)pbuf;
return  H2C_SUCCESS;
 }
 
-- 
2.31.1



Re: [Outreachy kernel] [PATCH] staging: rtl8192u: ieee80211: Replaced strncpy() with strscpy()

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 3:16:17 PM CEST Greg Kroah-Hartman wrote:
> On Tue, Apr 13, 2021 at 03:12:02PM +0200, Fabio M. De Francesco wrote:
> > On Tuesday, April 13, 2021 2:59:29 PM CEST Greg Kroah-Hartman wrote:
> > > On Tue, Apr 13, 2021 at 02:30:41PM +0200, Fabio M. De Francesco 
wrote:
> > > > Replaced strncpy() with strscpy() because of compilation time
> > > > warnings
> > > > about possible truncation of output [-Wstringop-truncation].
> > > 
> > > build warnings?  What build warnings?
> > 
> > drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:1388:5: warning:
> > ‘strncpy’ output may be truncated copying 32 bytes from a string of
> > length 32 [-Wstringop-truncation]
> > 
> >  1388 | strncpy(tmp_ssid, ieee->current_network.ssid,
> > 
> > IW_ESSID_MAX_SIZE);
> 
> That's implying that there is a real bug here, not that just replacing
> it with a different call is going to solve this, right?
> 
> And how do you see that, I can't see that in my builds.
>
I see that with flag W=1 like in 
make -j8 drivers/staging/rtl8192u/ W=1

However I also think it's not a real issue in this context.
Just that strscpy() is preferred and get rid of warnings.
You only can judge if a patch is worth.
I just thought that gcc is (mostly) right in pointing out warnings like 
that.

Thanks,

Fabio
> 
> > > > Furthermore, according to the Linux official documentation,
> > > > strscpy()
> > > > is
> > > > preferred to strncpy.
> > > > 
> > > > Signed-off-by: Fabio M. De Francesco 
> > > > ---
> > > > 
> > > >  drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> > > > b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index
> > > > 25ea8e1b6b65..aa58eedf5e86 100644
> > > > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> > > > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> > > > @@ -1385,12 +1385,12 @@ inline void
> > > > ieee80211_softmac_new_net(struct
> > > > ieee80211_device *ieee, struct ieee>
> > > > 
> > > >  * essid provided by the user.
> > > >  */
> > > > 
> > > > if (!ssidbroad) {
> > > > 
> > > > -   strncpy(tmp_ssid, ieee-
> > >
> > >current_network.ssid, IW_ESSID_MAX_SIZE);
> > >
> > > > +   strscpy(tmp_ssid, ieee-
> > >
> > >current_network.ssid, IW_ESSID_MAX_SIZE);
> > >
> > > Are you sure you can just replace this like this?
> > 
> > I surely was... but now I'm not anymore, since your review :)
> > 
> > Maybe you mean I have to check possible return of -E2BIG?
> > Did you mean something else?
> > May you please elaborate further?
> 
> If it was as simple as search/replace, we would have already done that
> on the whole codebase at once.  It's not that simple :)
> 
> thanks,
> 
> greg k-h






Re: [Outreachy kernel] [PATCH] staging: rtl8192u: ieee80211: Replaced strncpy() with strscpy()

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 2:59:29 PM CEST Greg Kroah-Hartman wrote:
> On Tue, Apr 13, 2021 at 02:30:41PM +0200, Fabio M. De Francesco wrote:
> > Replaced strncpy() with strscpy() because of compilation time warnings
> > about possible truncation of output [-Wstringop-truncation].
> 
> build warnings?  What build warnings?
>
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:1388:5: warning: 
‘strncpy’ output may be truncated copying 32 bytes from a string of length 
32 [-Wstringop-truncation]
 1388 | strncpy(tmp_ssid, ieee->current_network.ssid, 
IW_ESSID_MAX_SIZE);
> 
> > Furthermore, according to the Linux official documentation, strscpy()
> > is
> > preferred to strncpy.
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> > b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index
> > 25ea8e1b6b65..aa58eedf5e86 100644
> > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> > @@ -1385,12 +1385,12 @@ inline void ieee80211_softmac_new_net(struct
> > ieee80211_device *ieee, struct ieee> 
> >  * essid provided by the user.
> >  */
> > 
> > if (!ssidbroad) {
> > 
> > -   strncpy(tmp_ssid, ieee-
>current_network.ssid, IW_ESSID_MAX_SIZE);
> > +   strscpy(tmp_ssid, ieee-
>current_network.ssid, IW_ESSID_MAX_SIZE);
> 
> Are you sure you can just replace this like this?
>
I surely was... but now I'm not anymore, since your review :)

Maybe you mean I have to check possible return of -E2BIG?
Did you mean something else?
May you please elaborate further?

Thanks,

Fabio
> 
> > tmp_ssid_len = ieee-
>current_network.ssid_len;
> > 
> > }
> > memcpy(>current_network, net, 
sizeof(struct
> > ieee80211_network));
> > 
> > -   strncpy(ieee->current_network.ssid, 
tmp_ssid, IW_ESSID_MAX_SIZE);
> > +   strscpy(ieee->current_network.ssid, 
tmp_ssid, IW_ESSID_MAX_SIZE);
> 
> Same here, are you sure?
> 
> thanks,
> 
> greg k-h






Re: [Outreachy kernel] Re: [PATCH v2 3/4] staging: media: intel-ipu3: reduce length of line

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 12:56:36 PM CEST Mitali Borkar wrote:
> On Tue, Apr 13, 2021 at 01:44:32PM +0300, Sakari Ailus wrote:
> > On Tue, Apr 13, 2021 at 04:13:04PM +0530, Mitali Borkar wrote:
> > > On Tue, Apr 13, 2021 at 01:01:34PM +0300, Sakari Ailus wrote:
> > > > Hi Mitali,
> > > > 
> > > > Thanks for the update.
> > > > 
> > > > On Tue, Apr 13, 2021 at 10:46:06AM +0530, Mitali Borkar wrote:
> > > > > Reduced length of the line under 80 characters to meet
> > > > > linux-kernel
> > > > > coding style.
> > > > > 
> > > > > Signed-off-by: Mitali Borkar 
> > > > > ---
> > > > > 
> > > > > Changes from v1:- Reduced length of the line under 80 characters
> > > > > 
> > > > >  drivers/staging/media/ipu3/include/intel-ipu3.h | 3 ++-
> > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/staging/media/ipu3/include/intel-ipu3.h
> > > > > b/drivers/staging/media/ipu3/include/intel-ipu3.h index
> > > > > 6a72c81d2b67..52dcc6cdcffc 100644
> > > > > --- a/drivers/staging/media/ipu3/include/intel-ipu3.h
> > > > > +++ b/drivers/staging/media/ipu3/include/intel-ipu3.h
> > > > > @@ -247,7 +247,8 @@ struct ipu3_uapi_ae_ccm {
> > > > > 
> > > > >   */
> > > > >  
> > > > >  struct ipu3_uapi_ae_config {
> > > > >  
> > > > >   struct ipu3_uapi_ae_grid_config grid_cfg __aligned(32);
> > > > > 
> > > > > - struct ipu3_uapi_ae_weight_elem weights[IPU3_UAPI_AE_WEIGHTS]
> > > > > __aligned(32); +  struct ipu3_uapi_ae_weight_elem
> > > > > weights[IPU3_UAPI_AE_WEIGHTS] +   
__aligned(32);
> > > > 
> > > > Do you still have the other two patches in your tree? This doesn't
> > > > apply
> > > > here due to the different attribute syntax.
> > > 
> > > I have patch 1/6 and 2/6 in my tree which you asked me to drop.
> > 
> > Could you drop them and then submit v3?
> 
> I am extremely sorry Sir, but I am still learning to use git, drop them
> means to delete those commits? Even if I delete those, this patch was
> made after those, so the changes I made then will remain as it is, so
> what to do now?
> 
> > Thanks.
>
I think that this document can help:
https://kernelnewbies.org/GitTips

Fabio





[Outreachy kernel] [PATCH] staging: rtl8192u: ieee80211: Replaced strncpy() with strscpy()

2021-04-13 Thread Fabio M. De Francesco
Replaced strncpy() with strscpy() because of compilation time warnings
about possible truncation of output [-Wstringop-truncation].
Furthermore, according to the Linux official documentation, strscpy() is
preferred to strncpy.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 25ea8e1b6b65..aa58eedf5e86 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1385,12 +1385,12 @@ inline void ieee80211_softmac_new_net(struct 
ieee80211_device *ieee, struct ieee
 * essid provided by the user.
 */
if (!ssidbroad) {
-   strncpy(tmp_ssid, ieee->current_network.ssid, 
IW_ESSID_MAX_SIZE);
+   strscpy(tmp_ssid, ieee->current_network.ssid, 
IW_ESSID_MAX_SIZE);
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(>current_network, net, sizeof(struct 
ieee80211_network));
 
-   strncpy(ieee->current_network.ssid, tmp_ssid, 
IW_ESSID_MAX_SIZE);
+   strscpy(ieee->current_network.ssid, tmp_ssid, 
IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
netdev_info(ieee->dev,
"Linking with %s,channel:%d, qos:%d, 
myHT:%d, networkHT:%d\n",
-- 
2.31.1



[Outreachy patch] [PATCH] staging: rtl8188eu: Move channel_table away from rtw_mlme_ext.h

2021-04-13 Thread Fabio M. De Francesco
Moved "static const struct channel_table[]" from include/rtw_mlme_ext.h
to core/rtw_ioctl_set.c because the latter is the only file that uses
that array of struct(s) in the whole driver. "make rtl8188eu/ W=1" output
several warnings about "'channel_table' defined but not used
[-Wunused-const-variable=]".

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c   | 8 
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 8 
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index 1ef32ff900a9..17b999f45132 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -11,6 +11,14 @@
 #include 
 #include 
 
+static const struct {
+int channel_plan;
+char *name;
+} channel_table[] = { { RT_CHANNEL_DOMAIN_FCC, "US" },
+{ RT_CHANNEL_DOMAIN_ETSI, "EU" },
+{ RT_CHANNEL_DOMAIN_MKK, "JP" },
+{ RT_CHANNEL_DOMAIN_CHINA, "CN"} };
+
 extern void indicate_wx_scan_complete_event(struct adapter *padapter);
 
 u8 rtw_do_join(struct adapter *padapter)
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 77eb5e3ef172..03d55eb7dc16 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -171,14 +171,6 @@ struct rt_channel_plan_map {
unsigned char   Index2G;
 };
 
-static const struct {
-   int channel_plan;
-   char *name;
-} channel_table[] = { { RT_CHANNEL_DOMAIN_FCC, "US" },
-   { RT_CHANNEL_DOMAIN_ETSI, "EU" },
-   { RT_CHANNEL_DOMAIN_MKK, "JP" },
-   { RT_CHANNEL_DOMAIN_CHINA, "CN"} };
-
 enum Associated_AP {
atherosAP   = 0,
broadcomAP  = 1,
-- 
2.31.1



Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: hal: Remove camelcase

2021-04-13 Thread Fabio M. De Francesco
On Tuesday, April 13, 2021 9:39:44 AM CEST Greg Kroah-Hartman wrote:
> On Mon, Apr 12, 2021 at 11:02:58PM +0200, Fabio M. De Francesco wrote:
> > Removed camelcase in (some) symbols. Further work is needed.
> 
> What symbols did you do this for?  What did you change them from and to?>
> 
> Be specific, and try to do only one structure at a time at the most,
> trying to review 1000 lines of changes at once is hard, would you want
> to do that?  :)
> 
For sure, if I were you, I wouldn't be reviewing one thousand lines of code 
at once :) 

OK, let's work on one item at a time  

I'd place each change in a patch of a series:

a) one global variable -> one patch with subject containing the name of the 
symbol (beware that if not 1000 lines you'll have to review 200 lines or 
more because that file is huge and its globals are used hundreds of times);
b) one or more local variables -> one single patch containing the name of 
the function where they are used;  

In the while, I'll remove also the trailing "p_" that stand for "pointer" 
(as Julia suggested). 

The above seems reasonable to me. Doesn't it?

Regarding what Matthew wrote about making use of  
drivers/net/wireless/realtek/rtlwifi/btcoexist/ I cannot work on it (too 
much time commitment would be needed, I suppose), but,  if someone else 
can, I won't do the above-mentioned tasks because they would be useless.

Said that, I'm not sure if removing camelcase in this file should be done 
at all.

Thanks,

Fabio
>
> thanks,
> 
> greg k-h






[Outreachy kernel] [PATCH 2/2] staging: rtl8723bs: hal: Remove multiple blank lines

2021-04-12 Thread Fabio M. De Francesco
Removed unnecessary multiple blank lines. Issue detected by
checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/hal/Hal8723BReg.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/Hal8723BReg.h 
b/drivers/staging/rtl8723bs/hal/Hal8723BReg.h
index 1ff2043fb2e2..4a91913e20bf 100644
--- a/drivers/staging/rtl8723bs/hal/Hal8723BReg.h
+++ b/drivers/staging/rtl8723bs/hal/Hal8723BReg.h
@@ -19,12 +19,9 @@
 #ifndef __INC_HAL8723BREG_H
 #define __INC_HAL8723BREG_H
 
-
-
 /*  */
 /*  */
 /*  */
-
 /*  */
 /*  */
 /* 0xh ~ 0x00FFh   System Configuration */
@@ -142,7 +139,6 @@
 #define REG_RQPN_NPQ_8723B 0x0214
 #define REG_DWBCN1_CTRL_8723B  0x0228
 
-
 /*  */
 /*  */
 /* 0x0280h ~ 0x02FFh   RXDMA Configuration */
@@ -158,7 +154,6 @@
 #define REG_RSVD5_8723B0x02F0
 #define REG_RSVD6_8723B0x02F4
 
-
 /*  */
 /*  */
 /* 0x0300h ~ 0x03FFh   PCIe */
@@ -355,7 +350,6 @@
 #define REG_BFMEE_SEL_8723B0x0714
 #define REG_SND_PTCL_CTRL_8723B0x0718
 
-
 /* Redifine 8192C register definition for compatibility */
 
 /* TODO: use these definition when using REG_xxx naming rule. */
@@ -365,7 +359,6 @@
 #defineMSR_8723B   (REG_CR_8723B + 2)  /*  Media 
Status register */
 #defineISR_8723B   REG_HISR0_8723B
 #defineTSFR_8723B  REG_TSFTR_8723B /*  Timing Sync 
Function Timer Register. */
-
 #define PBP_8723B  REG_PBP_8723B
 
 /*  Redifine MACID register, to compatible prior ICs. */
-- 
2.31.1



[Outreachy kernel] [PATCH 1/2] staging: rtl8723bs: hal: Remove spaces before tabs

2021-04-12 Thread Fabio M. De Francesco
Removed spaces before tabs. Issue detected by checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/hal/Hal8723BReg.h | 36 ++---
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/Hal8723BReg.h 
b/drivers/staging/rtl8723bs/hal/Hal8723BReg.h
index 616d20106392..1ff2043fb2e2 100644
--- a/drivers/staging/rtl8723bs/hal/Hal8723BReg.h
+++ b/drivers/staging/rtl8723bs/hal/Hal8723BReg.h
@@ -27,7 +27,7 @@
 
 /*  */
 /*  */
-/* 0xh ~ 0x00FFh   System Configuration */
+/* 0xh ~ 0x00FFh   System Configuration */
 /*  */
 /*  */
 #define REG_SYS_ISO_CTRL_8723B 0x  /*  2 Byte */
@@ -84,7 +84,7 @@
 
 /*  */
 /*  */
-/* 0x0100h ~ 0x01FFh   MACTOP General Configuration */
+/* 0x0100h ~ 0x01FFh   MACTOP General Configuration */
 /*  */
 /*  */
 #define REG_CR_8723B   0x0100
@@ -131,7 +131,7 @@
 
 /*  */
 /*  */
-/* 0x0200h ~ 0x027Fh   TXDMA Configuration */
+/* 0x0200h ~ 0x027Fh   TXDMA Configuration */
 /*  */
 /*  */
 #define REG_RQPN_8723B 0x0200
@@ -145,7 +145,7 @@
 
 /*  */
 /*  */
-/* 0x0280h ~ 0x02FFh   RXDMA Configuration */
+/* 0x0280h ~ 0x02FFh   RXDMA Configuration */
 /*  */
 /*  */
 #define REG_RXDMA_AGG_PG_TH_8723B  0x0280
@@ -161,7 +161,7 @@
 
 /*  */
 /*  */
-/* 0x0300h ~ 0x03FFh   PCIe */
+/* 0x0300h ~ 0x03FFh   PCIe */
 /*  */
 /*  */
 #defineREG_PCIE_CTRL_REG_8723B 0x0300
@@ -189,7 +189,7 @@
 /*  spec version 11 */
 /*  */
 /*  */
-/* 0x0400h ~ 0x047Fh   Protocol Configuration */
+/* 0x0400h ~ 0x047Fh   Protocol Configuration */
 /*  */
 /*  */
 #define REG_VOQ_INFORMATION_8723B  0x0400
@@ -243,7 +243,7 @@
 
 /*  */
 /*  */
-/* 0x0500h ~ 0x05FFh   EDCA Configuration */
+/* 0x0500h ~ 0x05FFh   EDCA Configuration */
 /*  */
 /*  */
 #define REG_EDCA_VO_PARAM_8723B0x0500
@@ -263,15 +263,15 @@
 #define REG_RD_CTRL_8723B  0x0524
 /*  */
 /*  Format for offset 540h-542h: */
-/* [3:0]:   TBTT prohibit setup in unit of 32us. The time for HW getting 
beacon content before TBTT. */
-/* [7:4]:   Reserved. */
-/* [19:8]:  TBTT prohibit hold in unit of 32us. The time for HW holding to 
send the beacon packet. */
-/* [23:20]: Reserved */
+/* [3:0]:   TBTT prohibit setup in unit of 32us. The time for HW getting 
beacon content before TBTT. */
+/* [7:4]:   Reserved. */
+/* [19:8]:  TBTT prohibit hold in unit of 32us. The time for HW holding to 
send the beacon packet. */
+/* [23:20]: Reserved */
 /*  Description: */
-/*   | */
+/* | */
 /*  |<--Setup--|--Hold>| */
-/* --|-- */
-/* | */
+/* --|-- */
+/* | */
 /*TBTT */
 /*  Note: We cannot update beacon content to HW or send any AC packets during 
the time between Setup and Hold. */
 /*  Described by Designer Tim and Bruce, 2011-01-14. */
@@ -300,7 +300,7 @@
 #define REG_ACMHWCTRL_8723B0x05C0
 #define REG_SCH_TXCMD_8723B0x05F8
 
-/* 0x0600h ~ 0x07FFh   WMAC Configuration */
+/* 0x0600h ~ 0x07FFh   WMAC Configuration */
 #define REG_MAC_CR_8723B   0x0600
 #define REG_TCR_8723B  0x0604
 #define REG_RCR_8723B  0x0608
@@ -356,10 +356,10 @@
 #define REG_SND_PTCL_CTRL_8723B0x0718
 
 
-/* Redifine 8192C register definition for compatibility */
+/* Redifine 8192C register definition for compatibility */
 
-/*  TODO: use these definition when using REG_xxx naming rule. */
-/*  NOTE: DO NOT Remove these definition. Use later. */
+/* TODO: use these definition when using REG_xxx naming rule. */
+/* NOTE: DO NOT Remove these definition. Use later. */
 #defineEFUSE_CTRL_8723BREG_EFUSE_CTRL_8723B/*  E-Fuse 
Control. */
 #defineEFUSE_TEST_8723BREG_EFUSE_TEST_8723B/*  E-Fuse 
Test. */
 #defineMSR_8723B   (REG_CR_8723B + 2)  /*  Media 
Status register */
-- 
2.31.1



[Outreachy kernel] [PATCH 0/2] Remove spaces and blank lines

2021-04-12 Thread Fabio M. De Francesco
Removed spaces before tabs and multiple blank lines from Hal8723BReg.h
for readability improvement. Issues detected by checkpatch.pl.

Fabio M. De Francesco (2):
  staging: rtl8723bs: hal Remove spaces before tabs
  staging: rtl8723bs: hal: Remove multiple blank lines

 drivers/staging/rtl8723bs/hal/Hal8723BReg.h | 43 +
 1 file changed, 18 insertions(+), 25 deletions(-)

-- 
2.31.1



Re: [Outreachy kernel] [PATCH] staging: rtl8192u: Remove function

2021-04-12 Thread Fabio M. De Francesco
On Monday, April 12, 2021 12:22:03 PM CEST Greg KH wrote:
> On Mon, Apr 12, 2021 at 12:12:34PM +0200, Fabio M. De Francesco wrote:
> > On Monday, April 12, 2021 11:42:51 AM CEST Greg KH wrote:
> > > On Sun, Apr 11, 2021 at 08:48:13PM +0200, Fabio M. De Francesco 
wrote:
> > > > Remove cmpk_handle_query_config_rx() because it just initializes a
> > > > local
> > > > variable and then returns "void".
> > > > 
> > > > Signed-off-by: Fabio M. De Francesco 
> > > > ---
> > > > 
> > > >  drivers/staging/rtl8192u/r819xU_cmdpkt.c | 40
> > > >  
> > > >  1 file changed, 40 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> > > > b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index
> > > > 4cece40a92f6..d5a54c2d3086 100644
> > > > --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> > > > +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> > > > @@ -249,46 +249,6 @@ static void
> > > > cmpk_handle_interrupt_status(struct
> > > > net_device *dev, u8 *pmsg)>
> > > > 
> > > > DMESG("< cmpk_handle_interrupt_status()\n");
> > > >  
> > > >  }
> > > > 
> > > > -/*
> > > > 
> > > > - - * Function:cmpk_handle_query_config_rx()
> > > > - *
> > > > - * Overview:The function is responsible for extract the
> > > > message
> > > > from - *firmware. It will contain dedicated 
info in
> > > > - * ws-06-0063-rtl8190-command-packet-specification.
> > 
> > Please
> > 
> > > > - * refer to chapter "Beacon State Element".
> > > > - *
> > > > - * Input:   u8*pmsg-   Message Pointer of the
> > 
> > command packet.
> > 
> > > > - *
> > > > - * Output:  NONE
> > > > - *
> > > > - * Return:  NONE
> > > > - *
> > > > - * Revised History:
> > > > - *  When   Who Remark
> > > > - *  05/12/2008 amy Create Version 0 porting 
from
> > 
> > windows code.
> > 
> > > > - *
> > > > -
> > > > *--
> > > > ---
> > > > -- - */
> > > > -static void cmpk_handle_query_config_rx(struct net_device *dev, u8
> > > > *pmsg) -{
> > > > -   struct cmpk_query_cfg   rx_query_cfg;
> > > > -
> > > > -   /* 1. Extract TX feedback info from RFD to temp structure
> > 
> > buffer. */
> > 
> > > > -   /* It seems that FW use big endian(MIPS) and DRV use little
> > 
> > endian in
> > 
> > > > -* windows OS. So we have to read the content byte by byte or
> > > > transfer
> > > > -* endian type before copy the message copy.
> > > > -*/
> > > > -   rx_query_cfg.cfg_action = (pmsg[4] & 0x80) >> 7;
> > > > -   rx_query_cfg.cfg_type   = (pmsg[4] & 0x60) >> 5;
> > > > -   rx_query_cfg.cfg_size   = (pmsg[4] & 0x18) >> 3;
> > > > -   rx_query_cfg.cfg_page   = (pmsg[6] & 0x0F) >> 0;
> > > > -   rx_query_cfg.cfg_offset = pmsg[7];
> > > > -   rx_query_cfg.value  = (pmsg[8]  << 24) |
> > 
> > (pmsg[9]  << 16) |
> > 
> > > > - (pmsg[10] <<  8)
> > | 
> > | (pmsg[11] <<  0);
> > | 
> > > > -   rx_query_cfg.mask   = (pmsg[12] << 24) |
> > 
> > (pmsg[13] << 16) |
> > 
> > > > - (pmsg[14] <<  8)
> > | 
> > | (pmsg[15] <<  0);
> > | 
> > > > -}
> > > > -
> > > > 
> > > >  /*
> > > >  
> > > >  ->
> > > >  
> > > >   * Function:   cmpk_count_tx_status()
> > > >   *
> > > 
> > > Always test-build your patches as they can not break the build.  You
> > > obviously did not do that here, why not?
> > 
> > I can't see that where the build of rtl8192u is broken.
> > The following lines are from the compilation log:
> > 
> > git/kernels/staging> make -j8 drivers/staging/rtl8192u/
> > 
> >  [...]
> >  CC [M]  drivers/staging/rtl8192u/r819xU_cmdpkt.o
> >  CC [M]  drivers/staging/rtl8192u/r819xU_cmdpkt.o
> >  [...]
> >  LD [M]  drivers/staging/rtl8192u/r8192u_usb.o
> > 
> > No errors are reported.
> > 
> > What am I missing?
> 
> The function is used elsewhere in this file :(
>
You're right, it is used in a "switch" statement later in the file.
Now I've also understood why it built with no errors:
it built because, notwithstanding that modification, for some reason I have 
still the original version of the file.
I don't know why, maybe I've made some stupid error with Git...

Thanks,

Fabio





Re: [Outreachy kernel] [PATCH] staging: rtl8192u: Remove variable set but not used

2021-04-12 Thread Fabio M. De Francesco
On Monday, April 12, 2021 11:31:15 AM CEST Greg KH wrote:
> On Sun, Apr 11, 2021 at 07:41:43PM +0200, Fabio M. De Francesco wrote:
> > Remove variable "int ret" which is instantiated but not used.
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8192u/r8192U_core.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/staging/rtl8192u/r8192U_core.c
> > b/drivers/staging/rtl8192u/r8192U_core.c index
> > f48186a89fa1..30055de66239 100644
> > --- a/drivers/staging/rtl8192u/r8192U_core.c
> > +++ b/drivers/staging/rtl8192u/r8192U_core.c
> > @@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff
> > *skb, struct net_device *dev,> 
> >int rate)
> >  
> >  {
> >  
> > struct r8192_priv *priv = (struct r8192_priv 
*)ieee80211_priv(dev);
> > 
> > -   int ret;
> > 
> > unsigned long flags;
> > struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb +
> > MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index;
> 
> Did you test-build this patch?
>
Sorry, I don't know why I forgot to test it.
I realized that this morning when I read a message from the kernel test 
robot.
I'll be more careful with future patches.

Thanks,

Fabio






Re: [Outreachy kernel] [PATCH] staging: rtl8192u: Remove function

2021-04-12 Thread Fabio M. De Francesco
On Monday, April 12, 2021 11:42:51 AM CEST Greg KH wrote:
> On Sun, Apr 11, 2021 at 08:48:13PM +0200, Fabio M. De Francesco wrote:
> > Remove cmpk_handle_query_config_rx() because it just initializes a
> > local
> > variable and then returns "void".
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8192u/r819xU_cmdpkt.c | 40 
> >  1 file changed, 40 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> > b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index
> > 4cece40a92f6..d5a54c2d3086 100644
> > --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> > +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> > @@ -249,46 +249,6 @@ static void cmpk_handle_interrupt_status(struct
> > net_device *dev, u8 *pmsg)> 
> > DMESG("< cmpk_handle_interrupt_status()\n");
> >  
> >  }
> > 
> > -/*
> > - - * Function:cmpk_handle_query_config_rx()
> > - *
> > - * Overview:The function is responsible for extract the message
> > from - *firmware. It will contain dedicated info in
> > - * ws-06-0063-rtl8190-command-packet-specification. 
Please
> > - * refer to chapter "Beacon State Element".
> > - *
> > - * Input:   u8*pmsg-   Message Pointer of the 
command packet.
> > - *
> > - * Output:  NONE
> > - *
> > - * Return:  NONE
> > - *
> > - * Revised History:
> > - *  When   Who Remark
> > - *  05/12/2008 amy Create Version 0 porting from 
windows code.
> > - *
> > -
> > *-
> > -- - */
> > -static void cmpk_handle_query_config_rx(struct net_device *dev, u8
> > *pmsg) -{
> > -   struct cmpk_query_cfg   rx_query_cfg;
> > -
> > -   /* 1. Extract TX feedback info from RFD to temp structure 
buffer. */
> > -   /* It seems that FW use big endian(MIPS) and DRV use little 
endian in
> > -* windows OS. So we have to read the content byte by byte or
> > transfer
> > -* endian type before copy the message copy.
> > -*/
> > -   rx_query_cfg.cfg_action = (pmsg[4] & 0x80) >> 7;
> > -   rx_query_cfg.cfg_type   = (pmsg[4] & 0x60) >> 5;
> > -   rx_query_cfg.cfg_size   = (pmsg[4] & 0x18) >> 3;
> > -   rx_query_cfg.cfg_page   = (pmsg[6] & 0x0F) >> 0;
> > -   rx_query_cfg.cfg_offset = pmsg[7];
> > -   rx_query_cfg.value  = (pmsg[8]  << 24) | 
(pmsg[9]  << 16) |
> > - (pmsg[10] <<  8) 
| (pmsg[11] <<  0);
> > -   rx_query_cfg.mask   = (pmsg[12] << 24) | 
(pmsg[13] << 16) |
> > - (pmsg[14] <<  8) 
| (pmsg[15] <<  0);
> > -}
> > -
> > 
> >  /*
> >  ->  
> >   * Function:   cmpk_count_tx_status()
> >   *
> 
> Always test-build your patches as they can not break the build.  You
> obviously did not do that here, why not?
>
I can't see that where the build of rtl8192u is broken. 
The following lines are from the compilation log:

git/kernels/staging> make -j8 drivers/staging/rtl8192u/
 [...]
 CC [M]  drivers/staging/rtl8192u/r819xU_cmdpkt.o
 CC [M]  drivers/staging/rtl8192u/r819xU_cmdpkt.o
 [...]
 LD [M]  drivers/staging/rtl8192u/r8192u_usb.o

No errors are reported.

What am I missing?

Thanks,

Fabio
> 
> thanks,
> 
> greg k-h






[Outreachy kernel] [PATCH] staging: rtl8192u: Remove function

2021-04-11 Thread Fabio M. De Francesco
Remove cmpk_handle_query_config_rx() because it just initializes a local
variable and then returns "void".

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8192u/r819xU_cmdpkt.c | 40 
 1 file changed, 40 deletions(-)

diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c 
b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
index 4cece40a92f6..d5a54c2d3086 100644
--- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
+++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
@@ -249,46 +249,6 @@ static void cmpk_handle_interrupt_status(struct net_device 
*dev, u8 *pmsg)
DMESG("< cmpk_handle_interrupt_status()\n");
 }
 
-/*-
- * Function:cmpk_handle_query_config_rx()
- *
- * Overview:The function is responsible for extract the message from
- * firmware. It will contain dedicated info in
- * ws-06-0063-rtl8190-command-packet-specification. Please
- * refer to chapter "Beacon State Element".
- *
- * Input:   u8*pmsg-   Message Pointer of the command packet.
- *
- * Output:  NONE
- *
- * Return:  NONE
- *
- * Revised History:
- *  When   Who Remark
- *  05/12/2008 amy Create Version 0 porting from windows code.
- *
- *---
- */
-static void cmpk_handle_query_config_rx(struct net_device *dev, u8 *pmsg)
-{
-   struct cmpk_query_cfg   rx_query_cfg;
-
-   /* 1. Extract TX feedback info from RFD to temp structure buffer. */
-   /* It seems that FW use big endian(MIPS) and DRV use little endian in
-* windows OS. So we have to read the content byte by byte or transfer
-* endian type before copy the message copy.
-*/
-   rx_query_cfg.cfg_action = (pmsg[4] & 0x80) >> 7;
-   rx_query_cfg.cfg_type   = (pmsg[4] & 0x60) >> 5;
-   rx_query_cfg.cfg_size   = (pmsg[4] & 0x18) >> 3;
-   rx_query_cfg.cfg_page   = (pmsg[6] & 0x0F) >> 0;
-   rx_query_cfg.cfg_offset = pmsg[7];
-   rx_query_cfg.value  = (pmsg[8]  << 24) | (pmsg[9]  << 16) |
- (pmsg[10] <<  8) | (pmsg[11] <<  0);
-   rx_query_cfg.mask   = (pmsg[12] << 24) | (pmsg[13] << 16) |
- (pmsg[14] <<  8) | (pmsg[15] <<  0);
-}
-
 /*-
  * Function:   cmpk_count_tx_status()
  *
-- 
2.31.1



[Outreachy kernel] [PATCH v2] staging: rtl8192u: Remove variable set but not used

2021-04-11 Thread Fabio M. De Francesco
Remove variable "int ret", declared but not used.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: Change the text of the subject and log.

 drivers/staging/rtl8192u/r8192U_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index f48186a89fa1..30055de66239 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, 
struct net_device *dev,
   int rate)
 {
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-   int ret;
unsigned long flags;
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 
MAX_DEV_ADDR_SIZE);
u8 queue_index = tcb_desc->queue_index;
-- 
2.31.1


Re: [Outreachy kernel] [PATCH] staging: rtl8192u: Remove variable set but not used

2021-04-11 Thread Fabio M. De Francesco
On Sunday, April 11, 2021 7:43:57 PM CEST Julia Lawall wrote:
> On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > Remove variable "int ret" which is instantiated but not used.
> 
> instantiated -> declared?  I thought instantiated could mean initialized,
> but that doesn't seem to be the case.
> 
> julia
Please, help me to remind...

If a local variable is declared but not set to any value, does it take 
space on the stack?

If I understand your message, it does not. Therefore it is only declared 
but no memory is allocated for it (i.e., it is not instantiated). Right?

If you confirm I've understood this topic, I can send a v2 patch.

Thanks for your review,

Fabio
> 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8192u/r8192U_core.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/staging/rtl8192u/r8192U_core.c
> > b/drivers/staging/rtl8192u/r8192U_core.c index
> > f48186a89fa1..30055de66239 100644
> > --- a/drivers/staging/rtl8192u/r8192U_core.c
> > +++ b/drivers/staging/rtl8192u/r8192U_core.c
> > @@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff
> > *skb, struct net_device *dev,> 
> >int rate)
> >  
> >  {
> >  
> > struct r8192_priv *priv = (struct r8192_priv 
*)ieee80211_priv(dev);
> > 
> > -   int ret;
> > 
> > unsigned long flags;
> > struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb +
> > MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index;
> > 
> > --
> > 2.31.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 view this discussion
> > on the web visit
> > https://groups.google.com/d/msgid/outreachy-kernel/20210411174143.3161
> > 8-1-fmdefrancesco%40gmail.com.






[Outreachy kernel] [PATCH] staging: rtl8192u: Remove variable set but not used

2021-04-11 Thread Fabio M. De Francesco
Remove variable "int ret" which is instantiated but not used.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8192u/r8192U_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index f48186a89fa1..30055de66239 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, 
struct net_device *dev,
   int rate)
 {
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-   int ret;
unsigned long flags;
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 
MAX_DEV_ADDR_SIZE);
u8 queue_index = tcb_desc->queue_index;
-- 
2.31.1



[Outreachy kernel] [PATCH v5 4/4] staging: rtl8723bs: Change controlling expressions

2021-04-11 Thread Fabio M. De Francesco
Change controlling expressions within 'if' statements: don't compare
with 'true'.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v4: Write patch version number in 2/4.
Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 32079e0f71d5..0297fbad7bce 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if (pwrpriv->fw_current_in_ps_mode && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c 
b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 96fe172ced8d..8dc4dd8c6d4c 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter *padapter)
 
 void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
 {
-   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode == true) {
+   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
if (padapter->HalFunc.hal_dm_watchdog_in_lps)
padapter->HalFunc.hal_dm_watchdog_in_lps(padapter); /* 
this function caller is in interrupt context */
}
-- 
2.31.1



[Outreachy kernel] [PATCH v5 3/4] staging: rtl8723bs: include: Change the type of a variable

2021-04-11 Thread Fabio M. De Francesco
Change the type of fw_current_in_ps_mode from u8 to bool, because
it is used everywhere as a bool and, accordingly, it should be
declared as a bool.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v4: Write patch version number in 2/4.
Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 0a48f1653be5..0767dbb84199 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -203,7 +203,7 @@ struct pwrctrl_priv {
u8 LpsIdleCount;
u8 power_mgnt;
u8 org_power_mgnt;
-   u8 fw_current_in_ps_mode;
+   bool fw_current_in_ps_mode;
unsigned long   DelayLPSLastTimeStamp;
s32 pnp_current_pwr_state;
u8 pnp_bstop_trx;
-- 
2.31.1



[Outreachy kernel] [PATCH v5 2/4] staging: rtl8723bs: include: Fix misspelled words in comments

2021-04-11 Thread Fabio M. De Francesco
Correct misspelled words in comments of several files. Issue (largely)
detected by checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v4: Write patch version number in 2/4.
Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h 
b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
index fb80901f0788..4b3a7c051630 100644
--- a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
+++ b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
@@ -34,7 +34,7 @@
 /*--Define Parameters---*/
 
 /*  */
-/*8192S Regsiter offset definition */
+/*8192S Register offset definition */
 /*  */
 
 /*  */
@@ -43,7 +43,7 @@
 /*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
 /*  3. RF register 0x00-2E */
 /*  4. Bit Mask for BB/RF register */
-/*  5. Other defintion for BB/RF R/W */
+/*  5. Other definition for BB/RF R/W */
 /*  */
 
 
@@ -137,7 +137,7 @@
 #definerFPGA0_AnalogParameter3 0x888   /*  Useless now 
*/
 #definerFPGA0_AnalogParameter4 0x88c
 
-#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver 
LSSI Readback */
+#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Transceiver 
LSSI Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
 #definerFPGA0_XC_LSSIReadBack  0x8a8
 #definerFPGA0_XD_LSSIReadBack  0x8ac
@@ -206,7 +206,7 @@
 #definerOFDM0_TRSWIsolation0xc0c
 
 #definerOFDM0_XARxAFE  0xc10  /* RxIQ DC 
offset, Rx digital filter, DC notch filter */
-#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ imblance 
matrix */
+#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ 
imbalance matrix */
 #definerOFDM0_XBRxAFE  0xc18
 #definerOFDM0_XBRxIQImbalance  0xc1c
 #definerOFDM0_XCRxAFE  0xc20
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h 
b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..57bb717327ce 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -187,7 +187,7 @@
); \
 }
 
-/*  Get the N-bytes aligment offset from the current length */
+/*  Get the N-bytes alignent offset from the current length */
 #define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : 
(((__Value + __Aligment - 1) / __Aligment) * __Aligment))
 
 #define TEST_FLAG(__Flag, __testFlag)  (((__Flag) & (__testFlag)) != 0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index 19da27fb5ddf..f1f588d38a60 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -424,7 +424,7 @@ struct adapter {
/*  The driver will show up the desired channel number when this 
flag is 1. */
u8 bNotifyChannelChange;
 
-   /* pbuddystruct adapter is used only in  two inteface case, (iface_nums 
=2 in struct dvobj_priv) */
+   /* pbuddystruct adapter is used only in two interface case, (iface_nums 
=2 in struct dvobj_priv) */
/* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
/* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
/* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to 
padapters[iface_id]  in struct dvobj_priv */
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h 
b/drivers/staging/rtl8723bs/include/hal_com.h
index a1e1b76b5d8a..6bcc443d59fb 100644
--- a/

[Outreachy kernel] [PATCH v5 1/4] staging: rtl8723bs: Remove camelcase in several files

2021-04-11 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v4: Write patch version number in 2/4.
Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index e94eb1138cf1..32079e0f71d5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..895997868c81 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 05e537cd4e48..364b96fe0a54 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrct

[Outreachy kernel] [PATCH v5 0/4] staging: rtl8723bs: Change several files of the driver

2021-04-11 Thread Fabio M. De Francesco
Remove camelcase, correct misspelled words in comments, change 
the type of a variable and its use, change comparisons with 'true'
in controlling expressions.

Changes from v4: Write patch version number in 2/4.
Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

Fabio M. De Francesco (4):
  staging: rtl8723bs: Remove camelcase in several files
  staging: rtl8723bs: include: Fix misspelled words in comments
  staging: rtl8723bs: include: Change the type of a variable
  staging: rtl8723bs: Change controlling expressions

 drivers/staging/rtl8723bs/core/rtw_cmd.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c  |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c   |  6 ++--
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c  | 14 
 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  4 +--
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 23 files changed, 70 insertions(+), 70 deletions(-)

-- 
2.31.1



[Outreachy kernel] [PATCH v4 4/4] staging: rtl8723bs: Change controlling expressions

2021-04-11 Thread Fabio M. De Francesco
Change controlling expressions within 'if' statements: don't compare
with 'true'.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 32079e0f71d5..0297fbad7bce 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if (pwrpriv->fw_current_in_ps_mode && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c 
b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 96fe172ced8d..8dc4dd8c6d4c 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter *padapter)
 
 void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
 {
-   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode == true) {
+   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
if (padapter->HalFunc.hal_dm_watchdog_in_lps)
padapter->HalFunc.hal_dm_watchdog_in_lps(padapter); /* 
this function caller is in interrupt context */
}
-- 
2.31.1



[Outreachy kernel] [PATCH v4 3/4] staging: rtl8723bs: include: Change the type of a variable

2021-04-11 Thread Fabio M. De Francesco
Change the type of fw_current_in_ps_mode from u8 to bool, because
it is used everywhere as a bool and, accordingly, it should be
declared as a bool.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 0a48f1653be5..0767dbb84199 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -203,7 +203,7 @@ struct pwrctrl_priv {
u8 LpsIdleCount;
u8 power_mgnt;
u8 org_power_mgnt;
-   u8 fw_current_in_ps_mode;
+   bool fw_current_in_ps_mode;
unsigned long   DelayLPSLastTimeStamp;
s32 pnp_current_pwr_state;
u8 pnp_bstop_trx;
-- 
2.31.1



[Outreachy kernel] [PATCH 2/4] staging: rtl8723bs: include: Fix misspelled words in comments

2021-04-11 Thread Fabio M. De Francesco
Correct misspelled words in comments of several files. Issue (largely)
detected by checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h 
b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
index fb80901f0788..4b3a7c051630 100644
--- a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
+++ b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
@@ -34,7 +34,7 @@
 /*--Define Parameters---*/
 
 /*  */
-/*8192S Regsiter offset definition */
+/*8192S Register offset definition */
 /*  */
 
 /*  */
@@ -43,7 +43,7 @@
 /*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
 /*  3. RF register 0x00-2E */
 /*  4. Bit Mask for BB/RF register */
-/*  5. Other defintion for BB/RF R/W */
+/*  5. Other definition for BB/RF R/W */
 /*  */
 
 
@@ -137,7 +137,7 @@
 #definerFPGA0_AnalogParameter3 0x888   /*  Useless now 
*/
 #definerFPGA0_AnalogParameter4 0x88c
 
-#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver 
LSSI Readback */
+#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Transceiver 
LSSI Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
 #definerFPGA0_XC_LSSIReadBack  0x8a8
 #definerFPGA0_XD_LSSIReadBack  0x8ac
@@ -206,7 +206,7 @@
 #definerOFDM0_TRSWIsolation0xc0c
 
 #definerOFDM0_XARxAFE  0xc10  /* RxIQ DC 
offset, Rx digital filter, DC notch filter */
-#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ imblance 
matrix */
+#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ 
imbalance matrix */
 #definerOFDM0_XBRxAFE  0xc18
 #definerOFDM0_XBRxIQImbalance  0xc1c
 #definerOFDM0_XCRxAFE  0xc20
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h 
b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..57bb717327ce 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -187,7 +187,7 @@
); \
 }
 
-/*  Get the N-bytes aligment offset from the current length */
+/*  Get the N-bytes alignent offset from the current length */
 #define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : 
(((__Value + __Aligment - 1) / __Aligment) * __Aligment))
 
 #define TEST_FLAG(__Flag, __testFlag)  (((__Flag) & (__testFlag)) != 0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index 19da27fb5ddf..f1f588d38a60 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -424,7 +424,7 @@ struct adapter {
/*  The driver will show up the desired channel number when this 
flag is 1. */
u8 bNotifyChannelChange;
 
-   /* pbuddystruct adapter is used only in  two inteface case, (iface_nums 
=2 in struct dvobj_priv) */
+   /* pbuddystruct adapter is used only in two interface case, (iface_nums 
=2 in struct dvobj_priv) */
/* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
/* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
/* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to 
padapters[iface_id]  in struct dvobj_priv */
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h 
b/drivers/staging/rtl8723bs/include/hal_com.h
index a1e1b76b5d8a..6bcc443d59fb 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/

[Outreachy kernel] [PATCH v4 1/4] staging: rtl8723bs: Remove camelcase in several files

2021-04-11 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index e94eb1138cf1..32079e0f71d5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..895997868c81 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 05e537cd4e48..364b96fe0a54 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
 

[Outreachy kernel] [PATCH v4 0/4] staging: rtl8723bs: Change several files of the driver

2021-04-11 Thread Fabio M. De Francesco
Remove camelcase, correct misspelled words in comments, change 
the type of a variable and its use, change comparisons with 'true'
in controlling expressions.

Changes from v3: Move changes of controlling expressions in patch 4/4.
Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

Fabio M. De Francesco (4):
  staging: rtl8723bs: Remove camelcase in several files
  staging: rtl8723bs: include: Fix misspelled words in comments
  staging: rtl8723bs: include: Change the type of a variable
  staging: rtl8723bs: Change controlling expressions

 drivers/staging/rtl8723bs/core/rtw_cmd.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c  |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c   |  6 ++--
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c  | 14 
 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  4 +--
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 23 files changed, 70 insertions(+), 70 deletions(-)

-- 
2.31.1



Re: [Outreachy kernel] [PATCH v3 4/4] staging: rtl8723bs: core: Change a controlling expression

2021-04-11 Thread Fabio M. De Francesco
On Sunday, April 11, 2021 12:10:17 PM CEST Julia Lawall wrote:
> On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > On Sunday, April 11, 2021 11:51:32 AM CEST Julia Lawall wrote:
> > > On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > > > On Sunday, April 11, 2021 11:26:41 AM CEST Julia Lawall wrote:
> > > > > On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > > > > > Change a controlling expression within an 'if' statement: don't
> > > > > > compare
> > > > > > with 'true'.
> > > > > > 
> > > > > > Signed-off-by: Fabio M. De Francesco 
> > > > > > ---
> > > > > > 
> > > > > > Changes from v2: Rewrite subject in patch 0/4; remove a patch
> > > > > > from
> > > > > > the
> > > > > > series because it had already been applied (rtl8723bs: core:
> > > > > > Remove
> > > > > > an
> > > > > > unused variable). Changes from v1: Fix a typo in subject of
> > > > > > patch
> > > > > > 1/5,
> > > > > > add patch 5/5.>
> > > > > > 
> > > > > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
> > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > > > 32079e0f71d5..600366cb1aeb 100644
> > > > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > > > @@ -1507,7 +1507,7 @@ static void
> > > > > > rtw_lps_change_dtim_hdl(struct
> > > > > > adapter *padapter, u8 dtim)>
> > > > > > 
> > > > > > if (pwrpriv->dtim != dtim)
> > > > > > 
> > > > > > pwrpriv->dtim = dtim;
> > > > > > 
> > > > > > -   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv-
> > > > >
> > > > >pwr_mode >
> > > > >
> > > > > > PS_MODE_ACTIVE)) { +if ((pwrpriv->fw_current_in_ps_mode) 
&&
> > > > > > (pwrpriv->pwr_mode > PS_MODE_ACTIVE)) {
> > > > > 
> > > > > The parentheses in the left argument of && can be dropped as
> > > > > well.
> > > > 
> > > > What about the parentheses of the right argument? I'm not sure:
> > > > does
> > > > '>'
> > > > have precedence over '&&'? Doesn't it?
> > > 
> > > On the right they are not actually needed either:
> > So, I remembered well :)
> > 
> > > https://en.cppreference.com/w/c/language/operator_precedence
> > 
> > Very nice table. Thanks for the link.
> > 
> > > But you could look around in the code and see what people typically
> > > do.
> > > Perhaps one might find the parentheses more clear when there is a
> > > binary
> > > operator.  But when there is no binary operator, they could be more
> > > confusing than useful.
> > 
> > When I look around in the code I see a lot of unnecessary parentheses.
> > What people typically do is not always the right thing. I prefer to
> > remove parentheses where they are redundant.
> 
> Not sure I was clear.  This driver seems to be very enthusiastic about
> parentheses.  But perhaps check in other more mature parts of the
> kernel.
>
Sorry, I thought you were specifically referring to that file.

I've run "grep" in ./kernel/locking and others mature parts of Linux. 
You're right: experienced authors use parentheses when there are binary 
operators. Therefore, I'll leave that right hand argument as is within 
parentheses.

Thanks again,

Fabio
> 
> julia
> 
> > Thanks for your kind help,
> > 
> > Fabio
> > 
> > > julia
> > > 
> > > > Thanks,
> > > > 
> > > > Fabio
> > > > 
> > > > > julia
> > > > > 
> > > > > > u8 ps_mode = pwrpriv->pwr_mode;
> > > > > > 
> > > > > > rtw_hal_set_hwreg(padapter, 
HW_VAR_H2C_FW_PWRMODE,
> > > > 
> > > > (u8
> > > > 
> > > > > > *)(_mode));
> > > > > > 
> > > > > > --
> > > > > > 2.31.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 view this
> > > > > > discussion
> > > > > > on the web visit
> > > > > > https://groups.google.com/d/msgid/outreachy-kernel/202104110829
> > > > > > 08.3
> > > > > > 187
> > > > > > 6-5-fmdefrancesco%40gmail.com.






Re: [Outreachy kernel] [PATCH v3 4/4] staging: rtl8723bs: core: Change a controlling expression

2021-04-11 Thread Fabio M. De Francesco
On Sunday, April 11, 2021 11:51:32 AM CEST Julia Lawall wrote:
> On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > On Sunday, April 11, 2021 11:26:41 AM CEST Julia Lawall wrote:
> > > On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > > > Change a controlling expression within an 'if' statement: don't
> > > > compare
> > > > with 'true'.
> > > > 
> > > > Signed-off-by: Fabio M. De Francesco 
> > > > ---
> > > > 
> > > > Changes from v2: Rewrite subject in patch 0/4; remove a patch from
> > > > the
> > > > series because it had already been applied (rtl8723bs: core: Remove
> > > > an
> > > > unused variable). Changes from v1: Fix a typo in subject of patch
> > > > 1/5,
> > > > add patch 5/5.>
> > > > 
> > > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > 32079e0f71d5..600366cb1aeb 100644
> > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > @@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct
> > > > adapter *padapter, u8 dtim)>
> > > > 
> > > > if (pwrpriv->dtim != dtim)
> > > > 
> > > > pwrpriv->dtim = dtim;
> > > > 
> > > > -   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv-
> > >
> > >pwr_mode >
> > >
> > > > PS_MODE_ACTIVE)) { +if ((pwrpriv->fw_current_in_ps_mode) &&
> > > > (pwrpriv->pwr_mode > PS_MODE_ACTIVE)) {
> > > 
> > > The parentheses in the left argument of && can be dropped as well.
> > 
> > What about the parentheses of the right argument? I'm not sure: does
> > '>'
> > have precedence over '&&'? Doesn't it?
> 
> On the right they are not actually needed either:
>
So, I remembered well :)
> 
> https://en.cppreference.com/w/c/language/operator_precedence
> 
Very nice table. Thanks for the link.
>
> But you could look around in the code and see what people typically do.
> Perhaps one might find the parentheses more clear when there is a binary
> operator.  But when there is no binary operator, they could be more
> confusing than useful.
>
When I look around in the code I see a lot of unnecessary parentheses. 
What people typically do is not always the right thing. I prefer to remove 
parentheses where they are redundant.

Thanks for your kind help,

Fabio
>
> julia
> 
> > Thanks,
> > 
> > Fabio
> > 
> > > julia
> > > 
> > > > u8 ps_mode = pwrpriv->pwr_mode;
> > > > 
> > > > rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE,
> > 
> > (u8
> > 
> > > > *)(_mode));
> > > > 
> > > > --
> > > > 2.31.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 view this
> > > > discussion
> > > > on the web visit
> > > > https://groups.google.com/d/msgid/outreachy-kernel/20210411082908.3
> > > > 187
> > > > 6-5-fmdefrancesco%40gmail.com.






Re: [Outreachy kernel] [PATCH v3 4/4] staging: rtl8723bs: core: Change a controlling expression

2021-04-11 Thread Fabio M. De Francesco
On Sunday, April 11, 2021 11:26:41 AM CEST Julia Lawall wrote:
> On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > Change a controlling expression within an 'if' statement: don't compare
> > with 'true'.
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> > Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
> > series because it had already been applied (rtl8723bs: core: Remove an
> > unused variable). Changes from v1: Fix a typo in subject of patch 1/5,
> > add patch 5/5.> 
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > 32079e0f71d5..600366cb1aeb 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct
> > adapter *padapter, u8 dtim)> 
> > if (pwrpriv->dtim != dtim)
> > 
> > pwrpriv->dtim = dtim;
> > 
> > -   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv-
>pwr_mode >
> > PS_MODE_ACTIVE)) { +if ((pwrpriv->fw_current_in_ps_mode) &&
> > (pwrpriv->pwr_mode > PS_MODE_ACTIVE)) {
> The parentheses in the left argument of && can be dropped as well.
>
What about the parentheses of the right argument? I'm not sure: does '>' 
have precedence over '&&'? Doesn't it?

Thanks,

Fabio
> 
> julia
> 
> > u8 ps_mode = pwrpriv->pwr_mode;
> > 
> > rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, 
(u8
> > *)(_mode));
> > 
> > --
> > 2.31.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 view this discussion
> > on the web visit
> > https://groups.google.com/d/msgid/outreachy-kernel/20210411082908.3187
> > 6-5-fmdefrancesco%40gmail.com.






[Outreachy kernel] [PATCH v3 4/4] staging: rtl8723bs: core: Change a controlling expression

2021-04-11 Thread Fabio M. De Francesco
Change a controlling expression within an 'if' statement: don't compare
with 'true'.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 32079e0f71d5..600366cb1aeb 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-- 
2.31.1



[Outreachy kernel] [PATCH v3 3/4] staging: rtl8723bs: Change the type and use of a variable

2021-04-11 Thread Fabio M. De Francesco
Change the type of fw_current_in_ps_mode from u8 to bool, because
it is used everywhere as a bool and, accordingly, it should be
declared as a bool. Shorten the controlling expression of an 
'if' statement.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c 
b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 96fe172ced8d..8dc4dd8c6d4c 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter *padapter)
 
 void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
 {
-   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode == true) {
+   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
if (padapter->HalFunc.hal_dm_watchdog_in_lps)
padapter->HalFunc.hal_dm_watchdog_in_lps(padapter); /* 
this function caller is in interrupt context */
}
diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 0a48f1653be5..0767dbb84199 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -203,7 +203,7 @@ struct pwrctrl_priv {
u8 LpsIdleCount;
u8 power_mgnt;
u8 org_power_mgnt;
-   u8 fw_current_in_ps_mode;
+   bool fw_current_in_ps_mode;
unsigned long   DelayLPSLastTimeStamp;
s32 pnp_current_pwr_state;
u8 pnp_bstop_trx;
-- 
2.31.1



[Outreachy kernel] [PATCH v3 2/4] staging: rtl8723bs: include: Fix misspelled words in comments

2021-04-11 Thread Fabio M. De Francesco
Correct misspelled words in comments of several files. Issue (largely)
detected by checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h 
b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
index fb80901f0788..4b3a7c051630 100644
--- a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
+++ b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
@@ -34,7 +34,7 @@
 /*--Define Parameters---*/
 
 /*  */
-/*8192S Regsiter offset definition */
+/*8192S Register offset definition */
 /*  */
 
 /*  */
@@ -43,7 +43,7 @@
 /*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
 /*  3. RF register 0x00-2E */
 /*  4. Bit Mask for BB/RF register */
-/*  5. Other defintion for BB/RF R/W */
+/*  5. Other definition for BB/RF R/W */
 /*  */
 
 
@@ -137,7 +137,7 @@
 #definerFPGA0_AnalogParameter3 0x888   /*  Useless now 
*/
 #definerFPGA0_AnalogParameter4 0x88c
 
-#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver 
LSSI Readback */
+#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Transceiver 
LSSI Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
 #definerFPGA0_XC_LSSIReadBack  0x8a8
 #definerFPGA0_XD_LSSIReadBack  0x8ac
@@ -206,7 +206,7 @@
 #definerOFDM0_TRSWIsolation0xc0c
 
 #definerOFDM0_XARxAFE  0xc10  /* RxIQ DC 
offset, Rx digital filter, DC notch filter */
-#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ imblance 
matrix */
+#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ 
imbalance matrix */
 #definerOFDM0_XBRxAFE  0xc18
 #definerOFDM0_XBRxIQImbalance  0xc1c
 #definerOFDM0_XCRxAFE  0xc20
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h 
b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..57bb717327ce 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -187,7 +187,7 @@
); \
 }
 
-/*  Get the N-bytes aligment offset from the current length */
+/*  Get the N-bytes alignent offset from the current length */
 #define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : 
(((__Value + __Aligment - 1) / __Aligment) * __Aligment))
 
 #define TEST_FLAG(__Flag, __testFlag)  (((__Flag) & (__testFlag)) != 0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index 19da27fb5ddf..f1f588d38a60 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -424,7 +424,7 @@ struct adapter {
/*  The driver will show up the desired channel number when this 
flag is 1. */
u8 bNotifyChannelChange;
 
-   /* pbuddystruct adapter is used only in  two inteface case, (iface_nums 
=2 in struct dvobj_priv) */
+   /* pbuddystruct adapter is used only in two interface case, (iface_nums 
=2 in struct dvobj_priv) */
/* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
/* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
/* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to 
padapters[iface_id]  in struct dvobj_priv */
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h 
b/drivers/staging/rtl8723bs/include/hal_com.h
index a1e1b76b5d8a..6bcc443d59fb 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -158,7 +158,7 @@

[Outreachy kernel] [PATCH v3 1/4] staging: rtl8723bs: Remove camelcase in several files

2021-04-11 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") 
from the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index e94eb1138cf1..32079e0f71d5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..895997868c81 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 05e537cd4e48..364b96fe0a54 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -864,7 +864,7 @@ s32 rtw_regist

[Outreachy kernel] [PATCH v3 0/4] staging: rtl8723bs: Change several files of the driver

2021-04-11 Thread Fabio M. De Francesco
Remove camelcase, correct misspelled words in comments, change 
the type of a variable and its use, change comparisons with 'true'
in controlling expressions.

Changes from v2: Rewrite subject in patch 0/4; remove a patch from the
series because it had alreay been applied (rtl8723bs: core: Remove an unused 
variable).
Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

Fabio M. De Francesco (4):
  staging: rtl8723bs: Remove camelcase in several files
  staging: rtl8723bs: include: Fix misspelled words in comments
  staging: rtl8723bs: Change the type and use of a variable
  staging: rtl8723bs: core: Change a controlling expression

 drivers/staging/rtl8723bs/core/rtw_cmd.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c  |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c   |  6 ++--
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c  | 14 
 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  4 +--
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 23 files changed, 70 insertions(+), 70 deletions(-)

-- 
2.31.1



Re: [Outreachy kernel] [PATCH v2 0/5] staging: rtl8723bs: Change

2021-04-11 Thread Fabio M. De Francesco
On Sunday, April 11, 2021 8:39:18 AM CEST Greg KH wrote:
> On Sat, Apr 10, 2021 at 05:00:03PM +0200, Fabio M. De Francesco wrote:
> > Remove camelcase, correct misspelled words in comments, remove an
> > unused
> > variable, change the type of a variable and its use, change comparisons
> > with 'true' in controlling expressions.
> > 
> > Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.
> 
> The subject line above is very odd :(
>
True. I've just read the output of git format in /tmp and noticed that the 
line with the "subject" was broken in two different one. I think I had 
pressed return while editing.

I'm about to send that series again with v3.

In the while I noticed you sent a note to let me know that the you have  
added the patch titled "staging: rtl8723bs: core: Remove an unused 
variable" to your staging git tree. 

I think this could be a potential issue because the same patch is in the 
series that I have to send anew. I put that patch in the series because 
yesterday you wrote that the message with subject "Outreachy patches caught 
up on.", asking to rebase and resend.

However, I'm about to send v3 of this patchset. I have no idea whether or 
not you will have problems in applying that. If you have problems with it, 
please let me know.

Thanks,

Fabio





[Outreachy kernel] [PATCH v2 5/5] staging: rtl8723bs: core: Change a controlling expression

2021-04-10 Thread Fabio M. De Francesco
Change a controlling expression within an 'if' statement: don't compare
with 'true'.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: No changes. This related patch is new to this series.

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 32079e0f71d5..600366cb1aeb 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-- 
2.31.1



[Outreachy kernel] [PATCH v2 4/5] staging: rtl8723bs: Change the type and use of a variable

2021-04-10 Thread Fabio M. De Francesco
Change the type of fw_current_in_ps_mode from u8 to bool, because
it is used everywhere as a bool and, accordingly, it should be
declared as a bool. Shorten the controlling expression of an 'if' statement.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: No changes.

 drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c 
b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 96fe172ced8d..8dc4dd8c6d4c 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter *padapter)
 
 void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
 {
-   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode == true) {
+   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
if (padapter->HalFunc.hal_dm_watchdog_in_lps)
padapter->HalFunc.hal_dm_watchdog_in_lps(padapter); /* 
this function caller is in interrupt context */
}
diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 0a48f1653be5..0767dbb84199 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -203,7 +203,7 @@ struct pwrctrl_priv {
u8 LpsIdleCount;
u8 power_mgnt;
u8 org_power_mgnt;
-   u8 fw_current_in_ps_mode;
+   bool fw_current_in_ps_mode;
unsigned long   DelayLPSLastTimeStamp;
s32 pnp_current_pwr_state;
u8 pnp_bstop_trx;
-- 
2.31.1



[Outreachy kernel] [PATCH v2 3/5] staging: rtl8723bs: core: Remove an unused variable

2021-04-10 Thread Fabio M. De Francesco
Delete local variable "u8 sec_idx" because is declared and set, but never
used.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: No changes.

 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 2af66a18200d..3fd8a4261ea2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -628,7 +628,7 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, 
u16 *wapi_len)
 
 void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 
*wpa_ie, u16 *wpa_len)
 {
-   u8 authmode, sec_idx;
+   u8 authmode;
u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
uintcnt;
 
@@ -636,8 +636,6 @@ void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 
*rsn_len, u8 *wpa_ie
 
cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_);
 
-   sec_idx = 0;
-
while (cnt < in_len) {
authmode = in_ie[cnt];
 
-- 
2.31.1



[Outreachy kernel] [PATCH v2 2/5] staging: rtl8723bs: include: Fix misspelled words in comments

2021-04-10 Thread Fabio M. De Francesco
Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: No changes.

 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h 
b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
index fb80901f0788..4b3a7c051630 100644
--- a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
+++ b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
@@ -34,7 +34,7 @@
 /*--Define Parameters---*/
 
 /*  */
-/*8192S Regsiter offset definition */
+/*8192S Register offset definition */
 /*  */
 
 /*  */
@@ -43,7 +43,7 @@
 /*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
 /*  3. RF register 0x00-2E */
 /*  4. Bit Mask for BB/RF register */
-/*  5. Other defintion for BB/RF R/W */
+/*  5. Other definition for BB/RF R/W */
 /*  */
 
 
@@ -137,7 +137,7 @@
 #definerFPGA0_AnalogParameter3 0x888   /*  Useless now 
*/
 #definerFPGA0_AnalogParameter4 0x88c
 
-#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver 
LSSI Readback */
+#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Transceiver 
LSSI Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
 #definerFPGA0_XC_LSSIReadBack  0x8a8
 #definerFPGA0_XD_LSSIReadBack  0x8ac
@@ -206,7 +206,7 @@
 #definerOFDM0_TRSWIsolation0xc0c
 
 #definerOFDM0_XARxAFE  0xc10  /* RxIQ DC 
offset, Rx digital filter, DC notch filter */
-#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ imblance 
matrix */
+#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ 
imbalance matrix */
 #definerOFDM0_XBRxAFE  0xc18
 #definerOFDM0_XBRxIQImbalance  0xc1c
 #definerOFDM0_XCRxAFE  0xc20
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h 
b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..57bb717327ce 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -187,7 +187,7 @@
); \
 }
 
-/*  Get the N-bytes aligment offset from the current length */
+/*  Get the N-bytes alignent offset from the current length */
 #define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : 
(((__Value + __Aligment - 1) / __Aligment) * __Aligment))
 
 #define TEST_FLAG(__Flag, __testFlag)  (((__Flag) & (__testFlag)) != 0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index 19da27fb5ddf..f1f588d38a60 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -424,7 +424,7 @@ struct adapter {
/*  The driver will show up the desired channel number when this 
flag is 1. */
u8 bNotifyChannelChange;
 
-   /* pbuddystruct adapter is used only in  two inteface case, (iface_nums 
=2 in struct dvobj_priv) */
+   /* pbuddystruct adapter is used only in two interface case, (iface_nums 
=2 in struct dvobj_priv) */
/* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
/* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
/* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to 
padapters[iface_id]  in struct dvobj_priv */
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h 
b/drivers/staging/rtl8723bs/include/hal_com.h
index a1e1b76b5d8a..6bcc443d59fb 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -158,7 +158,7 @@
 (rate == DESC_RATEVHTSS2MCS6) ? "VHTSS2MCS6" : \
 (rate == DESC_RATEVHTSS2MCS7) ? "VHTSS2MCS7" : \
 (rate == DESC_RATEVHTSS2MCS8) ? "VHTSS2MCS8" : \
-(rate == DESC_RATEVHTSS2MCS9) ? "VHTSS2MCS9" : "UNKNOW"
+(rate == DESC_RATEVHTSS2MCS9) ? "VHTSS2MCS9&

[Outreachy kernel] [PATCH v2 1/5] staging: rtl8723bs: Remove camelcase in several files

2021-04-10 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: Fix a typo in "Subject".

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index e94eb1138cf1..32079e0f71d5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..895997868c81 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f7465cf90c46..481e2ad60853 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -864,7 +864,7 @@ s32 rtw_register_cmd_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, CMD_ALIVE);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
 

[Outreachy kernel] [PATCH v2 0/5] staging: rtl8723bs: Change

2021-04-10 Thread Fabio M. De Francesco
Remove camelcase, correct misspelled words in comments, remove an unused
variable, change the type of a variable and its use, change comparisons
with 'true' in controlling expressions.

Changes from v1: Fix a typo in subject of patch 1/5, add patch 5/5.

Fabio M. De Francesco (5):
  staging: rtl8723bs: Remove camelcase in several files
  staging: rtl8723bs: include: Fix misspelled words in comments
  staging: rtl8723bs: core: Remove an unused variable
  staging: rtl8723bs: Change the type and use of a variable
  staging: rtl8723bs: core: Change a controlling expression

 drivers/staging/rtl8723bs/core/rtw_cmd.c  |  2 +-
 .../staging/rtl8723bs/core/rtw_ieee80211.c|  4 +--
 drivers/staging/rtl8723bs/core/rtw_mlme.c |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c  |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c   |  6 ++--
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c  | 14 
 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  4 +--
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 24 files changed, 71 insertions(+), 73 deletions(-)

-- 
2.31.1



Re: [Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable

2021-04-10 Thread Fabio M. De Francesco
On Saturday, April 10, 2021 3:24:43 PM CEST Julia Lawall wrote:
> On Sat, 10 Apr 2021, Fabio M. De Francesco wrote:
> > On Saturday, April 10, 2021 2:12:28 PM CEST Julia Lawall wrote:
> > > On Sat, 10 Apr 2021, Fabio M. De Francesco wrote:
> > > > On Saturday, April 10, 2021 1:37:30 PM CEST Julia Lawall wrote:
> > > > > > That variable has global scope and is assigned at least in:
> > > > > What do you mean by global scope?  None of the following look
> > > > > like
> > > > > references to global variables.
> > > > > 
> > > > > julia
> > > > 
> > > > I just mean that fw_current_in_ps_mode is a field of a struct in a
> > > > .h
> > > > file included everywhere in this driver and that the functions whom
> > > > the following assignments belong to have not the "static" type
> > > > modifier.
> > > 
> > > OK, but a field in a structure is not a variable, and this is not
> > > what
> > > scope means.
> > 
> > You're right, a field in a structure is not a variable.
> > 
> > > int x;
> > > 
> > > outside of anything is a global variable (global scope).
> > > 
> > > int foo() {
> > > 
> > >   int x;
> > >   ...
> > > 
> > > }
> > > 
> > > Here x is a local variable.  Its scope is the body of the function.
> > > 
> > > int foo() {
> > > 
> > >   if (abc) {
> > >   
> > > int x;
> > > ...
> > >   
> > >   }
> > > 
> > > }
> > > 
> > > Here x is a local variable, but its scope is only in the if branch.
> > 
> > And you're right again: I needed a little refresh of my knowledge of C.
> > 
> > I've searched again in the code for the purpose of finding out if that
> > struct is initialized with global scope but I didn't find anything. I
> > didn't even find any dynamic allocation within functions that returns
> > pointers to that struct.
> > 
> > Therefore, according to Greg's request, I'll delete that stupid 'if'
> > statement in the patch series v2 that I'm about to submit.
> 
> I'm really not clear on why the if should be deleted.
> 
> julia
>
I'm supposed to delete it because of the review made by Greg. In a couple 
of previous messages he wrote:

"If this is only checked, how can it ever be true?  Who ever sets this 
value?"

and then:

"Just delete the variable from the structure entirely and when it is
used.".

However, like you, I'm not sure yet.

Thanks,

Fabio
> 
> > I've really appreciated your help.
> > 
> > Thanks,
> > 
> > Fabio
> > 
> > > julia
> > > 
> > > > Thanks,
> > > > 
> > > > Fabio
> > > > 
> > > > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:368:
> > > > > > pwrpriv->fw_current_in_ps_mode = false;
> > > > > > 
> > > > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:380:
> > > > > > pwrpriv->fw_current_in_ps_mode = true;
> > > > > > 
> > > > > > drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:433:
> > > > > > adapter_to_pwrctl(padapter)->fw_current_in_ps_mode = false;
> > > > > > 
> > > > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:981:
> > > > > > pwrctrlpriv->fw_current_in_ps_mode = false;






Re: [Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable

2021-04-10 Thread Fabio M. De Francesco
On Saturday, April 10, 2021 2:12:28 PM CEST Julia Lawall wrote:
> On Sat, 10 Apr 2021, Fabio M. De Francesco wrote:
> > On Saturday, April 10, 2021 1:37:30 PM CEST Julia Lawall wrote:
> > > > That variable has global scope and is assigned at least in:
> > > What do you mean by global scope?  None of the following look like
> > > references to global variables.
> > > 
> > > julia
> > 
> > I just mean that fw_current_in_ps_mode is a field of a struct in a .h
> > file included everywhere in this driver and that the functions whom
> > the following assignments belong to have not the "static" type
> > modifier.
> OK, but a field in a structure is not a variable, and this is not what
> scope means.
>
You're right, a field in a structure is not a variable.
> 
> int x;
> 
> outside of anything is a global variable (global scope).
> 
> int foo() {
>   int x;
>   ...
> }
> 
> Here x is a local variable.  Its scope is the body of the function.
> 
> int foo() {
>   if (abc) {
> int x;
> ...
>   }
> }
> 
> Here x is a local variable, but its scope is only in the if branch.
>
And you're right again: I needed a little refresh of my knowledge of C.

I've searched again in the code for the purpose of finding out if that 
struct is initialized with global scope but I didn't find anything. I 
didn't even find any dynamic allocation within functions that returns 
pointers to that struct.

Therefore, according to Greg's request, I'll delete that stupid 'if' 
statement in the patch series v2 that I'm about to submit.

I've really appreciated your help.

Thanks,

Fabio
> 
> julia
> 
> > Thanks,
> > 
> > Fabio
> > 
> > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:368:
> > > > pwrpriv->fw_current_in_ps_mode = false;
> > > > 
> > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:380:
> > > > pwrpriv->fw_current_in_ps_mode = true;
> > > > 
> > > > drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:433:
> > > > adapter_to_pwrctl(padapter)->fw_current_in_ps_mode = false;
> > > > 
> > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:981:
> > > > pwrctrlpriv->fw_current_in_ps_mode = false;






Re: [Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable

2021-04-10 Thread Fabio M. De Francesco
On Saturday, April 10, 2021 1:37:30 PM CEST Julia Lawall wrote:
> > That variable has global scope and is assigned at least in:
> What do you mean by global scope?  None of the following look like
> references to global variables.
> 
> julia
I just mean that fw_current_in_ps_mode is a field of a struct in a .h file 
included everywhere in this driver and that the functions whom the 
following assignments belong to have not the "static" type modifier.

Thanks,

Fabio
> 
> > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:368:
> > pwrpriv->fw_current_in_ps_mode = false;
> > 
> > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:380:
> > pwrpriv->fw_current_in_ps_mode = true;
> > 
> > drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:433:
> > adapter_to_pwrctl(padapter)->fw_current_in_ps_mode = false;
> > 
> > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:981:
> > pwrctrlpriv->fw_current_in_ps_mode = false;






Re: [Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable

2021-04-10 Thread Fabio M. De Francesco
On Saturday, April 10, 2021 1:03:34 PM CEST Greg KH wrote:
> On Sat, Apr 10, 2021 at 12:58:06PM +0200, Fabio M. De Francesco wrote:
> > On Saturday, April 10, 2021 12:31:27 PM CEST Greg KH wrote:
> > > On Sat, Apr 10, 2021 at 11:56:48AM +0200, Fabio M. De Francesco 
wrote:
> > > > On Saturday, April 10, 2021 11:31:16 AM CEST Greg KH wrote:
> > > > > On Sat, Apr 10, 2021 at 11:22:32AM +0200, Fabio M. De Francesco
> > 
> > wrote:
> > > > > > Change the type of fw_current_in_ps_mode from u8 to bool,
> > > > > > because
> > > > > > it is used everywhere as a bool and, accordingly, it should be
> > > > > > declared as a bool. Shorten the controlling
> > > > > > expression of an 'if' statement.
> > > > > > 
> > > > > > Signed-off-by: Fabio M. De Francesco 
> > > > > > ---
> > > > > > 
> > > > > >  drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
> > > > > >  drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
> > > > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > > > b/drivers/staging/rtl8723bs/hal/hal_intf.c index
> > > > > > 96fe172ced8d..8dc4dd8c6d4c 100644
> > > > > > --- a/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > > > +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > > > @@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter
> > > > > > *padapter)
> > > > > > 
> > > > > >  void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
> > > > > >  {
> > > > > > 
> > > > > > -   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode ==
> > 
> > true)
> > 
> > > > {
> > > > 
> > > > > > +   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
> > > > > > 
> > > > > > if (padapter->HalFunc.hal_dm_watchdog_in_lps)
> > > > > > 
> > > > > > padapter-
> > > > >
> > > > >HalFunc.hal_dm_watchdog_in_lps(padapter); /* this
> > > > >
> > > > > > function caller is in interrupt 
context
> > > > 
> > > > */>
> > > > 
> > > > > > }
> > > > > > 
> > > > > > diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > > > b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index
> > > > > > 0a48f1653be5..0767dbb84199 100644
> > > > > > --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > > > +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > > > @@ -203,7 +203,7 @@ struct pwrctrl_priv {
> > > > > > 
> > > > > > u8 LpsIdleCount;
> > > > > > u8 power_mgnt;
> > > > > > u8 org_power_mgnt;
> > > > > > 
> > > > > > -   u8 fw_current_in_ps_mode;
> > > > > > +   bool fw_current_in_ps_mode;
> > > > > > 
> > > > > > unsigned long   DelayLPSLastTimeStamp;
> > > > > > s32 pnp_current_pwr_state;
> > > > > > u8 pnp_bstop_trx;
> > > > > 
> > > > > If this is only checked, how can it ever be true?  Who ever sets
> > > > > this
> > > > > value?
> > > > 
> > > > You're right. It is not set, therefore the "if" control expression
> > > > cannot ever be "true".
> > > > 
> > > > Can I delete this statement in a new patch? Or you prefer I send
> > > > the
> > > > whole series again with this change in patch 4/4?
> > > 
> > > Just delete the variable from the structure entirely and when it is
> > > used.
> > 
> > I've read the code of the function whom that 'if' statement belongs to.
> > This function takes a pointer whose name is 'padapter' and this is has
> > global scope. I think that since fw_current_in_ps_mode is dereferenced
> > by the function adapter_to_pwrctl(padapter) it can and is indeed
> > initialized and modified in some other files of the driver.
> 
> Where does that happen, and why did the build not break when you changed
> the variable name?  
>
The build didn't break because I changed the name of that variable 
everywhere it is used in the driver. This patch is against all the affected 
files of each subdirectory of staging/rtl8723bs.
>
> Is the whole variable assigned to a specific
> location in memory in the device?  Where is it initialized?
>
That variable has global scope and is assigned at least in:

drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:368:   
pwrpriv->fw_current_in_ps_mode = false;

drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:380:   
pwrpriv->fw_current_in_ps_mode = true;

drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:433:  
adapter_to_pwrctl(padapter)->fw_current_in_ps_mode = false;

drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:981:   
pwrctrlpriv->fw_current_in_ps_mode = false;

Thanks,

Fabio
> 
> > That's why I'll leave the if statement as is now. If I am wrong there's
> > time to change it later in a future patch.
> 
> Don't change obviously wrong code, we can clean it up properly :)
> 
> thanks,
> 
> greg k-h






Re: [Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable

2021-04-10 Thread Fabio M. De Francesco
On Saturday, April 10, 2021 12:31:27 PM CEST Greg KH wrote:
> On Sat, Apr 10, 2021 at 11:56:48AM +0200, Fabio M. De Francesco wrote:
> > On Saturday, April 10, 2021 11:31:16 AM CEST Greg KH wrote:
> > > On Sat, Apr 10, 2021 at 11:22:32AM +0200, Fabio M. De Francesco 
wrote:
> > > > Change the type of fw_current_in_ps_mode from u8 to bool, because
> > > > it is used everywhere as a bool and, accordingly, it should be
> > > > declared as a bool. Shorten the controlling
> > > > expression of an 'if' statement.
> > > > 
> > > > Signed-off-by: Fabio M. De Francesco 
> > > > ---
> > > > 
> > > >  drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
> > > >  drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
> > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > b/drivers/staging/rtl8723bs/hal/hal_intf.c index
> > > > 96fe172ced8d..8dc4dd8c6d4c 100644
> > > > --- a/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > @@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter
> > > > *padapter)
> > > > 
> > > >  void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
> > > >  {
> > > > 
> > > > -   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode == 
true)
> > 
> > {
> > 
> > > > +   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
> > > > 
> > > > if (padapter->HalFunc.hal_dm_watchdog_in_lps)
> > > > 
> > > > padapter-
> > >
> > >HalFunc.hal_dm_watchdog_in_lps(padapter); /* this
> > >
> > > > function caller is in interrupt context
> > 
> > */>
> > 
> > > > }
> > > > 
> > > > diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index
> > > > 0a48f1653be5..0767dbb84199 100644
> > > > --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > @@ -203,7 +203,7 @@ struct pwrctrl_priv {
> > > > 
> > > > u8 LpsIdleCount;
> > > > u8 power_mgnt;
> > > > u8 org_power_mgnt;
> > > > 
> > > > -   u8 fw_current_in_ps_mode;
> > > > +   bool fw_current_in_ps_mode;
> > > > 
> > > > unsigned long   DelayLPSLastTimeStamp;
> > > > s32 pnp_current_pwr_state;
> > > > u8 pnp_bstop_trx;
> > > 
> > > If this is only checked, how can it ever be true?  Who ever sets this
> > > value?
> > 
> > You're right. It is not set, therefore the "if" control expression
> > cannot ever be "true".
> > 
> > Can I delete this statement in a new patch? Or you prefer I send the
> > whole series again with this change in patch 4/4?
> 
> Just delete the variable from the structure entirely and when it is
> used.
>
I've read the code of the function whom that 'if' statement belongs to. 
This function takes a pointer whose name is 'padapter' and this is has 
global scope. I think that since fw_current_in_ps_mode is dereferenced by 
the function adapter_to_pwrctl(padapter) it can and is indeed initialized 
and modified in some other files of the driver.

That's why I'll leave the if statement as is now. If I am wrong there's 
time to change it later in a future patch.

Thanks for your kind review,

Fabio
>
> 
> thanks,
> 
> greg k-h






Re: [Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable

2021-04-10 Thread Fabio M. De Francesco
On Saturday, April 10, 2021 11:31:16 AM CEST Greg KH wrote:
> On Sat, Apr 10, 2021 at 11:22:32AM +0200, Fabio M. De Francesco wrote:
> > Change the type of fw_current_in_ps_mode from u8 to bool, because
> > it is used everywhere as a bool and, accordingly, it should be
> > declared as a bool. Shorten the controlling
> > expression of an 'if' statement.
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
> >  drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c
> > b/drivers/staging/rtl8723bs/hal/hal_intf.c index
> > 96fe172ced8d..8dc4dd8c6d4c 100644
> > --- a/drivers/staging/rtl8723bs/hal/hal_intf.c
> > +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
> > @@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter *padapter)
> > 
> >  void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
> >  {
> > 
> > -   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode == true) 
{
> > +   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
> > 
> > if (padapter->HalFunc.hal_dm_watchdog_in_lps)
> > 
> > padapter-
>HalFunc.hal_dm_watchdog_in_lps(padapter); /* this
> > function caller is in interrupt context 
*/> 
> > }
> > 
> > diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index
> > 0a48f1653be5..0767dbb84199 100644
> > --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > @@ -203,7 +203,7 @@ struct pwrctrl_priv {
> > 
> > u8 LpsIdleCount;
> > u8 power_mgnt;
> > u8 org_power_mgnt;
> > 
> > -   u8 fw_current_in_ps_mode;
> > +   bool fw_current_in_ps_mode;
> > 
> > unsigned long   DelayLPSLastTimeStamp;
> > s32 pnp_current_pwr_state;
> > u8 pnp_bstop_trx;
> 
> If this is only checked, how can it ever be true?  Who ever sets this
> value?
>
You're right. It is not set, therefore the "if" control expression cannot 
ever be "true".

Can I delete this statement in a new patch? Or you prefer I send the whole 
series again with this change in patch 4/4?

Thanks,

Fabio
>
> thanks,
> 
> greg k-h






Re: [Outreachy kernel] [PATCH v7 1/3] staging: rtl8723bs: Remove camelcase in several files

2021-04-10 Thread Fabio M. De Francesco
On Saturday, April 10, 2021 11:32:00 AM CEST Greg KH wrote:
> On Sat, Apr 10, 2021 at 11:22:29AM +0200, Fabio M. De Francesco wrote:
> > Remove camelcase in bFwCurrentInPSMode, a variable used by code
> > of several subdirectories/files of the driver. Issue detected by
> > checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
> > the beginning of the name.
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> 
> Why is there a "v7" in this subject line, but not all the other lines?
> 

It's v7 because only this file (and not the others in the series had six 
previous versions that you dropped. Please remind that it was already sent 
alone (not in a series) several times. The changelog is in the body.

Should I drop that "v7" and the changelog, and the send the patch series 
anew?

Please, I'm waiting your instructions on what to do.

Thanks,

Fabio
>
> It should be in all of them, including the 0/X email, git format-patch
> will create it automatically if you tell it to.
> 
> thanks,
> 
> greg k-h






[Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable

2021-04-10 Thread Fabio M. De Francesco
Change the type of fw_current_in_ps_mode from u8 to bool, because
it is used everywhere as a bool and, accordingly, it should be
declared as a bool. Shorten the controlling
expression of an 'if' statement.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c 
b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 96fe172ced8d..8dc4dd8c6d4c 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter *padapter)
 
 void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
 {
-   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode == true) {
+   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
if (padapter->HalFunc.hal_dm_watchdog_in_lps)
padapter->HalFunc.hal_dm_watchdog_in_lps(padapter); /* 
this function caller is in interrupt context */
}
diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 0a48f1653be5..0767dbb84199 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -203,7 +203,7 @@ struct pwrctrl_priv {
u8 LpsIdleCount;
u8 power_mgnt;
u8 org_power_mgnt;
-   u8 fw_current_in_ps_mode;
+   bool fw_current_in_ps_mode;
unsigned long   DelayLPSLastTimeStamp;
s32 pnp_current_pwr_state;
u8 pnp_bstop_trx;
-- 
2.31.1



[Outreachy kernel] [PATCH 3/4] staging: rtl8723bs: core: Remove an unused variable

2021-04-10 Thread Fabio M. De Francesco
Delete local variable "u8 sec_idx" because it is declared and
initialised, but never used.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 2af66a18200d..3fd8a4261ea2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -628,7 +628,7 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, 
u16 *wapi_len)
 
 void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 
*wpa_ie, u16 *wpa_len)
 {
-   u8 authmode, sec_idx;
+   u8 authmode;
u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
uintcnt;
 
@@ -636,8 +636,6 @@ void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 
*rsn_len, u8 *wpa_ie
 
cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_);
 
-   sec_idx = 0;
-
while (cnt < in_len) {
authmode = in_ie[cnt];
 
-- 
2.31.1



[Outreachy kernel] [PATCH 2/4] staging: rtl8723bs: include: Fix misspelled words in comments

2021-04-10 Thread Fabio M. De Francesco
Correct misspelled words in comments of several files. Issue (largely)
detected by checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: Substitute "mispelled" with "misspelled" in the Subject.

 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h 
b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
index fb80901f0788..4b3a7c051630 100644
--- a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
+++ b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
@@ -34,7 +34,7 @@
 /*--Define Parameters---*/
 
 /*  */
-/*8192S Regsiter offset definition */
+/*8192S Register offset definition */
 /*  */
 
 /*  */
@@ -43,7 +43,7 @@
 /*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
 /*  3. RF register 0x00-2E */
 /*  4. Bit Mask for BB/RF register */
-/*  5. Other defintion for BB/RF R/W */
+/*  5. Other definition for BB/RF R/W */
 /*  */
 
 
@@ -137,7 +137,7 @@
 #definerFPGA0_AnalogParameter3 0x888   /*  Useless now 
*/
 #definerFPGA0_AnalogParameter4 0x88c
 
-#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver 
LSSI Readback */
+#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Transceiver 
LSSI Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
 #definerFPGA0_XC_LSSIReadBack  0x8a8
 #definerFPGA0_XD_LSSIReadBack  0x8ac
@@ -206,7 +206,7 @@
 #definerOFDM0_TRSWIsolation0xc0c
 
 #definerOFDM0_XARxAFE  0xc10  /* RxIQ DC 
offset, Rx digital filter, DC notch filter */
-#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ imblance 
matrix */
+#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ 
imbalance matrix */
 #definerOFDM0_XBRxAFE  0xc18
 #definerOFDM0_XBRxIQImbalance  0xc1c
 #definerOFDM0_XCRxAFE  0xc20
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h 
b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..57bb717327ce 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -187,7 +187,7 @@
); \
 }
 
-/*  Get the N-bytes aligment offset from the current length */
+/*  Get the N-bytes alignent offset from the current length */
 #define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : 
(((__Value + __Aligment - 1) / __Aligment) * __Aligment))
 
 #define TEST_FLAG(__Flag, __testFlag)  (((__Flag) & (__testFlag)) != 0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index 19da27fb5ddf..f1f588d38a60 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -424,7 +424,7 @@ struct adapter {
/*  The driver will show up the desired channel number when this 
flag is 1. */
u8 bNotifyChannelChange;
 
-   /* pbuddystruct adapter is used only in  two inteface case, (iface_nums 
=2 in struct dvobj_priv) */
+   /* pbuddystruct adapter is used only in two interface case, (iface_nums 
=2 in struct dvobj_priv) */
/* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
/* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
/* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to 
padapters[iface_id]  in struct dvobj_priv */
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h 
b/drivers/staging/rtl8723bs/include/hal_com.h
index a1e1b76b5d8a..6bcc443d59fb 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -158,7 +158,7 @@
 (rate == DESC_RATEVHTSS2MCS6) ? "VHTSS2MCS6" : \
 (rate == DESC_RATEVHTSS2MCS7) ? "VHTSS2MCS7" : \
 (rate ==

[Outreachy kernel] [PATCH v7 1/3] staging: rtl8723bs: Remove camelcase in several files

2021-04-10 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v6: Edit against the wrong patch (again).
Changes from v5: Edit against the wrong patch.
Changes from v4: Mention the removal of the initial "b" in log message.
Changes from v3: Fix errors in the format of the patch.
Changes from v2: Remove unnecessary comment. Shortened a function name.
Changes from v1: No changes to the code but only to the subject for the
purpose to differentiate this patch because other removes of camelcase
have been made in other files of the same directory.

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index e94eb1138cf1..32079e0f71d5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..895997868c81 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f7465cf90c46..481e2ad60853 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl

[Outreachy kernel] [PATCH 0/4] staging: rtl8723bs: Change several files of the driver

2021-04-10 Thread Fabio M. De Francesco
Remove camelcase, correct misspelled words in comments, remove an unused
variable, change type and use of another variable. These changes affect 
files in different subdirectories of this driver.

Fabio M. De Francesco (4):
  staging: rtl8723bs: Remove camelcase in several files
  staging: rtl8723bs: include: Fix misspelled words in comments
  staging: rtl8723bs: core: Remove an unused variable
  staging: rtl8723bs: Change the type and use of a variable

 drivers/staging/rtl8723bs/core/rtw_cmd.c  |  2 +-
 .../staging/rtl8723bs/core/rtw_ieee80211.c|  4 +--
 drivers/staging/rtl8723bs/core/rtw_mlme.c |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c  |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c   |  6 ++--
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c  | 14 
 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  4 +--
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 24 files changed, 71 insertions(+), 73 deletions(-)

-- 
2.31.1



Re: [Outreachy kernel] [Patch 0/3]

2021-04-10 Thread Fabio M. De Francesco
On Saturday, April 10, 2021 9:29:29 AM CEST Greg KH wrote:
> On Fri, Apr 09, 2021 at 06:29:59PM +0200, Fabio M. De Francesco wrote:
> > This patch series removes camelcases, changes the type and use of a
> > variable, and correct misspelled words.
> > 
> > Patch 1/3: staging: rtl8723bs: Remove camelcase in several files
> > 
> > drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
> > drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
> > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
> > drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
> > drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
> > .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
> > drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
> > .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
> > 8 files changed, 24 insertions(+), 24 deletions(-)
> > 
> > Patch 2/3: staging: rtl8723bs: Change the type and use of a variable
> > 
> > drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
> > 
> >  drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > Patch 3/3: staging: rtl8723bs: include: Fix misspelled words in
> > comments
> > 
> > .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
> > 
> >  .../staging/rtl8723bs/include/basic_types.h   |  2 +-
> >  drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
> >  drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
> >  .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
> >  drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
> >  .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
> >  drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
> >  drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
> >  .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
> >  drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
> >  .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
> >  drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
> >  drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
> >  drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
> >  drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
> >  16 files changed, 46 insertions(+), 46 deletions(-)
> > 
> > Fabio M. De Francesco
> 
> I have no idea how you created this patch series, but I do not think it
> worked well :(
> 
> Please use our standard tools, that do this all for you automatically,
>
Apart from the fact that I forgot to save the subject, I didn't know that 
there are standard tools for doing Patch 0/N. Therefore I thought to make  
an email message that contained the information about the patch series.

I was wrong, sorry. I have to research this topic in the git manual or 
somewhere else.

Thanks,

Fabio
>
> and send them out in a series of emails that have a proper subject line
> (look at what you used here...) and are properly "threaded".
> 
> thanks,
> 
> greg k-h






[Outreachy kernel] [PATCH] staging: rtl8723bs: core: Remove an unused variable

2021-04-09 Thread Fabio M. De Francesco
Delete local variable "u8 sec_idx" because is declared and set, but never
used.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 2af66a18200d..3fd8a4261ea2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -628,7 +628,7 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, 
u16 *wapi_len)
 
 void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 
*wpa_ie, u16 *wpa_len)
 {
-   u8 authmode, sec_idx;
+   u8 authmode;
u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
uintcnt;
 
@@ -636,8 +636,6 @@ void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 
*rsn_len, u8 *wpa_ie
 
cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_);
 
-   sec_idx = 0;
-
while (cnt < in_len) {
authmode = in_ie[cnt];
 
-- 
2.31.1



Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Change the type and use of a variable

2021-04-09 Thread Fabio M. De Francesco
On Friday, April 9, 2021 4:12:37 PM CEST Greg KH wrote:
> On Thu, Apr 08, 2021 at 01:19:42PM +0200, Fabio M. De Francesco wrote:
> > Change the type of fw_current_in_ps_mode from u8 to bool, because
> > it is used everywhere as a bool and, accordingly, it should be
> > declared as a bool. Shorten the controlling
> > expression of an 'if' statement.
> > 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> >  drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
> >  drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> I now have 3 patches, I think, for this same driver, from you, and I
> have no idea what order they should be applied in.
> 
> So I'm going to drop them all.  Can you please resend me a patch series,
> with all of the outstanding patches sent to me from you that I have not
> applied yet, so that I know which ones to look at and what order to
> apply them in?
>
I just sent in the series of patches you requested. Hope the work is as you 
expected. 

Thanks,

Fabio
> 
> thanks,
> 
> greg k-h






[Outreachy kernel] [PATCH v2 3/3] staging: rtl8723bs: include: Fix misspelled words in comments

2021-04-09 Thread Fabio M. De Francesco
Correct misspelled words in comments of several files. Issue (largely)
detected by checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: Substitute "mispelled" with "misspelled" in Subject.

 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h 
b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
index fb80901f0788..4b3a7c051630 100644
--- a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
+++ b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
@@ -34,7 +34,7 @@
 /*--Define Parameters---*/
 
 /*  */
-/*8192S Regsiter offset definition */
+/*8192S Register offset definition */
 /*  */
 
 /*  */
@@ -43,7 +43,7 @@
 /*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
 /*  3. RF register 0x00-2E */
 /*  4. Bit Mask for BB/RF register */
-/*  5. Other defintion for BB/RF R/W */
+/*  5. Other definition for BB/RF R/W */
 /*  */
 
 
@@ -137,7 +137,7 @@
 #definerFPGA0_AnalogParameter3 0x888   /*  Useless now 
*/
 #definerFPGA0_AnalogParameter4 0x88c
 
-#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver 
LSSI Readback */
+#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Transceiver 
LSSI Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
 #definerFPGA0_XC_LSSIReadBack  0x8a8
 #definerFPGA0_XD_LSSIReadBack  0x8ac
@@ -206,7 +206,7 @@
 #definerOFDM0_TRSWIsolation0xc0c
 
 #definerOFDM0_XARxAFE  0xc10  /* RxIQ DC 
offset, Rx digital filter, DC notch filter */
-#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ imblance 
matrix */
+#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ 
imbalance matrix */
 #definerOFDM0_XBRxAFE  0xc18
 #definerOFDM0_XBRxIQImbalance  0xc1c
 #definerOFDM0_XCRxAFE  0xc20
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h 
b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..57bb717327ce 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -187,7 +187,7 @@
); \
 }
 
-/*  Get the N-bytes aligment offset from the current length */
+/*  Get the N-bytes alignent offset from the current length */
 #define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : 
(((__Value + __Aligment - 1) / __Aligment) * __Aligment))
 
 #define TEST_FLAG(__Flag, __testFlag)  (((__Flag) & (__testFlag)) != 0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index cec8d5ac0e2e..c97e6421a0db 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -425,7 +425,7 @@ struct adapter {
/*  The driver will show up the desired channel number when this 
flag is 1. */
u8 bNotifyChannelChange;
 
-   /* pbuddystruct adapter is used only in  two inteface case, (iface_nums 
=2 in struct dvobj_priv) */
+   /* pbuddystruct adapter is used only in two interface case, (iface_nums 
=2 in struct dvobj_priv) */
/* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
/* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
/* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to 
padapters[iface_id]  in struct dvobj_priv */
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h 
b/drivers/staging/rtl8723bs/include/hal_com.h
index a1e1b76b5d8a..6bcc443d59fb 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -158,7 +158,7 @@
 (rate == DESC_RATEVHTSS2MCS6) ? "VHTSS2MCS6" : \
 (rate == DESC_RATEVHTSS2MCS7) ? "VHTSS2MCS7" : \
 (rate ==

[Outreachy kernel] [PATCH 2/3] staging: rtl8723bs: Change the type and use of a variable

2021-04-09 Thread Fabio M. De Francesco
Change the type of fw_current_in_ps_mode from u8 to bool, because
it is used everywhere as a bool and, accordingly, it should be
declared as a bool. Shorten the controlling
expression of an 'if' statement.

Signed-off-by: Fabio M. De Francesco 
---
 drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c 
b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 96fe172ced8d..8dc4dd8c6d4c 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter *padapter)
 
 void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
 {
-   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode == true) {
+   if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
if (padapter->HalFunc.hal_dm_watchdog_in_lps)
padapter->HalFunc.hal_dm_watchdog_in_lps(padapter); /* 
this function caller is in interrupt context */
}
diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 5450d20b44a6..c03ae33b0aa6 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -203,7 +203,7 @@ struct pwrctrl_priv {
u8 LpsIdleCount;
u8 power_mgnt;
u8 org_power_mgnt;
-   u8 fw_current_in_ps_mode;
+   bool fw_current_in_ps_mode;
unsigned long   DelayLPSLastTimeStamp;
s32 pnp_current_pwr_state;
u8 pnp_bstop_trx;
-- 
2.31.1



[Outreachy kernel] [Resend Patch 0/3] staging: rtl8723bs: Patchset for rtl8723bs

2021-04-09 Thread Fabio M. De Francesco
This patch series removes camelcase, changes the type and use of a 
variable, and correct misspelled words.

Patch 1/3: staging: rtl8723bs: Remove camelcase in several files

drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
.../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
.../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
8 files changed, 24 insertions(+), 24 deletions(-)

Patch 2/3: staging: rtl8723bs: Change the type and use of a variable

drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch 3/3: staging: rtl8723bs: include: Fix misspelled words in comments

.../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

Fabio M. De Francesco








[Outreachy kernel] [PATCH v7 1/3] staging: rtl8723bs: Remove camelcase in several files

2021-04-09 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v6: Edit against the wrong patch (again).
Changes from v5: Edit against the wrong patch.
Changes from v4: Mention the removal of the initial "b" in log message.
Changes from v3: Fix errors in the format of the patch.
Changes from v2: Remove unnecessary comment. Shortened a function name.
Changes from v1: No changes to the code but only to the subject for the
purpose to differentiate this patch because other removes of camelcase
have been made in other files of the same directory.

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index baf8b1e0f43c..feb53b8c0ff2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..895997868c81 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f7465cf90c46..481e2ad60853 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl

[Outreachy kernel] [Patch 0/3]

2021-04-09 Thread Fabio M. De Francesco
This patch series removes camelcases, changes the type and use of a 
variable, and correct misspelled words.

Patch 1/3: staging: rtl8723bs: Remove camelcase in several files

drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
.../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
.../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
8 files changed, 24 insertions(+), 24 deletions(-)

Patch 2/3: staging: rtl8723bs: Change the type and use of a variable

drivers/staging/rtl8723bs/hal/hal_intf.c| 2 +-
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch 3/3: staging: rtl8723bs: include: Fix misspelled words in comments

.../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

Fabio M. De Francesco





[Outreachy kernel] [PATCH v2] staging: rtl8723bs: include: Fix misspelled words in comments

2021-04-09 Thread Fabio M. De Francesco
Correct misspelled words in comments of several files. Issue (largely)
detected by checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v1: Substitute "mispelled" with "misspelled" in Subject

 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h 
b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
index fb80901f0788..4b3a7c051630 100644
--- a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
+++ b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
@@ -34,7 +34,7 @@
 /*--Define Parameters---*/
 
 /*  */
-/*8192S Regsiter offset definition */
+/*8192S Register offset definition */
 /*  */
 
 /*  */
@@ -43,7 +43,7 @@
 /*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
 /*  3. RF register 0x00-2E */
 /*  4. Bit Mask for BB/RF register */
-/*  5. Other defintion for BB/RF R/W */
+/*  5. Other definition for BB/RF R/W */
 /*  */
 
 
@@ -137,7 +137,7 @@
 #definerFPGA0_AnalogParameter3 0x888   /*  Useless now 
*/
 #definerFPGA0_AnalogParameter4 0x88c
 
-#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver 
LSSI Readback */
+#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Transceiver 
LSSI Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
 #definerFPGA0_XC_LSSIReadBack  0x8a8
 #definerFPGA0_XD_LSSIReadBack  0x8ac
@@ -206,7 +206,7 @@
 #definerOFDM0_TRSWIsolation0xc0c
 
 #definerOFDM0_XARxAFE  0xc10  /* RxIQ DC 
offset, Rx digital filter, DC notch filter */
-#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ imblance 
matrix */
+#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ 
imbalance matrix */
 #definerOFDM0_XBRxAFE  0xc18
 #definerOFDM0_XBRxIQImbalance  0xc1c
 #definerOFDM0_XCRxAFE  0xc20
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h 
b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..57bb717327ce 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -187,7 +187,7 @@
); \
 }
 
-/*  Get the N-bytes aligment offset from the current length */
+/*  Get the N-bytes alignent offset from the current length */
 #define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : 
(((__Value + __Aligment - 1) / __Aligment) * __Aligment))
 
 #define TEST_FLAG(__Flag, __testFlag)  (((__Flag) & (__testFlag)) != 0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index cec8d5ac0e2e..c97e6421a0db 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -425,7 +425,7 @@ struct adapter {
/*  The driver will show up the desired channel number when this 
flag is 1. */
u8 bNotifyChannelChange;
 
-   /* pbuddystruct adapter is used only in  two inteface case, (iface_nums 
=2 in struct dvobj_priv) */
+   /* pbuddystruct adapter is used only in two interface case, (iface_nums 
=2 in struct dvobj_priv) */
/* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
/* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
/* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to 
padapters[iface_id]  in struct dvobj_priv */
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h 
b/drivers/staging/rtl8723bs/include/hal_com.h
index a1e1b76b5d8a..6bcc443d59fb 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -158,7 +158,7 @@
 (rate == DESC_RATEVHTSS2MCS6) ? "VHTSS2MCS6" : \
 (rate == DESC_RATEVHTSS2MCS7) ? "VHTSS2MCS7" : \
 (rate ==

[Outreachy kernel] [PATCH] staging: rtl8723bs: include: Correct mispelled words in comments

2021-04-09 Thread Fabio M. De Francesco
Correct misspelled words in comments of several files. Issue (largely)
detected by checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---
 .../rtl8723bs/include/Hal8192CPhyReg.h|  8 ++---
 .../staging/rtl8723bs/include/basic_types.h   |  2 +-
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  2 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 34 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  2 +-
 .../staging/rtl8723bs/include/hal_pwr_seq.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  6 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 18 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 drivers/staging/rtl8723bs/include/rtw_mp.h|  2 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/include/rtw_recv.h  |  4 +--
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |  2 +-
 drivers/staging/rtl8723bs/include/sta_info.h  |  2 +-
 drivers/staging/rtl8723bs/include/wifi.h  |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h 
b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
index fb80901f0788..4b3a7c051630 100644
--- a/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
+++ b/drivers/staging/rtl8723bs/include/Hal8192CPhyReg.h
@@ -34,7 +34,7 @@
 /*--Define Parameters---*/
 
 /*  */
-/*8192S Regsiter offset definition */
+/*8192S Register offset definition */
 /*  */
 
 /*  */
@@ -43,7 +43,7 @@
 /*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
 /*  3. RF register 0x00-2E */
 /*  4. Bit Mask for BB/RF register */
-/*  5. Other defintion for BB/RF R/W */
+/*  5. Other definition for BB/RF R/W */
 /*  */
 
 
@@ -137,7 +137,7 @@
 #definerFPGA0_AnalogParameter3 0x888   /*  Useless now 
*/
 #definerFPGA0_AnalogParameter4 0x88c
 
-#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver 
LSSI Readback */
+#definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Transceiver 
LSSI Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
 #definerFPGA0_XC_LSSIReadBack  0x8a8
 #definerFPGA0_XD_LSSIReadBack  0x8ac
@@ -206,7 +206,7 @@
 #definerOFDM0_TRSWIsolation0xc0c
 
 #definerOFDM0_XARxAFE  0xc10  /* RxIQ DC 
offset, Rx digital filter, DC notch filter */
-#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ imblance 
matrix */
+#definerOFDM0_XARxIQImbalance  0xc14  /* RxIQ 
imbalance matrix */
 #definerOFDM0_XBRxAFE  0xc18
 #definerOFDM0_XBRxIQImbalance  0xc1c
 #definerOFDM0_XCRxAFE  0xc20
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h 
b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..57bb717327ce 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -187,7 +187,7 @@
); \
 }
 
-/*  Get the N-bytes aligment offset from the current length */
+/*  Get the N-bytes alignent offset from the current length */
 #define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : 
(((__Value + __Aligment - 1) / __Aligment) * __Aligment))
 
 #define TEST_FLAG(__Flag, __testFlag)  (((__Flag) & (__testFlag)) != 0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index cec8d5ac0e2e..c97e6421a0db 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -425,7 +425,7 @@ struct adapter {
/*  The driver will show up the desired channel number when this 
flag is 1. */
u8 bNotifyChannelChange;
 
-   /* pbuddystruct adapter is used only in  two inteface case, (iface_nums 
=2 in struct dvobj_priv) */
+   /* pbuddystruct adapter is used only in two interface case, (iface_nums 
=2 in struct dvobj_priv) */
/* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
/* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
/* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to 
padapters[iface_id]  in struct dvobj_priv */
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h 
b/drivers/staging/rtl8723bs/include/hal_com.h
index a1e1b76b5d8a..6bcc443d59fb 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -158,7 +158,7 @@
 (rate == DESC_RATEVHTSS2MCS6) ? "VHTSS2MCS6" : \
 (rate == DESC_RATEVHTSS2MCS7) ? "VHTSS2MCS7" : \
 (rate == DESC_RATEVHTSS2MCS8) ? "VHTSS2MCS8" : \
-(rate == DESC_RATEVHTSS2MCS9) ? "VHTSS2MCS9

Re: [Outreachy kernel] [PATCH v6] staging: rtl8723bs: Remove camelcase in several files

2021-04-09 Thread Fabio M. De Francesco
On Friday, April 9, 2021 10:04:08 AM CEST Julia Lawall wrote:
> On Fri, 9 Apr 2021, Fabio M. De Francesco wrote:
> > Remove camelcase in bFwCurrentInPSMode, a variable used by code
> > of several subdirectories/files of the driver. Issue detected by
> > checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
> > the beginning of the name.
> 
> I'm sorry, but this is still the wrong patch.  Now you have b in the
> starting point and b_ in the ending point.
> 
> I would really suggest to start with a competely fresh Linux kernel, redo
> the patch by hand, and then send that.
> 

I've just sent v8 of this patch. 

I didn't start with a fresh Linux kernel, but I preferred to find a shorter 
way: try to learn git rebase and the like. I hope it worked...

However, now I'd like to understand what should I do with another patch 
that I submitted yesterday because it logically follows this one.

I'm talking about  "staging: rtl8723bs: Change the type and use of a 
variable". Is it still valid or should I send it again because it couldn't 
be applied before the camelcase edit?

Thanks in advance,

Fabio




> julia
> 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> > Changes from v5: Edit against the wrong patch
> > Changes from v4: Mention the removal of the initial "b" in log message.
> > Changes from v3: Fix errors in the format of the patch.
> > Changes from v2: Remove unnecessary comment. Shortened a function name.
> > Changes from v1: No changes to the code but only to the subject for the
> > purpose to differentiate this patch because other removes of camelcase
> > have been made in other files of the same directory.
> > 
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
> >  drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
> >  drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
> >  drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
> >  drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
> >  .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
> >  drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
> >  .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
> >  8 files changed, 24 insertions(+), 24 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > baf8b1e0f43c..a08f22b53592 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct
> > adapter *padapter, u8 dtim)> 
> > if (pwrpriv->dtim != dtim)
> > 
> > pwrpriv->dtim = dtim;
> > 
> > -   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode 
>
> > PS_MODE_ACTIVE)) { +if ((pwrpriv->b_fw_current_in_ps_mode == true) 
> > &&
> > (pwrpriv->pwr_mode > PS_MODE_ACTIVE)) {> 
> > u8 ps_mode = pwrpriv->pwr_mode;
> > 
> > rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, 
(u8
> > *)(_mode));
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > b/drivers/staging/rtl8723bs/core/rtw_mlme.c index
> > a7e40aaae2d9..51cea6cf46e7 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > @@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct
> > adapter *adapter)> 
> > if (adapter->net_closed)
> > 
> > return;
> > 
> > -   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
> > +   if ((adapter_to_pwrctl(adapter)->b_fw_current_in_ps_mode)
> > 
> > && !(hal_btcoex_IsBtControlLps(adapter))
> > ) {
> > u8 bEnterPS;
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index
> > f7465cf90c46..21e7a847866f 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > @@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8
> > ps_mode, u8 smart_ps, u8 bcn_a> 
> > rtw_set_rpwm(padapter, PS_STATE_S4);
> > 
> > rtw_hal_set_hwreg(padapter, 
HW_VAR_H2C_FW_PWRMODE, (u8
> > *)(_mode));
> > 
> > -   pwrpriv->bFwCurrentInPSMode = false;
> > + 

[Outreachy kernel] [PATCH v7] staging: rtl8723bs: Remove camelcase in several files

2021-04-09 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v6: Edit against the wrong patch (again).
Changes from v5: Edit against the wrong patch.
Changes from v4: Mention the removal of the initial "b" in log message.
Changes from v3: Fix errors in the format of the patch.
Changes from v2: Remove unnecessary comment. Shortened a function name.
Changes from v1: No changes to the code but only to the subject for the
purpose to differentiate this patch because other removes of camelcase
have been made in other files of the same directory.

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index baf8b1e0f43c..feb53b8c0ff2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..895997868c81 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f7465cf90c46..481e2ad60853 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl

[Outreachy kernel] [PATCH v6] staging: rtl8723bs: Remove camelcase in several files

2021-04-09 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v5: Edit against the wrong patch
Changes from v4: Mention the removal of the initial "b" in log message.
Changes from v3: Fix errors in the format of the patch.
Changes from v2: Remove unnecessary comment. Shortened a function name.
Changes from v1: No changes to the code but only to the subject for the
purpose to differentiate this patch because other removes of camelcase
have been made in other files of the same directory.

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index baf8b1e0f43c..a08f22b53592 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->b_fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..51cea6cf46e7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->b_fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f7465cf90c46..21e7a847866f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->b_fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->b_fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->b_fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->b_fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl-

Re: [Outreachy kernel] [PATCH v5] staging: rtl8723bs: Remove camelcase in several files

2021-04-09 Thread Fabio M. De Francesco
On Friday, April 9, 2021 9:22:54 AM CEST Julia Lawall wrote:
> On Fri, 9 Apr 2021, Fabio M. De Francesco wrote:
> > Remove camelcase in bFwCurrentInPSMode, a variable used by code
> > of several subdirectories/files of the driver. Issue detected by
> > checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
> > the beginning of the name.
> 
> Isn't this still against your previous patch?  I see b_ on the removed
> lines.
> 

Sorry, Julia. You're right: it's against the wrong patch (again and again 
and...).
Version 6 is on the way.

Thanks,

Fabio

> julia
> 
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> > Changes from v4: Mention the removal of the initial "b" in log message.
> > Changes from v3: Fix errors in the format of the patch.
> > Changes from v2: Remove unnecessary comment. Shortened a function name.
> > Changes from v1: No changes to the code but only to the subject for the
> > purpose to differentiate this patch because other removes of camelcase
> > have been made in other files of the same directory.
> > 
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
> >  drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
> >  drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
> >  drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
> >  drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
> >  .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
> >  drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
> >  .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
> >  8 files changed, 24 insertions(+), 24 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > a08f22b53592..feb53b8c0ff2 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct
> > adapter *padapter, u8 dtim)> 
> > if (pwrpriv->dtim != dtim)
> > 
> > pwrpriv->dtim = dtim;
> > 
> > -   if ((pwrpriv->b_fw_current_in_ps_mode == true) && (pwrpriv-
>pwr_mode
> > > PS_MODE_ACTIVE)) { +  if ((pwrpriv->fw_current_in_ps_mode == 
true) &&
> > (pwrpriv->pwr_mode > PS_MODE_ACTIVE)) {> 
> > u8 ps_mode = pwrpriv->pwr_mode;
> > 
> > rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, 
(u8
> > *)(_mode));
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > b/drivers/staging/rtl8723bs/core/rtw_mlme.c index
> > 51cea6cf46e7..895997868c81 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > @@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct
> > adapter *adapter)> 
> > if (adapter->net_closed)
> > 
> > return;
> > 
> > -   if ((adapter_to_pwrctl(adapter)->b_fw_current_in_ps_mode)
> > +   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
> > 
> > && !(hal_btcoex_IsBtControlLps(adapter))
> > ) {
> > u8 bEnterPS;
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index
> > 21e7a847866f..481e2ad60853 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > @@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8
> > ps_mode, u8 smart_ps, u8 bcn_a> 
> > rtw_set_rpwm(padapter, PS_STATE_S4);
> > 
> > rtw_hal_set_hwreg(padapter, 
HW_VAR_H2C_FW_PWRMODE, (u8
> > *)(_mode));
> > 
> > -   pwrpriv->b_fw_current_in_ps_mode = false;
> > +   pwrpriv->fw_current_in_ps_mode = false;
> > 
> > hal_btcoex_LpsNotify(padapter, ps_mode);
> > 
> > }
> > 
> > @@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8
> > ps_mode, u8 smart_ps, u8 bcn_a> 
> > hal_btcoex_LpsNotify(padapter, ps_mode);
> > 
> > -   pwrpriv->b_fw_current_in_ps_mode = true;
> > +   pwrpriv->fw_current_in_ps_mode = true;
> > 
> > pwrpriv->pwr_mode = ps_mode;
> >

[Outreachy kernel] [PATCH v5] staging: rtl8723bs: Remove camelcase in several files

2021-04-09 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl. Delete the unnecessary "b" (that stands for "byte") from
the beginning of the name.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v4: Mention the removal of the initial "b" in log message.
Changes from v3: Fix errors in the format of the patch.
Changes from v2: Remove unnecessary comment. Shortened a function name.
Changes from v1: No changes to the code but only to the subject for the
purpose to differentiate this patch because other removes of camelcase
have been made in other files of the same directory.

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index a08f22b53592..feb53b8c0ff2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->b_fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 51cea6cf46e7..895997868c81 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->b_fw_current_in_ps_mode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 21e7a847866f..481e2ad60853 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->b_fw_current_in_ps_mode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->b_fw_current_in_ps_mode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->b_fw_current_in_ps_mode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->b_fw_current_in_ps_mode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl->b_fw_current_in_ps_mode) {
+   if (pwrctrl->fw_current_in_ps_mo

[Outreachy kernel] [PATCH v4] staging: rtl8723bs: Remove camelcase in several files

2021-04-08 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v3: Discard v3 because "b_" is not yet removed.
Changes from v2: Discard v2 because it is a diff against v1 instead of a
replacement for v1.
Changes from v1: Rewrite comment for the purpose of specifying which
variable changes. Shorten its name by removing two unnecessary
characters (b_).

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index baf8b1e0f43c..a08f22b53592 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..51cea6cf46e7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f7465cf90c46..21e7a847866f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -864,7 +864,7 @@ s32 rtw_register_cmd_ali

[Outreachy kernel] [PATCH v3] staging: rtl8723bs: Remove camelcase in several files

2021-04-08 Thread Fabio M. De Francesco
Remove camelcase in bFwCurrentInPSMode, a variable used by code
of several subdirectories/files of the driver. Issue detected by
checkpatch.pl.

Signed-off-by: Fabio M. De Francesco 
---

Changes from v2: Discard v2 because it is a diff against v1 instead of a
replacement for v1.
Changes from v1: Rewrite comment for the purpose of specifying which
variable changes. Shorten its name by removing two unnecessary
characters (b_).

 drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index baf8b1e0f43c..a08f22b53592 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter 
*padapter, u8 dtim)
if (pwrpriv->dtim != dtim)
pwrpriv->dtim = dtim;
 
-   if ((pwrpriv->bFwCurrentInPSMode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
+   if ((pwrpriv->b_fw_current_in_ps_mode == true) && (pwrpriv->pwr_mode > 
PS_MODE_ACTIVE)) {
u8 ps_mode = pwrpriv->pwr_mode;
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a7e40aaae2d9..51cea6cf46e7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct adapter 
*adapter)
if (adapter->net_closed)
return;
 
-   if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode)
+   if ((adapter_to_pwrctl(adapter)->b_fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f7465cf90c46..21e7a847866f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
rtw_set_rpwm(padapter, PS_STATE_S4);
 
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 
*)(_mode));
-   pwrpriv->bFwCurrentInPSMode = false;
+   pwrpriv->b_fw_current_in_ps_mode = false;
 
hal_btcoex_LpsNotify(padapter, ps_mode);
}
@@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, 
u8 smart_ps, u8 bcn_a
 
hal_btcoex_LpsNotify(padapter, ps_mode);
 
-   pwrpriv->bFwCurrentInPSMode = true;
+   pwrpriv->b_fw_current_in_ps_mode = true;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
@@ -734,7 +734,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 
task)
 
register_task_alive(pwrctrl, task);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->b_fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -782,7 +782,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, 
u32 task)
 
unregister_task_alive(pwrctrl, task);
 
-   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->bFwCurrentInPSMode) {
+   if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && 
pwrctrl->b_fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
@@ -819,7 +819,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
register_task_alive(pwrctrl, XMIT_ALIVE);
 
-   if (pwrctrl->bFwCurrentInPSMode) {
+   if (pwrctrl->b_fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
res = _FAIL;
@@ -864,7 +864,7 @@ s32 rtw_register_cmd_alive(struct adapter *padapter)
 
register_task_ali

Re: [Outreachy kernel] [PATCH v2] staging: rtl8723bs: Remove camelcase in several files

2021-04-08 Thread Fabio M. De Francesco
On Thursday, April 8, 2021 1:55:29 PM CEST Matthew Wilcox wrote:
> On Thu, Apr 08, 2021 at 12:39:54PM +0200, Fabio M. De Francesco wrote:
> > Remove camelcase in bFwCurrentInPSMode, a variable used by code
> > of several subdirectories/files of the driver. Issue detected by
> > checkpatch.pl.
> 
> It looks like you sent this as a diff against v1 instead of as a
> replacement for v1.
> 
I wrongly assumed it could go. I still don't know how to reset and replace 
a commit that is not in HEAD. I have to read a tutorial about this subject.

Let me take some time to understand how to do that replacement and then I 
will send the patch again. 

Obviously, I'd appreciate any help that guides me to the proper workflow.

Thanks for your review,

Fabio
 >
> > Signed-off-by: Fabio M. De Francesco 
> > ---
> > 
> > Changes from v1: Rewrite comment for the purpose of specifying which
> > variable changes. Shorten its name by removing two unnecessary
> > characters (b_).
> > 
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c   |  2 +-
> >  drivers/staging/rtl8723bs/core/rtw_mlme.c  |  2 +-
> >  drivers/staging/rtl8723bs/core/rtw_pwrctrl.c   | 18 +-
> >  drivers/staging/rtl8723bs/hal/hal_intf.c   |  2 +-
> >  drivers/staging/rtl8723bs/hal/rtl8723b_dm.c|  6 +++---
> >  .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  2 +-
> >  drivers/staging/rtl8723bs/hal/sdio_ops.c   | 14 +++---
> >  .../staging/rtl8723bs/include/rtw_pwrctrl.h|  2 +-
> >  8 files changed, 24 insertions(+), 24 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > a08f22b53592..feb53b8c0ff2 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -1510,7 +1510,7 @@ static void rtw_lps_change_dtim_hdl(struct
> > adapter *padapter, u8 dtim)> 
> > if (pwrpriv->dtim != dtim)
> > 
> > pwrpriv->dtim = dtim;
> > 
> > -   if ((pwrpriv->b_fw_current_in_ps_mode == true) && (pwrpriv-
>pwr_mode
> > > PS_MODE_ACTIVE)) { +  if ((pwrpriv->fw_current_in_ps_mode == 
true) &&
> > (pwrpriv->pwr_mode > PS_MODE_ACTIVE)) {> 
> > u8 ps_mode = pwrpriv->pwr_mode;
> > 
> > rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, 
(u8
> > *)(_mode));
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > b/drivers/staging/rtl8723bs/core/rtw_mlme.c index
> > 51cea6cf46e7..895997868c81 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > @@ -1684,7 +1684,7 @@ void rtw_dynamic_check_timer_handler(struct
> > adapter *adapter)> 
> > if (adapter->net_closed)
> > 
> > return;
> > 
> > -   if ((adapter_to_pwrctl(adapter)->b_fw_current_in_ps_mode)
> > +   if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
> > 
> > && !(hal_btcoex_IsBtControlLps(adapter))
> > ) {
> > u8 bEnterPS;
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index
> > 21e7a847866f..481e2ad60853 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> > @@ -365,7 +365,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8
> > ps_mode, u8 smart_ps, u8 bcn_a> 
> > rtw_set_rpwm(padapter, PS_STATE_S4);
> > 
> > rtw_hal_set_hwreg(padapter, 
HW_VAR_H2C_FW_PWRMODE, (u8
> > *)(_mode));
> > 
> > -   pwrpriv->b_fw_current_in_ps_mode = false;
> > +   pwrpriv->fw_current_in_ps_mode = false;
> > 
> > hal_btcoex_LpsNotify(padapter, ps_mode);
> > 
> > }
> > 
> > @@ -377,7 +377,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8
> > ps_mode, u8 smart_ps, u8 bcn_a> 
> > hal_btcoex_LpsNotify(padapter, ps_mode);
> > 
> > -   pwrpriv->b_fw_current_in_ps_mode = true;
> > +   pwrpriv->fw_current_in_ps_mode = true;
> > 
> > pwrpriv->pwr_mode = ps_mode;
> > pwrpriv->smart_ps = smart_ps;
> > pwrpriv->bcn_ant_mode = bcn_ant_mode;
> > 
> > @

  1   2   >