2021-03-20 11:18:17

by Fabio Aiuto

[permalink] [raw]
Subject: CHECKPATCH: missing a warning soon after include files decl -c

Hi,

here's an issue in checkpatch.pl

$ perl script/checkpatch.pl -f drivers/staging/rtl8723bs/core/rtw_ap.c

I get three warning related to an extern declaration

WARNING: externs should be avoided in .c files
#14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
+extern unsigned char WMM_OUI[];
--
WARNING: externs should be avoided in .c files
#15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
+extern unsigned char WPS_OUI[];
--
WARNING: externs should be avoided in .c files
#16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
+extern unsigned char P2P_OUI[];
----------------------

but the file checked has 4 extern declaration:
-----------------------------
#define _RTW_AP_C_

#include <drv_types.h>
#include <rtw_debug.h>
#include <asm/unaligned.h>

extern unsigned char RTW_WPA_OUI[];
extern unsigned char WMM_OUI[];
extern unsigned char WPS_OUI[];
extern unsigned char P2P_OUI[];

void init_mlme_ap_info(struct adapter *padapter)
-------------------------------

If I add a ';' this way:
----------------------------
#define _RTW_AP_C_

#include <drv_types.h>
#include <rtw_debug.h>
#include <asm/unaligned.h>
;
extern unsigned char RTW_WPA_OUI[];
extern unsigned char WMM_OUI[];
extern unsigned char WPS_OUI[];
extern unsigned char P2P_OUI[];

void init_mlme_ap_info(struct adapter *padapter)
--------------------------------

the missing warning appears:
----------------------------------
WARNING: externs should be avoided in .c files
#13: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:13:
+extern unsigned char RTW_WPA_OUI[];
--
WARNING: externs should be avoided in .c files
#14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
+extern unsigned char WMM_OUI[];
--
WARNING: externs should be avoided in .c files
#15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
+extern unsigned char WPS_OUI[];
--
WARNING: externs should be avoided in .c files
#16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
+extern unsigned char P2P_OUI[];
-------------------------------------------
Applying this ugly patch to debug:

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index df8b23dc1eb0..ecbbb731361c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6810,6 +6810,11 @@ sub process {
{
WARN("AVOID_EXTERNS",
"externs should be avoided in .c files\n" . $herecurr);
+ } elsif ($realfile =~ /\.c$/ && defined $stat &&
+ $stat =~ /extern\s+/)
+ {
+ WARN("AVOID_EXTERNS",
+ "print stat value\n" . $stat);
}

# check for function declarations that have arguments without identifier names

--------------
I get:

WARNING: print stat value
+#include <XXXXXXXXXXX>
#include <XXXXXXXXXXX>
#include <XXXXXXXXXXXXXXX>

extern unsigned char RTW_WPA_OUI[];
WARNING: externs should be avoided in .c files
#14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
+extern unsigned char WMM_OUI[];

WARNING: externs should be avoided in .c files
#15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
+extern unsigned char WPS_OUI[];

WARNING: externs should be avoided in .c files
#16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
+extern unsigned char P2P_OUI[];

I don't know if it's best to fix the regex of the particular "extern in .c files issue"
or maybe how the statement is computed. Should a statement represent a single line?

Suggestions are welcome,

fabio


2021-03-20 11:18:17

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: CHECKPATCH: missing a warning soon after include files decl -c

On Sat, Mar 20, 2021 at 11:54:24AM +0100, Fabio Aiuto wrote:
> Hi,
>
> here's an issue in checkpatch.pl
>
> $ perl script/checkpatch.pl -f drivers/staging/rtl8723bs/core/rtw_ap.c
>
> I get three warning related to an extern declaration
>
> WARNING: externs should be avoided in .c files
> #14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
> +extern unsigned char WMM_OUI[];
> --
> WARNING: externs should be avoided in .c files
> #15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
> +extern unsigned char WPS_OUI[];
> --
> WARNING: externs should be avoided in .c files
> #16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
> +extern unsigned char P2P_OUI[];
> ----------------------
>
> but the file checked has 4 extern declaration:
> -----------------------------
> #define _RTW_AP_C_
>
> #include <drv_types.h>
> #include <rtw_debug.h>
> #include <asm/unaligned.h>
>
> extern unsigned char RTW_WPA_OUI[];
> extern unsigned char WMM_OUI[];
> extern unsigned char WPS_OUI[];
> extern unsigned char P2P_OUI[];
>
> void init_mlme_ap_info(struct adapter *padapter)
> -------------------------------
>
> If I add a ';' this way:
> ----------------------------
> #define _RTW_AP_C_
>
> #include <drv_types.h>
> #include <rtw_debug.h>
> #include <asm/unaligned.h>
> ;
> extern unsigned char RTW_WPA_OUI[];
> extern unsigned char WMM_OUI[];
> extern unsigned char WPS_OUI[];
> extern unsigned char P2P_OUI[];
>
> void init_mlme_ap_info(struct adapter *padapter)
> --------------------------------

Wait, why would you do the above?

Don't try to trick a perl script that has a hard time parsing C files,
try to resolve the original issue here.

And that is that the above definitions should be in a .h file somewhere.
If you make that move then all should be fine.

thanks,

greg k-h

2021-03-20 11:30:56

by Joe Perches

[permalink] [raw]
Subject: Re: CHECKPATCH: missing a warning soon after include files decl -c

On Sat, 2021-03-20 at 11:59 +0100, Greg KH wrote:
> On Sat, Mar 20, 2021 at 11:54:24AM +0100, Fabio Aiuto wrote:
> > Hi,
> >
> > here's an issue in checkpatch.pl
> >
> > $ perl script/checkpatch.pl -f drivers/staging/rtl8723bs/core/rtw_ap.c
> >
> > I get three warning related to an extern declaration
> >
> > WARNING: externs should be avoided in .c files
> > #14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
> > +extern unsigned char WMM_OUI[];
> > --
> > WARNING: externs should be avoided in .c files
> > #15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
> > +extern unsigned char WPS_OUI[];
> > --
> > WARNING: externs should be avoided in .c files
> > #16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
> > +extern unsigned char P2P_OUI[];
> > ----------------------
> >
> > but the file checked has 4 extern declaration:
> > -----------------------------
> > #define _RTW_AP_C_
> >
> > #include <drv_types.h>
> > #include <rtw_debug.h>
> > #include <asm/unaligned.h>
> >
> > extern unsigned char RTW_WPA_OUI[];
> > extern unsigned char WMM_OUI[];
> > extern unsigned char WPS_OUI[];
> > extern unsigned char P2P_OUI[];
> >
> > void init_mlme_ap_info(struct adapter *padapter)
> > -------------------------------
> >
> > If I add a ';' this way:
> > ----------------------------
> > #define _RTW_AP_C_
> >
> > #include <drv_types.h>
> > #include <rtw_debug.h>
> > #include <asm/unaligned.h>
> > ;
> > extern unsigned char RTW_WPA_OUI[];
> > extern unsigned char WMM_OUI[];
> > extern unsigned char WPS_OUI[];
> > extern unsigned char P2P_OUI[];
> >
> > void init_mlme_ap_info(struct adapter *padapter)
> > --------------------------------
>
> Wait, why would you do the above?

It is rather an ugly hack.

> Don't try to trick a perl script that has a hard time parsing C files,
> try to resolve the original issue here.
>
> And that is that the above definitions should be in a .h file somewhere.
> If you make that move then all should be fine.

Actually, these would seem to be better as one or multiple functions with
local statics or even as static inlines functions in the .h file

$ git grep -w RTW_WPA_OUI drivers/staging/rtl8723bs/core
drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char RTW_WPA_OUI[];
drivers/staging/rtl8723bs/core/rtw_ap.c: if (!memcmp(RTW_WPA_OUI, oui, 4))
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char RTW_WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01};
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) ||
drivers/staging/rtl8723bs/core/rtw_wlan_util.c:extern unsigned char RTW_WPA_OUI[];
drivers/staging/rtl8723bs/core/rtw_wlan_util.c: if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) && (!memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4)))

$ git grep -w WMM_OUI drivers/staging/rtl8723bs/core
drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char WMM_OUI[];
drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(WMM_OUI, oui, 4))
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char WMM_OUI[] = {0x00, 0x50, 0xf2, 0x02};
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: (!memcmp(pIE->data, WMM_OUI, 4)) ||
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if (!memcmp(pIE->data, WMM_OUI, 4))
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h:extern unsigned char WMM_OUI[];

$ git grep -w WPS_OUI drivers/staging/rtl8723bs/core
drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char WPS_OUI[];
drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(WPS_OUI, oui, 4))
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char WPS_OUI[] = {0x00, 0x50, 0xf2, 0x04};
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: (!memcmp(pIE->data, WPS_OUI, 4))) {
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if ((!padapter->registrypriv.wifi_spec) && (!memcmp(pIE->data, WPS_OUI, 4))) {

$ git grep -w P2P_OUI drivers/staging/rtl8723bs/core
drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char P2P_OUI[];
drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(P2P_OUI, oui, 4))
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char P2P_OUI[] = {0x50, 0x6F, 0x9A, 0x09};
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if (!memcmp(frame_body + 2, P2P_OUI, 4)) {

So maybe something like the below (written in email client, maybe typos)

enum oui_type {
RTW_WPA,
WMM,
WPS,
P2P
};

bool is_oui_type(const u8 *mem, enum oui_type type)
{
static const u8 rtw_wpa[] = {0x00, 0x50, 0xf2, 0x01};
static const u8 wmm[] = {0x00, 0x50, 0xf2, 0x02};
static const u8 wps[] = {0x00, 0x50, 0xf2, 0x04};
static const u8 p2p[] = {0x50, 0x6F, 0x9A, 0x09};

const u8 *oui;

if (type == RTW_WPA)
oui = rtw_wpa;
else if (type == WMM)
oui = wmm;
else if (type == WPS)
oui = wps;
else if (type == P2P)
oui = p2p;
else
return false;

return !memcmp(mem, oui, 4);
}

so for instance the P2P uses would become

else if (is_oui_type(oui, P2P))
and
if (is_oui_type(frame_body + 2, P2P)) {

though I think 4 byte OUIs are just odd.

https://en.wikipedia.org/wiki/Organizationally_unique_identifier

An organizationally unique identifier (OUI) is a 24-bit number that uniquely identifies a vendor, manufacturer, or other organization.



2021-03-20 14:27:36

by Fabio Aiuto

[permalink] [raw]
Subject: Re: CHECKPATCH: missing a warning soon after include files decl -c

On Sat, Mar 20, 2021 at 04:28:51AM -0700, Joe Perches wrote:
> On Sat, 2021-03-20 at 11:59 +0100, Greg KH wrote:
> > On Sat, Mar 20, 2021 at 11:54:24AM +0100, Fabio Aiuto wrote:
> > > Hi,
> > >
> > > here's an issue in checkpatch.pl
> > >
> > > $ perl script/checkpatch.pl -f drivers/staging/rtl8723bs/core/rtw_ap.c
> > >
> > > I get three warning related to an extern declaration
> > >
> > > WARNING: externs should be avoided in .c files
> > > #14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
> > > +extern unsigned char WMM_OUI[];
> > > --
> > > WARNING: externs should be avoided in .c files
> > > #15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
> > > +extern unsigned char WPS_OUI[];
> > > --
> > > WARNING: externs should be avoided in .c files
> > > #16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
> > > +extern unsigned char P2P_OUI[];
> > > ----------------------
> > >
> > > but the file checked has 4 extern declaration:
> > > -----------------------------
> > > #define _RTW_AP_C_
> > >
> > > #include <drv_types.h>
> > > #include <rtw_debug.h>
> > > #include <asm/unaligned.h>
> > >
> > > extern unsigned char RTW_WPA_OUI[];
> > > extern unsigned char WMM_OUI[];
> > > extern unsigned char WPS_OUI[];
> > > extern unsigned char P2P_OUI[];
> > >
> > > void init_mlme_ap_info(struct adapter *padapter)
> > > -------------------------------
> > >
> > > If I add a ';' this way:
> > > ----------------------------
> > > #define _RTW_AP_C_
> > >
> > > #include <drv_types.h>
> > > #include <rtw_debug.h>
> > > #include <asm/unaligned.h>
> > > ;
> > > extern unsigned char RTW_WPA_OUI[];
> > > extern unsigned char WMM_OUI[];
> > > extern unsigned char WPS_OUI[];
> > > extern unsigned char P2P_OUI[];
> > >
> > > void init_mlme_ap_info(struct adapter *padapter)
> > > --------------------------------
> >
> > Wait, why would you do the above?
>
> It is rather an ugly hack.

yes it is, it was just a local and temporary one to verify that checkpatch.pl
recognizes a statement even in multiple lines, until the next ';'. In my case it has his own
drawbacks, but I will follow Greg's advice, to let checkpatch.pl doing his heavy duty:)

>
> > Don't try to trick a perl script that has a hard time parsing C files,
> > try to resolve the original issue here.
> >
> > And that is that the above definitions should be in a .h file somewhere.
> > If you make that move then all should be fine.
>
> Actually, these would seem to be better as one or multiple functions with
> local statics or even as static inlines functions in the .h file
>
> $ git grep -w RTW_WPA_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char RTW_WPA_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c: if (!memcmp(RTW_WPA_OUI, oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char RTW_WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) ||
> drivers/staging/rtl8723bs/core/rtw_wlan_util.c:extern unsigned char RTW_WPA_OUI[];
> drivers/staging/rtl8723bs/core/rtw_wlan_util.c: if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) && (!memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4)))
>
> $ git grep -w WMM_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char WMM_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(WMM_OUI, oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char WMM_OUI[] = {0x00, 0x50, 0xf2, 0x02};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: (!memcmp(pIE->data, WMM_OUI, 4)) ||
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if (!memcmp(pIE->data, WMM_OUI, 4))
> drivers/staging/rtl8723bs/include/rtw_mlme_ext.h:extern unsigned char WMM_OUI[];
>
> $ git grep -w WPS_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char WPS_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(WPS_OUI, oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char WPS_OUI[] = {0x00, 0x50, 0xf2, 0x04};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: (!memcmp(pIE->data, WPS_OUI, 4))) {
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if ((!padapter->registrypriv.wifi_spec) && (!memcmp(pIE->data, WPS_OUI, 4))) {
>
> $ git grep -w P2P_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char P2P_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(P2P_OUI, oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char P2P_OUI[] = {0x50, 0x6F, 0x9A, 0x09};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if (!memcmp(frame_body + 2, P2P_OUI, 4)) {
>
> So maybe something like the below (written in email client, maybe typos)
>
> enum oui_type {
> RTW_WPA,
> WMM,
> WPS,
> P2P
> };
>
> bool is_oui_type(const u8 *mem, enum oui_type type)
> {
> static const u8 rtw_wpa[] = {0x00, 0x50, 0xf2, 0x01};
> static const u8 wmm[] = {0x00, 0x50, 0xf2, 0x02};
> static const u8 wps[] = {0x00, 0x50, 0xf2, 0x04};
> static const u8 p2p[] = {0x50, 0x6F, 0x9A, 0x09};
>
> const u8 *oui;
>
> if (type == RTW_WPA)
> oui = rtw_wpa;
> else if (type == WMM)
> oui = wmm;
> else if (type == WPS)
> oui = wps;
> else if (type == P2P)
> oui = p2p;
> else
> return false;
>
> return !memcmp(mem, oui, 4);
> }
>
> so for instance the P2P uses would become
>
> else if (is_oui_type(oui, P2P))
> and
> if (is_oui_type(frame_body + 2, P2P)) {
>
> though I think 4 byte OUIs are just odd.
>
> https://en.wikipedia.org/wiki/Organizationally_unique_identifier
>
> An organizationally unique identifier (OUI) is a 24-bit number that uniquely identifies a vendor, manufacturer, or other organization.
>
>
>

Thank you Joe, is the whole analisys involved with the simple task of removing them from .c files?

2021-03-20 14:52:56

by Fabio Aiuto

[permalink] [raw]
Subject: Re: CHECKPATCH: missing a warning soon after include files decl -c

On Sat, Mar 20, 2021 at 11:59:44AM +0100, Greg KH wrote:
> On Sat, Mar 20, 2021 at 11:54:24AM +0100, Fabio Aiuto wrote:
> > Hi,
> >
> > here's an issue in checkpatch.pl
> >
> > $ perl script/checkpatch.pl -f drivers/staging/rtl8723bs/core/rtw_ap.c
> >
> > I get three warning related to an extern declaration
> >
> > WARNING: externs should be avoided in .c files
> > #14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
> > +extern unsigned char WMM_OUI[];
> > --
> > WARNING: externs should be avoided in .c files
> > #15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
> > +extern unsigned char WPS_OUI[];
> > --
> > WARNING: externs should be avoided in .c files
> > #16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
> > +extern unsigned char P2P_OUI[];
> > ----------------------
> >
> > but the file checked has 4 extern declaration:
> > -----------------------------
> > #define _RTW_AP_C_
> >
> > #include <drv_types.h>
> > #include <rtw_debug.h>
> > #include <asm/unaligned.h>
> >
> > extern unsigned char RTW_WPA_OUI[];
> > extern unsigned char WMM_OUI[];
> > extern unsigned char WPS_OUI[];
> > extern unsigned char P2P_OUI[];
> >
> > void init_mlme_ap_info(struct adapter *padapter)
> > -------------------------------
> >
> > If I add a ';' this way:
> > ----------------------------
> > #define _RTW_AP_C_
> >
> > #include <drv_types.h>
> > #include <rtw_debug.h>
> > #include <asm/unaligned.h>
> > ;
> > extern unsigned char RTW_WPA_OUI[];
> > extern unsigned char WMM_OUI[];
> > extern unsigned char WPS_OUI[];
> > extern unsigned char P2P_OUI[];
> >
> > void init_mlme_ap_info(struct adapter *padapter)
> > --------------------------------
>
> Wait, why would you do the above?
>
> Don't try to trick a perl script that has a hard time parsing C files,
> try to resolve the original issue here.
>
> And that is that the above definitions should be in a .h file somewhere.
> If you make that move then all should be fine.
>
> thanks,
>
> greg k-h

that's another issue

WARNING: externs should be avoided in .c files
#35: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:35:
+bool

CHECK: Lines should not end with a '('
#36: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:36:
---

but that's what I see in line 35


#define REG_EFUSE_CTRL 0x0030
#define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */

bool<--------------------------------- line 35
Efuse_Read1ByteFromFakeContent(
struct adapter *padapter,
u16 Offset,
u8 *Value);
bool
Efuse_Read1ByteFromFakeContent(
struct adapter *padapter,

another one...

WARNING: externs should be avoided in .c files
#40: FILE: drivers/staging/rtl8723bs/core/rtw_ioctl_set.c:40:
+u8 rtw_do_join(struct adapter *padapter); <-------- do I miss
something about extern keyword?

CHECK: Unnecessary parentheses around padapter->mlmepriv
#45: FILE: drivers/staging/rtl8723bs/core/rtw_ioctl_set.c:45:

thank you,

fabio

2021-03-21 07:22:18

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: CHECKPATCH: missing a warning soon after include files decl -c

On Sat, Mar 20, 2021 at 03:49:12PM +0100, Fabio Aiuto wrote:
> On Sat, Mar 20, 2021 at 11:59:44AM +0100, Greg KH wrote:
> > On Sat, Mar 20, 2021 at 11:54:24AM +0100, Fabio Aiuto wrote:
> > > Hi,
> > >
> > > here's an issue in checkpatch.pl
> > >
> > > $ perl script/checkpatch.pl -f drivers/staging/rtl8723bs/core/rtw_ap.c
> > >
> > > I get three warning related to an extern declaration
> > >
> > > WARNING: externs should be avoided in .c files
> > > #14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
> > > +extern unsigned char WMM_OUI[];
> > > --
> > > WARNING: externs should be avoided in .c files
> > > #15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
> > > +extern unsigned char WPS_OUI[];
> > > --
> > > WARNING: externs should be avoided in .c files
> > > #16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
> > > +extern unsigned char P2P_OUI[];
> > > ----------------------
> > >
> > > but the file checked has 4 extern declaration:
> > > -----------------------------
> > > #define _RTW_AP_C_
> > >
> > > #include <drv_types.h>
> > > #include <rtw_debug.h>
> > > #include <asm/unaligned.h>
> > >
> > > extern unsigned char RTW_WPA_OUI[];
> > > extern unsigned char WMM_OUI[];
> > > extern unsigned char WPS_OUI[];
> > > extern unsigned char P2P_OUI[];
> > >
> > > void init_mlme_ap_info(struct adapter *padapter)
> > > -------------------------------
> > >
> > > If I add a ';' this way:
> > > ----------------------------
> > > #define _RTW_AP_C_
> > >
> > > #include <drv_types.h>
> > > #include <rtw_debug.h>
> > > #include <asm/unaligned.h>
> > > ;
> > > extern unsigned char RTW_WPA_OUI[];
> > > extern unsigned char WMM_OUI[];
> > > extern unsigned char WPS_OUI[];
> > > extern unsigned char P2P_OUI[];
> > >
> > > void init_mlme_ap_info(struct adapter *padapter)
> > > --------------------------------
> >
> > Wait, why would you do the above?
> >
> > Don't try to trick a perl script that has a hard time parsing C files,
> > try to resolve the original issue here.
> >
> > And that is that the above definitions should be in a .h file somewhere.
> > If you make that move then all should be fine.
> >
> > thanks,
> >
> > greg k-h
>
> that's another issue
>
> WARNING: externs should be avoided in .c files
> #35: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:35:
> +bool
>
> CHECK: Lines should not end with a '('
> #36: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:36:
> ---
>
> but that's what I see in line 35
>
>
> #define REG_EFUSE_CTRL 0x0030
> #define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */
>
> bool<--------------------------------- line 35
> Efuse_Read1ByteFromFakeContent(
> struct adapter *padapter,
> u16 Offset,
> u8 *Value);
> bool
> Efuse_Read1ByteFromFakeContent(
> struct adapter *padapter,


That's some horrid code formatting, just clean it up to look normal and
all will be fine.

> another one...
>
> WARNING: externs should be avoided in .c files
> #40: FILE: drivers/staging/rtl8723bs/core/rtw_ioctl_set.c:40:
> +u8 rtw_do_join(struct adapter *padapter); <-------- do I miss
> something about extern keyword?

Having a global function prototype in a .c file is not a good idea.
Again, fix it up and all will be fine.

thanks,

greg k-h

2021-03-22 14:33:35

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 00/11] staging: rtl8723bs: fix extern declaration checkpatch issues

Fix extern declaration issues warned by checkpatch

Fabio Aiuto (11):
staging: rtl8723bs: delete extern declarations in core/rtw_ap.c
staging: rtl8723bs: moved function prototypes out of core/rtw_efuse.c
staging: rtl8723bs: moved function prototype out of
core/rtw_ioctl_set.c and core/rtw_mlme.c
staging: rtl8723bs: moved function prototypes out of core/rtw_recv.c
staging: rtl8723bs: remove argument in recv_indicatepkts_pkt_loss_cnt
staging: rtl8723bs: move function prototype out of core/rtw_recv.c
staging: rtl8723bs: delete extern declarations in core/rtw_wlan_util.c
staging: rtl8723bs: move function prototypes out of hal/odm.c
staging: rtl8723bs: move function prototypes out of os_dep/int_fs.c
staging: rtl8723bs: remove undefined function prototype in of
os_dep/sdio_intf.c
staging: rtl8723bs: remove unnecessary extern in os_dep/sdio_intf.c

drivers/staging/rtl8723bs/core/rtw_ap.c | 5 --
drivers/staging/rtl8723bs/core/rtw_efuse.c | 10 ---
.../staging/rtl8723bs/core/rtw_ioctl_set.c | 1 -
drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 -
drivers/staging/rtl8723bs/core/rtw_recv.c | 41 ++---------
.../staging/rtl8723bs/core/rtw_wlan_util.c | 3 -
drivers/staging/rtl8723bs/hal/odm.c | 68 -------------------
drivers/staging/rtl8723bs/hal/odm.h | 62 +++++++++++++++++
.../staging/rtl8723bs/include/osdep_intf.h | 3 +
drivers/staging/rtl8723bs/include/rtw_efuse.h | 3 +
.../staging/rtl8723bs/include/rtw_ioctl_set.h | 2 +
drivers/staging/rtl8723bs/include/rtw_recv.h | 53 +++++++++++++++
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 3 -
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 3 -
14 files changed, 129 insertions(+), 130 deletions(-)

--
2.20.1

2021-03-22 14:34:02

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 01/11] staging: rtl8723bs: delete extern declarations in core/rtw_ap.c

delete extern declaration in .c file (RTW_WPA_OUI) and
fix the following checkpatch issues:

WARNING: externs should be avoided in .c files
14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14:
+extern unsigned char WMM_OUI[];
--
WARNING: externs should be avoided in .c files
15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15:
+extern unsigned char WPS_OUI[];
--
WARNING: externs should be avoided in .c files
16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16:
+extern unsigned char P2P_OUI[];

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index a01b68274fa0..3cd9c61eec99 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -10,11 +10,6 @@
#include <rtw_debug.h>
#include <asm/unaligned.h>

-extern unsigned char RTW_WPA_OUI[];
-extern unsigned char WMM_OUI[];
-extern unsigned char WPS_OUI[];
-extern unsigned char P2P_OUI[];
-
void init_mlme_ap_info(struct adapter *padapter)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
--
2.20.1

2021-03-22 14:34:04

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 02/11] staging: rtl8723bs: moved function prototypes out of core/rtw_efuse.c

fix the following checkpatch issues:

WARNING: externs should be avoided in .c files
35: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:35:
+bool

moved two function prototypes in include/rtw_efuse.h

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_efuse.c | 10 ----------
drivers/staging/rtl8723bs/include/rtw_efuse.h | 3 +++
2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index 32ca10f01413..0772397738d4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -32,11 +32,6 @@ u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
#define REG_EFUSE_CTRL 0x0030
#define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */

-bool
-Efuse_Read1ByteFromFakeContent(
- struct adapter *padapter,
- u16 Offset,
- u8 *Value);
bool
Efuse_Read1ByteFromFakeContent(
struct adapter *padapter,
@@ -53,11 +48,6 @@ Efuse_Read1ByteFromFakeContent(
return true;
}

-bool
-Efuse_Write1ByteToFakeContent(
- struct adapter *padapter,
- u16 Offset,
- u8 Value);
bool
Efuse_Write1ByteToFakeContent(
struct adapter *padapter,
diff --git a/drivers/staging/rtl8723bs/include/rtw_efuse.h b/drivers/staging/rtl8723bs/include/rtw_efuse.h
index 5bae46ecd9de..1f304df8c421 100644
--- a/drivers/staging/rtl8723bs/include/rtw_efuse.h
+++ b/drivers/staging/rtl8723bs/include/rtw_efuse.h
@@ -103,6 +103,9 @@ extern u8 fakeBTEfuseInitMap[];
extern u8 fakeBTEfuseModifiedMap[];
/*------------------------Export global variable----------------------------*/

+bool Efuse_Read1ByteFromFakeContent(struct adapter *padapter, u16 Offset, u8 *Value);
+bool Efuse_Write1ByteToFakeContent(struct adapter *padapter, u16 Offset, u8 Value);
+
u16 Efuse_GetCurrentSize(struct adapter *padapter, u8 efuseType, bool bPseudoTest);
u8 Efuse_CalculateWordCnts(u8 word_en);
void EFUSE_GetEfuseDefinition(struct adapter *padapter, u8 efuseType, u8 type, void *pOut, bool bPseudoTest);
--
2.20.1

2021-03-22 14:34:04

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 03/11] staging: rtl8723bs: moved function prototype out of core/rtw_ioctl_set.c and core/rtw_mlme.c

fix the following checkpatch issues:

WARNING: externs should be avoided in .c files
40: FILE: drivers/staging/rtl8723bs/core/rtw_ioctl_set.c:40:
+u8 rtw_do_join(struct adapter *padapter);

WARNING: externs should be avoided in .c files
15: FILE: drivers/staging/rtl8723bs/core/rtw_mlme.c:15:
+extern u8 rtw_do_join(struct adapter *padapter);

moved function prototype in include/rtw_ioctl_set.h

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c | 1 -
drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 --
drivers/staging/rtl8723bs/include/rtw_ioctl_set.h | 2 ++
3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
index cb14855742f7..7d858cae2395 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
@@ -37,7 +37,6 @@ u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
return ret;
}

-u8 rtw_do_join(struct adapter *padapter);
u8 rtw_do_join(struct adapter *padapter)
{
struct list_head *plist, *phead;
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 95cfef118a94..1ee86ec2dee7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -12,8 +12,6 @@
#include <hal_btcoex.h>
#include <linux/jiffies.h>

-extern u8 rtw_do_join(struct adapter *padapter);
-
int rtw_init_mlme_priv(struct adapter *padapter)
{
int i;
diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
index 4b929b84040a..55722c1366aa 100644
--- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
+++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
@@ -28,6 +28,8 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1
u8 rtw_validate_bssid(u8 *bssid);
u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid);

+u8 rtw_do_join(struct adapter *padapter);
+
u16 rtw_get_cur_max_rate(struct adapter *adapter);

#endif
--
2.20.1

2021-03-22 14:34:04

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 06/11] staging: rtl8723bs: move function prototype out of core/rtw_recv.c

move function prototype in include/rtw_recv.h

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_recv.c | 1 -
drivers/staging/rtl8723bs/include/rtw_recv.h | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index e2a6afed723c..99dede774b7a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1983,7 +1983,6 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec

}

-u64 recv_indicatepkts_pkt_loss_cnt(u64 prev_seq, u64 current_seq);
u64 recv_indicatepkts_pkt_loss_cnt(u64 prev_seq, u64 current_seq)
{
if (current_seq < prev_seq)
diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h
index 248e098726fd..1dca18040b98 100644
--- a/drivers/staging/rtl8723bs/include/rtw_recv.h
+++ b/drivers/staging/rtl8723bs/include/rtw_recv.h
@@ -553,6 +553,8 @@ int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num);

int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe);

+u64 recv_indicatepkts_pkt_loss_cnt(u64 prev_seq, u64 current_seq);
+
int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl,
int bforced);

--
2.20.1

2021-03-22 14:34:04

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 05/11] staging: rtl8723bs: remove argument in recv_indicatepkts_pkt_loss_cnt

remove debug_priv argument so function prototype can be
easily moved away

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_recv.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 9ef2408ded57..e2a6afed723c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1983,13 +1983,13 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec

}

-void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq);
-void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq)
+u64 recv_indicatepkts_pkt_loss_cnt(u64 prev_seq, u64 current_seq);
+u64 recv_indicatepkts_pkt_loss_cnt(u64 prev_seq, u64 current_seq)
{
if (current_seq < prev_seq)
- pdbgpriv->dbg_rx_ampdu_loss_count += (4096 + current_seq - prev_seq);
+ return 4096 + current_seq - prev_seq;
else
- pdbgpriv->dbg_rx_ampdu_loss_count += (current_seq - prev_seq);
+ return current_seq - prev_seq;

}

@@ -2029,7 +2029,8 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr
DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d, NewSeq: %d\n", __func__, __LINE__,
preorder_ctrl->indicate_seq, pattrib->seq_num);
#endif
- recv_indicatepkts_pkt_loss_cnt(pdbgpriv, preorder_ctrl->indicate_seq, pattrib->seq_num);
+ pdbgpriv->dbg_rx_ampdu_loss_count += recv_indicatepkts_pkt_loss_cnt(
+ preorder_ctrl->indicate_seq, pattrib->seq_num);
preorder_ctrl->indicate_seq = pattrib->seq_num;

}
--
2.20.1

2021-03-22 14:34:05

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 04/11] staging: rtl8723bs: moved function prototypes out of core/rtw_recv.c

fix the following checkpatch issues:

WARNING: externs should be avoided in .c files
1190: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:1190:
+signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame);

and then moved all function prototypes but one in include/rtw_recv.h

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_recv.c | 31 +-----------
drivers/staging/rtl8723bs/include/rtw_recv.h | 51 ++++++++++++++++++++
2 files changed, 52 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 1fa381663b4c..9ef2408ded57 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -305,7 +305,6 @@ struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue)

}

-signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe);
signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe)
{

@@ -435,8 +434,6 @@ signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvfra

}

-/* decrypt and set the ivlen, icvlen of the recv_frame */
-union recv_frame *decryptor(struct adapter *padapter, union recv_frame *precv_frame);
union recv_frame *decryptor(struct adapter *padapter, union recv_frame *precv_frame)
{

@@ -527,8 +524,6 @@ union recv_frame *decryptor(struct adapter *padapter, union recv_frame *precv_fr
return return_packet;
}

-/* set the security information in the recv_frame */
-union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_frame);
union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_frame)
{
u8 *psta_addr = NULL;
@@ -606,7 +601,6 @@ union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_fram
return prtnframe;
}

-signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache);
signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache)
{
signed int tid = precv_frame->u.hdr.attrib.priority;
@@ -634,7 +628,6 @@ signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo

}

-void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame);
void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame)
{
unsigned char pwrbit;
@@ -671,7 +664,6 @@ void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame
}
}

-void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame);
void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame)
{
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
@@ -723,7 +715,6 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame)
}
}

-void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct sta_info *sta);
void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct sta_info *sta)
{
int sz;
@@ -755,8 +746,6 @@ void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct
traffic_check_for_leave_lps(padapter, false, 0);
}

-signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
- struct sta_info **psta);
signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
struct sta_info **psta)
{
@@ -850,8 +839,6 @@ signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_f
return ret;
}

-signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
- struct sta_info **psta);
signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
struct sta_info **psta)
{
@@ -992,8 +979,6 @@ signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_fr
return ret;
}

-signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
- struct sta_info **psta);
signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
struct sta_info **psta)
{
@@ -1049,7 +1034,6 @@ signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_fr
return ret;
}

-signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame);
signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame)
{
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
@@ -1186,8 +1170,6 @@ signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *

}

-union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_frame *precv_frame);
-signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame);
signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame)
{
/* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
@@ -1227,7 +1209,6 @@ signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *

}

-signed int validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame);
signed int validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame)
{
u8 bretry;
@@ -1459,7 +1440,6 @@ static inline void dump_rx_packet(u8 *ptr)
DBG_871X("#############################\n");
}

-signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame);
signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame)
{
/* shall check frame subtype, to / from ds, da, bssid */
@@ -1557,9 +1537,6 @@ signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_
return retval;
}

-
-/* remove the wlanhdr and add the eth_hdr */
-signed int wlanhdr_to_ethhdr(union recv_frame *precvframe);
signed int wlanhdr_to_ethhdr(union recv_frame *precvframe)
{
signed int rmv_len;
@@ -1886,7 +1863,6 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)
return _SUCCESS;
}

-int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num);
int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
{
struct adapter *padapter = preorder_ctrl->padapter;
@@ -1955,7 +1931,6 @@ int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
return true;
}

-int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe);
int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe)
{
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
@@ -2017,7 +1992,7 @@ void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u
pdbgpriv->dbg_rx_ampdu_loss_count += (current_seq - prev_seq);

}
-int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl, int bforced);
+
int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl, int bforced)
{
struct list_head *phead, *plist;
@@ -2125,7 +2100,6 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr
return bPktInBuf;
}

-int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *prframe);
int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *prframe)
{
int retval = _SUCCESS;
@@ -2279,7 +2253,6 @@ void rtw_reordering_ctrl_timeout_handler(struct timer_list *t)

}

-int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prframe);
int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prframe)
{
int retval = _SUCCESS;
@@ -2402,8 +2375,6 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr
return ret;
}

-
-int recv_func(struct adapter *padapter, union recv_frame *rframe);
int recv_func(struct adapter *padapter, union recv_frame *rframe)
{
int ret;
diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h
index 3e2ee7f75e8c..248e098726fd 100644
--- a/drivers/staging/rtl8723bs/include/rtw_recv.h
+++ b/drivers/staging/rtl8723bs/include/rtw_recv.h
@@ -513,4 +513,55 @@ extern void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv);

extern void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame);

+signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe);
+
+/* decrypt and set the ivlen, icvlen of the recv_frame */
+union recv_frame *decryptor(struct adapter *padapter, union recv_frame *precv_frame);
+
+/* set the security information in the recv_frame */
+union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_frame);
+
+signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache);
+
+void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame);
+
+void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame);
+
+void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct sta_info *sta);
+
+signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
+ struct sta_info **psta);
+
+signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
+ struct sta_info **psta);
+
+signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
+ struct sta_info **psta);
+
+signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame);
+
+union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_frame *precv_frame);
+
+signed int validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame);
+
+signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame);
+
+/* remove the wlanhdr and add the eth_hdr */
+signed int wlanhdr_to_ethhdr(union recv_frame *precvframe);
+
+int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num);
+
+int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe);
+
+int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl,
+ int bforced);
+
+int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *prframe);
+
+int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prframe);
+
+int recv_func(struct adapter *padapter, union recv_frame *rframe);
+
+signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame);
+
#endif
--
2.20.1

2021-03-22 14:34:15

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 09/11] staging: rtl8723bs: move function prototypes out of os_dep/int_fs.c

fix the following checkpatch issues:

WARNING: externs should be avoided in .c files
196: FILE: drivers/staging/rtl8723bs/os_dep/os_intfs.c:196:
+int _netdev_open(struct net_device *pnetdev);
--
WARNING: externs should be avoided in .c files
197: FILE: drivers/staging/rtl8723bs/os_dep/os_intfs.c:197:
+int netdev_open(struct net_device *pnetdev);

moved function prototypes in include/osdep_intf.h

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/include/osdep_intf.h | 3 +++
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h
index 5ad85416c598..dc279ceb1469 100644
--- a/drivers/staging/rtl8723bs/include/osdep_intf.h
+++ b/drivers/staging/rtl8723bs/include/osdep_intf.h
@@ -69,4 +69,7 @@ void rtw_ndev_destructor(struct net_device *ndev);
int rtw_suspend_common(struct adapter *padapter);
int rtw_resume_common(struct adapter *padapter);

+int _netdev_open(struct net_device *pnetdev);
+int netdev_open(struct net_device *pnetdev);
+
#endif /* _OSDEP_INTF_H_ */
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 9ae7d46fb501..3713c62a477c 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -193,8 +193,6 @@ MODULE_PARM_DESC(rtw_tx_pwr_lmt_enable, "0:Disable, 1:Enable, 2: Depend on efuse
module_param(rtw_tx_pwr_by_rate, int, 0644);
MODULE_PARM_DESC(rtw_tx_pwr_by_rate, "0:Disable, 1:Enable, 2: Depend on efuse");

-int _netdev_open(struct net_device *pnetdev);
-int netdev_open(struct net_device *pnetdev);
static int netdev_close(struct net_device *pnetdev);

static void loadparam(struct adapter *padapter, struct net_device *pnetdev)
--
2.20.1

2021-03-22 14:34:32

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 08/11] staging: rtl8723bs: move function prototypes out of hal/odm.c

fix the following checkpatch issues:

WARNING: externs should be avoided in .c files
285: FILE: drivers/staging/rtl8723bs/hal/odm.c:285:
+void odm_CommonInfoSelfInit(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
287: FILE: drivers/staging/rtl8723bs/hal/odm.c:287:
+void odm_CommonInfoSelfUpdate(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
289: FILE: drivers/staging/rtl8723bs/hal/odm.c:289:
+void odm_CmnInfoInit_Debug(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
291: FILE: drivers/staging/rtl8723bs/hal/odm.c:291:
+void odm_BasicDbgMessage(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
305: FILE: drivers/staging/rtl8723bs/hal/odm.c:305:
+void odm_RefreshRateAdaptiveMaskCE(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
309: FILE: drivers/staging/rtl8723bs/hal/odm.c:309:
+void odm_RSSIMonitorInit(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
311: FILE: drivers/staging/rtl8723bs/hal/odm.c:311:
+void odm_RSSIMonitorCheckCE(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
313: FILE: drivers/staging/rtl8723bs/hal/odm.c:313:
+void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
315: FILE: drivers/staging/rtl8723bs/hal/odm.c:315:
+void odm_SwAntDetectInit(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
317: FILE: drivers/staging/rtl8723bs/hal/odm.c:317:
+void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext);
--
WARNING: externs should be avoided in .c files
321: FILE: drivers/staging/rtl8723bs/hal/odm.c:321:
+void odm_GlobalAdapterCheck(void);
--
WARNING: externs should be avoided in .c files
323: FILE: drivers/staging/rtl8723bs/hal/odm.c:323:
+void odm_RefreshRateAdaptiveMask(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
325: FILE: drivers/staging/rtl8723bs/hal/odm.c:325:
+void ODM_TXPowerTrackingCheck(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
327: FILE: drivers/staging/rtl8723bs/hal/odm.c:327:
+void odm_RateAdaptiveMaskInit(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
330: FILE: drivers/staging/rtl8723bs/hal/odm.c:330:
+void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
338: FILE: drivers/staging/rtl8723bs/hal/odm.c:338:
+void odm_InitHybridAntDiv(struct dm_odm_t *pDM_Odm);
--
WARNING: externs should be avoided in .c files
340: FILE: drivers/staging/rtl8723bs/hal/odm.c:340:
+bool odm_StaDefAntSel(
--
WARNING: externs should be avoided in .c files
349: FILE: drivers/staging/rtl8723bs/hal/odm.c:349:
+void odm_SetRxIdleAnt(struct dm_odm_t *pDM_Odm, u8 Ant, bool bDualPath);
--
WARNING: externs should be avoided in .c files
353: FILE: drivers/staging/rtl8723bs/hal/odm.c:353:
+void odm_HwAntDiv(struct dm_odm_t *pDM_Odm);

moved function prototypes in hal/odm.h

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/hal/odm.c | 68 -----------------------------
drivers/staging/rtl8723bs/hal/odm.h | 62 ++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 68 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c
index 49d552105a65..1ede10f0b9da 100644
--- a/drivers/staging/rtl8723bs/hal/odm.c
+++ b/drivers/staging/rtl8723bs/hal/odm.c
@@ -279,80 +279,12 @@ u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] = {
0x3FE /* 36, +6.0dB */
};

-/* Local Function predefine. */
-
-/* START------------COMMON INFO RELATED--------------- */
-void odm_CommonInfoSelfInit(struct dm_odm_t *pDM_Odm);
-
-void odm_CommonInfoSelfUpdate(struct dm_odm_t *pDM_Odm);
-
-void odm_CmnInfoInit_Debug(struct dm_odm_t *pDM_Odm);
-
-void odm_BasicDbgMessage(struct dm_odm_t *pDM_Odm);
-
-/* END------------COMMON INFO RELATED--------------- */
-
-/* START---------------DIG--------------------------- */
-
-/* Remove by Yuchen */
-
-/* END---------------DIG--------------------------- */
-
-/* START-------BB POWER SAVE----------------------- */
-/* Remove BB power Saving by YuChen */
-/* END---------BB POWER SAVE----------------------- */
-
-void odm_RefreshRateAdaptiveMaskCE(struct dm_odm_t *pDM_Odm);
-
-/* Remove by YuChen */
-
-void odm_RSSIMonitorInit(struct dm_odm_t *pDM_Odm);
-
-void odm_RSSIMonitorCheckCE(struct dm_odm_t *pDM_Odm);
-
-void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm);
-
-void odm_SwAntDetectInit(struct dm_odm_t *pDM_Odm);
-
-void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext);
-
-
-
-void odm_GlobalAdapterCheck(void);
-
-void odm_RefreshRateAdaptiveMask(struct dm_odm_t *pDM_Odm);
-
-void ODM_TXPowerTrackingCheck(struct dm_odm_t *pDM_Odm);
-
-void odm_RateAdaptiveMaskInit(struct dm_odm_t *pDM_Odm);
-
-
-void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm);
-
/* Remove Edca by Yu Chen */


#define RxDefaultAnt1 0x65a9
#define RxDefaultAnt2 0x569a

-void odm_InitHybridAntDiv(struct dm_odm_t *pDM_Odm);
-
-bool odm_StaDefAntSel(
- struct dm_odm_t *pDM_Odm,
- u32 OFDM_Ant1_Cnt,
- u32 OFDM_Ant2_Cnt,
- u32 CCK_Ant1_Cnt,
- u32 CCK_Ant2_Cnt,
- u8 *pDefAnt
-);
-
-void odm_SetRxIdleAnt(struct dm_odm_t *pDM_Odm, u8 Ant, bool bDualPath);
-
-
-
-void odm_HwAntDiv(struct dm_odm_t *pDM_Odm);
-
-
/* */
/* 3 Export Interface */
/* */
diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h
index 3c8d76e42c99..42fb01aa15cd 100644
--- a/drivers/staging/rtl8723bs/hal/odm.h
+++ b/drivers/staging/rtl8723bs/hal/odm.h
@@ -1429,4 +1429,66 @@ void ODM_AntselStatistics_88C(

void ODM_DynamicARFBSelect(struct dm_odm_t *pDM_Odm, u8 rate, bool Collision_State);

+/* Local Function predefine. */
+
+/* START------------COMMON INFO RELATED--------------- */
+void odm_CommonInfoSelfInit(struct dm_odm_t *pDM_Odm);
+
+void odm_CommonInfoSelfUpdate(struct dm_odm_t *pDM_Odm);
+
+void odm_CmnInfoInit_Debug(struct dm_odm_t *pDM_Odm);
+
+void odm_BasicDbgMessage(struct dm_odm_t *pDM_Odm);
+
+/* END------------COMMON INFO RELATED--------------- */
+
+/* START---------------DIG--------------------------- */
+
+/* Remove by Yuchen */
+
+/* END---------------DIG--------------------------- */
+
+/* START-------BB POWER SAVE----------------------- */
+/* Remove BB power Saving by YuChen */
+/* END---------BB POWER SAVE----------------------- */
+
+void odm_RefreshRateAdaptiveMaskCE(struct dm_odm_t *pDM_Odm);
+
+/* Remove by YuChen */
+
+void odm_RSSIMonitorInit(struct dm_odm_t *pDM_Odm);
+
+void odm_RSSIMonitorCheckCE(struct dm_odm_t *pDM_Odm);
+
+void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm);
+
+void odm_SwAntDetectInit(struct dm_odm_t *pDM_Odm);
+
+void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext);
+
+void odm_GlobalAdapterCheck(void);
+
+void odm_RefreshRateAdaptiveMask(struct dm_odm_t *pDM_Odm);
+
+void ODM_TXPowerTrackingCheck(struct dm_odm_t *pDM_Odm);
+
+void odm_RateAdaptiveMaskInit(struct dm_odm_t *pDM_Odm);
+
+void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm);
+
+void odm_InitHybridAntDiv(struct dm_odm_t *pDM_Odm);
+
+bool odm_StaDefAntSel(
+ struct dm_odm_t *pDM_Odm,
+ u32 OFDM_Ant1_Cnt,
+ u32 OFDM_Ant2_Cnt,
+ u32 CCK_Ant1_Cnt,
+ u32 CCK_Ant2_Cnt,
+ u8 *pDefAnt
+);
+
+void odm_SetRxIdleAnt(struct dm_odm_t *pDM_Odm, u8 Ant, bool bDualPath);
+
+void odm_HwAntDiv(struct dm_odm_t *pDM_Odm);
+
#endif
--
2.20.1

2021-03-22 14:34:35

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 10/11] staging: rtl8723bs: remove undefined function prototype in of os_dep/sdio_intf.c

fix the following checkpatch issue:

WARNING: externs should be avoided in .c files
486: FILE: drivers/staging/rtl8723bs/os_dep/sdio_intf.c:486:
+extern int pm_netdev_close(struct net_device *pnetdev, u8 bnormal);

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index 8f8549eee23e..185919b6963f 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -483,7 +483,6 @@ static void rtw_dev_remove(struct sdio_func *func)
}

extern int pm_netdev_open(struct net_device *pnetdev, u8 bnormal);
-extern int pm_netdev_close(struct net_device *pnetdev, u8 bnormal);

static int rtw_sdio_suspend(struct device *dev)
{
--
2.20.1

2021-03-22 14:35:13

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 11/11] staging: rtl8723bs: remove unnecessary extern in os_dep/sdio_intf.c

remove unnecessary extern.

The function is defined static in os_dep/os_intfs.c and used only once
in the same file

remove also a blank line

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 1 -
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 2 --
2 files changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 3713c62a477c..321f7c45ed95 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -1027,7 +1027,6 @@ void rtw_ips_dev_unload(struct adapter *padapter)
rtw_hal_deinit(padapter);
}

-
static int pm_netdev_open(struct net_device *pnetdev, u8 bnormal)
{
int status = -1;
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index 185919b6963f..156ad91d33ee 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -482,8 +482,6 @@ static void rtw_dev_remove(struct sdio_func *func)
RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("-rtw_dev_remove\n"));
}

-extern int pm_netdev_open(struct net_device *pnetdev, u8 bnormal);
-
static int rtw_sdio_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
--
2.20.1

2021-03-22 14:36:19

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 07/11] staging: rtl8723bs: delete extern declarations in core/rtw_wlan_util.c

fix the following checkpatch issues:

WARNING: externs should be avoided in .c files
28: FILE: drivers/staging/rtl8723bs/core/rtw_wlan_util.c:28:
+extern unsigned char RTW_WPA_OUI[];
--
WARNING: externs should be avoided in .c files
29: FILE: drivers/staging/rtl8723bs/core/rtw_wlan_util.c:29:
+extern unsigned char WPA_TKIP_CIPHER[4];

Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index bfd55a0356f5..760b0ea4e9bd 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -25,9 +25,6 @@ static unsigned char AIRGOCAP_OUI[] = {0x00, 0x0a, 0xf5};
static unsigned char RSN_TKIP_CIPHER[4] = {0x00, 0x0f, 0xac, 0x02};
static unsigned char WPA_TKIP_CIPHER[4] = {0x00, 0x50, 0xf2, 0x02};

-extern unsigned char RTW_WPA_OUI[];
-extern unsigned char WPA_TKIP_CIPHER[4];
-
#define R2T_PHY_DELAY (0)

/* define WAIT_FOR_BCN_TO_MIN (3000) */
--
2.20.1

2021-03-22 16:11:16

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 11/11] staging: rtl8723bs: remove unnecessary extern in os_dep/sdio_intf.c

On Mon, Mar 22, 2021 at 03:31:49PM +0100, Fabio Aiuto wrote:
> remove unnecessary extern.
>
> The function is defined static in os_dep/os_intfs.c and used only once
> in the same file
>
> remove also a blank line

That needs to go to a separate patch :(

2021-03-22 16:11:23

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 03/11] staging: rtl8723bs: moved function prototype out of core/rtw_ioctl_set.c and core/rtw_mlme.c

On Mon, Mar 22, 2021 at 03:31:41PM +0100, Fabio Aiuto wrote:
> fix the following checkpatch issues:
>
> WARNING: externs should be avoided in .c files
> 40: FILE: drivers/staging/rtl8723bs/core/rtw_ioctl_set.c:40:
> +u8 rtw_do_join(struct adapter *padapter);
>
> WARNING: externs should be avoided in .c files
> 15: FILE: drivers/staging/rtl8723bs/core/rtw_mlme.c:15:
> +extern u8 rtw_do_join(struct adapter *padapter);
>
> moved function prototype in include/rtw_ioctl_set.h
>
> Signed-off-by: Fabio Aiuto <[email protected]>
> ---
> drivers/staging/rtl8723bs/core/rtw_ioctl_set.c | 1 -
> drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 --
> drivers/staging/rtl8723bs/include/rtw_ioctl_set.h | 2 ++
> 3 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> index cb14855742f7..7d858cae2395 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> @@ -37,7 +37,6 @@ u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
> return ret;
> }
>
> -u8 rtw_do_join(struct adapter *padapter);
> u8 rtw_do_join(struct adapter *padapter)
> {
> struct list_head *plist, *phead;
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> index 95cfef118a94..1ee86ec2dee7 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> @@ -12,8 +12,6 @@
> #include <hal_btcoex.h>
> #include <linux/jiffies.h>
>
> -extern u8 rtw_do_join(struct adapter *padapter);
> -
> int rtw_init_mlme_priv(struct adapter *padapter)
> {
> int i;
> diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> index 4b929b84040a..55722c1366aa 100644
> --- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> +++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> @@ -28,6 +28,8 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1
> u8 rtw_validate_bssid(u8 *bssid);
> u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid);
>
> +u8 rtw_do_join(struct adapter *padapter);
> +

This is already in drivers/staging/rtl8188eu/include/hal_intf.h, why
declare it again?

I'm stopping here on reviewing this patchset, please look closer at it
again and fix up and resend a v2.

thanks,

greg k-h

2021-03-22 16:11:34

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 04/11] staging: rtl8723bs: moved function prototypes out of core/rtw_recv.c

On Mon, Mar 22, 2021 at 03:31:42PM +0100, Fabio Aiuto wrote:
> fix the following checkpatch issues:
>
> WARNING: externs should be avoided in .c files
> 1190: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:1190:
> +signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame);
>
> and then moved all function prototypes but one in include/rtw_recv.h
>
> Signed-off-by: Fabio Aiuto <[email protected]>
> ---
> drivers/staging/rtl8723bs/core/rtw_recv.c | 31 +-----------
> drivers/staging/rtl8723bs/include/rtw_recv.h | 51 ++++++++++++++++++++
> 2 files changed, 52 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
> index 1fa381663b4c..9ef2408ded57 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
> @@ -305,7 +305,6 @@ struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue)
>
> }
>
> -signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe);
> signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe)
> {
>
> @@ -435,8 +434,6 @@ signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvfra
>
> }
>
> -/* decrypt and set the ivlen, icvlen of the recv_frame */
> -union recv_frame *decryptor(struct adapter *padapter, union recv_frame *precv_frame);
> union recv_frame *decryptor(struct adapter *padapter, union recv_frame *precv_frame)
> {
>
> @@ -527,8 +524,6 @@ union recv_frame *decryptor(struct adapter *padapter, union recv_frame *precv_fr
> return return_packet;
> }
>
> -/* set the security information in the recv_frame */
> -union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_frame);
> union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_frame)
> {
> u8 *psta_addr = NULL;
> @@ -606,7 +601,6 @@ union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_fram
> return prtnframe;
> }
>
> -signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache);
> signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache)
> {
> signed int tid = precv_frame->u.hdr.attrib.priority;
> @@ -634,7 +628,6 @@ signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo
>
> }
>
> -void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame);
> void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame)
> {
> unsigned char pwrbit;
> @@ -671,7 +664,6 @@ void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame
> }
> }
>
> -void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame);
> void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame)
> {
> struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
> @@ -723,7 +715,6 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame)
> }
> }
>
> -void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct sta_info *sta);
> void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct sta_info *sta)
> {
> int sz;
> @@ -755,8 +746,6 @@ void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct
> traffic_check_for_leave_lps(padapter, false, 0);
> }
>
> -signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
> - struct sta_info **psta);
> signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
> struct sta_info **psta)
> {
> @@ -850,8 +839,6 @@ signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_f
> return ret;
> }
>
> -signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
> - struct sta_info **psta);
> signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
> struct sta_info **psta)
> {
> @@ -992,8 +979,6 @@ signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_fr
> return ret;
> }
>
> -signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
> - struct sta_info **psta);
> signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame,
> struct sta_info **psta)
> {
> @@ -1049,7 +1034,6 @@ signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_fr
> return ret;
> }
>
> -signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame);
> signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame)
> {
> struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
> @@ -1186,8 +1170,6 @@ signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *
>
> }
>
> -union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_frame *precv_frame);
> -signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame);
> signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame)
> {
> /* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
> @@ -1227,7 +1209,6 @@ signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *
>
> }
>
> -signed int validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame);
> signed int validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame)
> {
> u8 bretry;
> @@ -1459,7 +1440,6 @@ static inline void dump_rx_packet(u8 *ptr)
> DBG_871X("#############################\n");
> }
>
> -signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame);
> signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame)
> {
> /* shall check frame subtype, to / from ds, da, bssid */
> @@ -1557,9 +1537,6 @@ signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_
> return retval;
> }
>
> -
> -/* remove the wlanhdr and add the eth_hdr */
> -signed int wlanhdr_to_ethhdr(union recv_frame *precvframe);
> signed int wlanhdr_to_ethhdr(union recv_frame *precvframe)
> {
> signed int rmv_len;
> @@ -1886,7 +1863,6 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)
> return _SUCCESS;
> }
>
> -int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num);
> int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
> {
> struct adapter *padapter = preorder_ctrl->padapter;
> @@ -1955,7 +1931,6 @@ int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
> return true;
> }
>
> -int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe);
> int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe)
> {
> struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
> @@ -2017,7 +1992,7 @@ void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u
> pdbgpriv->dbg_rx_ampdu_loss_count += (current_seq - prev_seq);
>
> }
> -int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl, int bforced);
> +
> int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl, int bforced)
> {
> struct list_head *phead, *plist;
> @@ -2125,7 +2100,6 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr
> return bPktInBuf;
> }
>
> -int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *prframe);
> int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *prframe)
> {
> int retval = _SUCCESS;
> @@ -2279,7 +2253,6 @@ void rtw_reordering_ctrl_timeout_handler(struct timer_list *t)
>
> }
>
> -int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prframe);
> int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prframe)
> {
> int retval = _SUCCESS;
> @@ -2402,8 +2375,6 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr
> return ret;
> }
>
> -
> -int recv_func(struct adapter *padapter, union recv_frame *rframe);

Shouldn't this just be a static function? And same for others in here?

thanks,

greg k-h

2021-03-22 16:11:50

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 02/11] staging: rtl8723bs: moved function prototypes out of core/rtw_efuse.c

On Mon, Mar 22, 2021 at 03:31:40PM +0100, Fabio Aiuto wrote:
> fix the following checkpatch issues:
>
> WARNING: externs should be avoided in .c files
> 35: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:35:
> +bool
>
> moved two function prototypes in include/rtw_efuse.h
>
> Signed-off-by: Fabio Aiuto <[email protected]>
> ---
> drivers/staging/rtl8723bs/core/rtw_efuse.c | 10 ----------
> drivers/staging/rtl8723bs/include/rtw_efuse.h | 3 +++
> 2 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
> index 32ca10f01413..0772397738d4 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
> @@ -32,11 +32,6 @@ u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
> #define REG_EFUSE_CTRL 0x0030
> #define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */
>
> -bool
> -Efuse_Read1ByteFromFakeContent(
> - struct adapter *padapter,
> - u16 Offset,
> - u8 *Value);
> bool
> Efuse_Read1ByteFromFakeContent(
> struct adapter *padapter,
> @@ -53,11 +48,6 @@ Efuse_Read1ByteFromFakeContent(
> return true;
> }
>
> -bool
> -Efuse_Write1ByteToFakeContent(
> - struct adapter *padapter,
> - u16 Offset,
> - u8 Value);
> bool
> Efuse_Write1ByteToFakeContent(
> struct adapter *padapter,
> diff --git a/drivers/staging/rtl8723bs/include/rtw_efuse.h b/drivers/staging/rtl8723bs/include/rtw_efuse.h
> index 5bae46ecd9de..1f304df8c421 100644
> --- a/drivers/staging/rtl8723bs/include/rtw_efuse.h
> +++ b/drivers/staging/rtl8723bs/include/rtw_efuse.h
> @@ -103,6 +103,9 @@ extern u8 fakeBTEfuseInitMap[];
> extern u8 fakeBTEfuseModifiedMap[];
> /*------------------------Export global variable----------------------------*/
>
> +bool Efuse_Read1ByteFromFakeContent(struct adapter *padapter, u16 Offset, u8 *Value);
> +bool Efuse_Write1ByteToFakeContent(struct adapter *padapter, u16 Offset, u8 Value);

No, there's no need for this to be in a .h file, it is only called from
one .c file.

Make the thing static and all should be fine, right?

thanks,

greg k-h

2021-03-22 16:13:11

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 05/11] staging: rtl8723bs: remove argument in recv_indicatepkts_pkt_loss_cnt

On Mon, Mar 22, 2021 at 03:31:43PM +0100, Fabio Aiuto wrote:
> remove debug_priv argument so function prototype can be
> easily moved away
>
> Signed-off-by: Fabio Aiuto <[email protected]>
> ---
> drivers/staging/rtl8723bs/core/rtw_recv.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
> index 9ef2408ded57..e2a6afed723c 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
> @@ -1983,13 +1983,13 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec
>
> }
>
> -void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq);
> -void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq)
> +u64 recv_indicatepkts_pkt_loss_cnt(u64 prev_seq, u64 current_seq);

But you did not drop the function prototype, why keep it?

And shouldn't this be static?

thanks,

greg k-h

2021-03-22 18:21:33

by Fabio Aiuto

[permalink] [raw]
Subject: Re: [PATCH 05/11] staging: rtl8723bs: remove argument in recv_indicatepkts_pkt_loss_cnt

On Mon, Mar 22, 2021 at 05:11:13PM +0100, Greg KH wrote:
> On Mon, Mar 22, 2021 at 03:31:43PM +0100, Fabio Aiuto wrote:
> > remove debug_priv argument so function prototype can be
> > easily moved away
> >
> > Signed-off-by: Fabio Aiuto <[email protected]>
> > ---
> > drivers/staging/rtl8723bs/core/rtw_recv.c | 11 ++++++-----
> > 1 file changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
> > index 9ef2408ded57..e2a6afed723c 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_recv.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
> > @@ -1983,13 +1983,13 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec
> >
> > }
> >
> > -void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq);
> > -void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq)
> > +u64 recv_indicatepkts_pkt_loss_cnt(u64 prev_seq, u64 current_seq);
>
> But you did not drop the function prototype, why keep it?
>
> And shouldn't this be static?
>
> thanks,
>
> greg k-h

I moved it in a header file in the next patch [6/11]. However is better a
static function when possible and drop the prototype.

2021-03-22 18:27:00

by Fabio Aiuto

[permalink] [raw]
Subject: Re: [PATCH 02/11] staging: rtl8723bs: moved function prototypes out of core/rtw_efuse.c

On Mon, Mar 22, 2021 at 05:07:53PM +0100, Greg KH wrote:
> On Mon, Mar 22, 2021 at 03:31:40PM +0100, Fabio Aiuto wrote:
> > fix the following checkpatch issues:
> >
> > WARNING: externs should be avoided in .c files
> > 35: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:35:
> > +bool
> >
> > moved two function prototypes in include/rtw_efuse.h
> >
> > Signed-off-by: Fabio Aiuto <[email protected]>
> > ---
> > drivers/staging/rtl8723bs/core/rtw_efuse.c | 10 ----------
> > drivers/staging/rtl8723bs/include/rtw_efuse.h | 3 +++
> > 2 files changed, 3 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
> > index 32ca10f01413..0772397738d4 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
> > @@ -32,11 +32,6 @@ u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
> > #define REG_EFUSE_CTRL 0x0030
> > #define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */
> >
> > -bool
> > -Efuse_Read1ByteFromFakeContent(
> > - struct adapter *padapter,
> > - u16 Offset,
> > - u8 *Value);
> > bool
> > Efuse_Read1ByteFromFakeContent(
> > struct adapter *padapter,
> > @@ -53,11 +48,6 @@ Efuse_Read1ByteFromFakeContent(
> > return true;
> > }
> >
> > -bool
> > -Efuse_Write1ByteToFakeContent(
> > - struct adapter *padapter,
> > - u16 Offset,
> > - u8 Value);
> > bool
> > Efuse_Write1ByteToFakeContent(
> > struct adapter *padapter,
> > diff --git a/drivers/staging/rtl8723bs/include/rtw_efuse.h b/drivers/staging/rtl8723bs/include/rtw_efuse.h
> > index 5bae46ecd9de..1f304df8c421 100644
> > --- a/drivers/staging/rtl8723bs/include/rtw_efuse.h
> > +++ b/drivers/staging/rtl8723bs/include/rtw_efuse.h
> > @@ -103,6 +103,9 @@ extern u8 fakeBTEfuseInitMap[];
> > extern u8 fakeBTEfuseModifiedMap[];
> > /*------------------------Export global variable----------------------------*/
> >
> > +bool Efuse_Read1ByteFromFakeContent(struct adapter *padapter, u16 Offset, u8 *Value);
> > +bool Efuse_Write1ByteToFakeContent(struct adapter *padapter, u16 Offset, u8 Value);
>
> No, there's no need for this to be in a .h file, it is only called from
> one .c file.
>
> Make the thing static and all should be fine, right?
>
> thanks,
>
> greg k-h

ok, better static function when possibile.

Thank you Greg,

fabio

2021-03-22 18:32:44

by Fabio Aiuto

[permalink] [raw]
Subject: Re: [PATCH 03/11] staging: rtl8723bs: moved function prototype out of core/rtw_ioctl_set.c and core/rtw_mlme.c

On Mon, Mar 22, 2021 at 05:09:00PM +0100, Greg KH wrote:
> On Mon, Mar 22, 2021 at 03:31:41PM +0100, Fabio Aiuto wrote:
> > fix the following checkpatch issues:
> >
> > WARNING: externs should be avoided in .c files
> > 40: FILE: drivers/staging/rtl8723bs/core/rtw_ioctl_set.c:40:
> > +u8 rtw_do_join(struct adapter *padapter);
> >
> > WARNING: externs should be avoided in .c files
> > 15: FILE: drivers/staging/rtl8723bs/core/rtw_mlme.c:15:
> > +extern u8 rtw_do_join(struct adapter *padapter);
> >
> > moved function prototype in include/rtw_ioctl_set.h
> >
> > Signed-off-by: Fabio Aiuto <[email protected]>
> > ---
> > drivers/staging/rtl8723bs/core/rtw_ioctl_set.c | 1 -
> > drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 --
> > drivers/staging/rtl8723bs/include/rtw_ioctl_set.h | 2 ++
> > 3 files changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> > index cb14855742f7..7d858cae2395 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> > @@ -37,7 +37,6 @@ u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
> > return ret;
> > }
> >
> > -u8 rtw_do_join(struct adapter *padapter);
> > u8 rtw_do_join(struct adapter *padapter)
> > {
> > struct list_head *plist, *phead;
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > index 95cfef118a94..1ee86ec2dee7 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > @@ -12,8 +12,6 @@
> > #include <hal_btcoex.h>
> > #include <linux/jiffies.h>
> >
> > -extern u8 rtw_do_join(struct adapter *padapter);
> > -
> > int rtw_init_mlme_priv(struct adapter *padapter)
> > {
> > int i;
> > diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> > index 4b929b84040a..55722c1366aa 100644
> > --- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> > +++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> > @@ -28,6 +28,8 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1
> > u8 rtw_validate_bssid(u8 *bssid);
> > u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid);
> >
> > +u8 rtw_do_join(struct adapter *padapter);
> > +
>
> This is already in drivers/staging/rtl8188eu/include/hal_intf.h, why
> declare it again?

I didn't check the rtl8188eu for that's not a module rtl8723bs depends on

> I'm stopping here on reviewing this patchset, please look closer at it
> again and fix up and resend a v2.
>
> thanks,
>
> greg k-h

Ok, I will fix everything and send you a patchset v2

2021-03-22 19:32:26

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 02/11] staging: rtl8723bs: moved function prototypes out of core/rtw_efuse.c

On Mon, Mar 22, 2021 at 03:31:40PM +0100, Fabio Aiuto wrote:
> fix the following checkpatch issues:
>
> WARNING: externs should be avoided in .c files
> 35: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:35:
> +bool
>
> moved two function prototypes in include/rtw_efuse.h

Can't you just make these functions static instead?

regards,
dan carpenter

2021-03-23 07:16:32

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 03/11] staging: rtl8723bs: moved function prototype out of core/rtw_ioctl_set.c and core/rtw_mlme.c

On Mon, Mar 22, 2021 at 07:28:42PM +0100, Fabio Aiuto wrote:
> On Mon, Mar 22, 2021 at 05:09:00PM +0100, Greg KH wrote:
> > On Mon, Mar 22, 2021 at 03:31:41PM +0100, Fabio Aiuto wrote:
> > > fix the following checkpatch issues:
> > >
> > > WARNING: externs should be avoided in .c files
> > > 40: FILE: drivers/staging/rtl8723bs/core/rtw_ioctl_set.c:40:
> > > +u8 rtw_do_join(struct adapter *padapter);
> > >
> > > WARNING: externs should be avoided in .c files
> > > 15: FILE: drivers/staging/rtl8723bs/core/rtw_mlme.c:15:
> > > +extern u8 rtw_do_join(struct adapter *padapter);
> > >
> > > moved function prototype in include/rtw_ioctl_set.h
> > >
> > > Signed-off-by: Fabio Aiuto <[email protected]>
> > > ---
> > > drivers/staging/rtl8723bs/core/rtw_ioctl_set.c | 1 -
> > > drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 --
> > > drivers/staging/rtl8723bs/include/rtw_ioctl_set.h | 2 ++
> > > 3 files changed, 2 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> > > index cb14855742f7..7d858cae2395 100644
> > > --- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> > > +++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
> > > @@ -37,7 +37,6 @@ u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
> > > return ret;
> > > }
> > >
> > > -u8 rtw_do_join(struct adapter *padapter);
> > > u8 rtw_do_join(struct adapter *padapter)
> > > {
> > > struct list_head *plist, *phead;
> > > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > > index 95cfef118a94..1ee86ec2dee7 100644
> > > --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> > > @@ -12,8 +12,6 @@
> > > #include <hal_btcoex.h>
> > > #include <linux/jiffies.h>
> > >
> > > -extern u8 rtw_do_join(struct adapter *padapter);
> > > -
> > > int rtw_init_mlme_priv(struct adapter *padapter)
> > > {
> > > int i;
> > > diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> > > index 4b929b84040a..55722c1366aa 100644
> > > --- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> > > +++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
> > > @@ -28,6 +28,8 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1
> > > u8 rtw_validate_bssid(u8 *bssid);
> > > u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid);
> > >
> > > +u8 rtw_do_join(struct adapter *padapter);
> > > +
> >
> > This is already in drivers/staging/rtl8188eu/include/hal_intf.h, why
> > declare it again?
>
> I didn't check the rtl8188eu for that's not a module rtl8723bs depends on

Ugh, you are right, my fault, sorry for the noise.

greg k-h

2021-03-23 13:39:54

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH v2 0/9] fix extern declarations checkpatch issues

Fix extern declaration issues warned by checkpatch.

Changes in v2:
- removal of prototypes when function can be static
- move of static function defs inside file to let the code compile
- split last patch in two patches (one patch for blank line removal)

Fabio Aiuto (9):
staging: rtl8723bs: removed function prototypes in core/rtw_efuse.c
staging: rtl8723bs: moved function prototype out of
core/rtw_ioctl_set.c and core/rtw_mlme.c
staging: rtl8723bs: removed function prototypes and made statics in
core/rtw_recv.c
staging: rtl8723bs: delete extern declarations in core/rtw_wlan_util.c
staging: rtl8723bs: remove function prototypes in hal/odm.c
staging: rtl8723bs: move function prototypes out of os_dep/int_fs.c
staging: rtl8723bs: remove undefined function prototype in of
os_dep/sdio_intf.c
staging: rtl8723bs: remove unnecessary extern in os_dep/sdio_intf.c
staging: rtl8723bs: remove blank line os_dep/os_intfs.c

drivers/staging/rtl8723bs/core/rtw_efuse.c | 14 +-
.../staging/rtl8723bs/core/rtw_ioctl_set.c | 1 -
drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 -
drivers/staging/rtl8723bs/core/rtw_recv.c | 441 ++---
.../staging/rtl8723bs/core/rtw_wlan_util.c | 3 -
drivers/staging/rtl8723bs/hal/odm.c | 1717 ++++++++---------
.../staging/rtl8723bs/include/osdep_intf.h | 2 +
.../staging/rtl8723bs/include/rtw_ioctl_set.h | 2 +
.../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 -
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 5 +-
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 3 -
11 files changed, 1038 insertions(+), 1154 deletions(-)

--
2.20.1

2021-03-24 00:56:42

by Fabio Aiuto

[permalink] [raw]
Subject: Re: [PATCH 02/11] staging: rtl8723bs: moved function prototypes out of core/rtw_efuse.c

On Mon, Mar 22, 2021 at 10:29:27PM +0300, Dan Carpenter wrote:
> On Mon, Mar 22, 2021 at 03:31:40PM +0100, Fabio Aiuto wrote:
> > fix the following checkpatch issues:
> >
> > WARNING: externs should be avoided in .c files
> > 35: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:35:
> > +bool
> >
> > moved two function prototypes in include/rtw_efuse.h
>
> Can't you just make these functions static instead?
>
> regards,
> dan carpenter
>

Hi Dan,

sorry for my recent spamming, I forgot to cc you in my
patchset v2 submit.

Thank you,

fabio

2021-03-24 11:27:56

by Fabio Aiuto

[permalink] [raw]
Subject: Re: CHECKPATCH: missing a warning soon after include files decl -c

On Sat, Mar 20, 2021 at 04:28:51AM -0700, Joe Perches wrote:
>
> Actually, these would seem to be better as one or multiple functions with
> local statics or even as static inlines functions in the .h file
>
> $ git grep -w RTW_WPA_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char RTW_WPA_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c: if (!memcmp(RTW_WPA_OUI, oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char RTW_WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) ||
> drivers/staging/rtl8723bs/core/rtw_wlan_util.c:extern unsigned char RTW_WPA_OUI[];
> drivers/staging/rtl8723bs/core/rtw_wlan_util.c: if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) && (!memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4)))
>
> $ git grep -w WMM_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char WMM_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(WMM_OUI, oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char WMM_OUI[] = {0x00, 0x50, 0xf2, 0x02};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: (!memcmp(pIE->data, WMM_OUI, 4)) ||
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if (!memcmp(pIE->data, WMM_OUI, 4))
> drivers/staging/rtl8723bs/include/rtw_mlme_ext.h:extern unsigned char WMM_OUI[];
>
> $ git grep -w WPS_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char WPS_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(WPS_OUI, oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char WPS_OUI[] = {0x00, 0x50, 0xf2, 0x04};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: (!memcmp(pIE->data, WPS_OUI, 4))) {
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if ((!padapter->registrypriv.wifi_spec) && (!memcmp(pIE->data, WPS_OUI, 4))) {
>
> $ git grep -w P2P_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char P2P_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c: else if (!memcmp(P2P_OUI, oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char P2P_OUI[] = {0x50, 0x6F, 0x9A, 0x09};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c: if (!memcmp(frame_body + 2, P2P_OUI, 4)) {
>
> So maybe something like the below (written in email client, maybe typos)
>
> enum oui_type {
> RTW_WPA,
> WMM,
> WPS,
> P2P
> };
>
> bool is_oui_type(const u8 *mem, enum oui_type type)
> {
> static const u8 rtw_wpa[] = {0x00, 0x50, 0xf2, 0x01};
> static const u8 wmm[] = {0x00, 0x50, 0xf2, 0x02};
> static const u8 wps[] = {0x00, 0x50, 0xf2, 0x04};
> static const u8 p2p[] = {0x50, 0x6F, 0x9A, 0x09};
>
> const u8 *oui;
>
> if (type == RTW_WPA)
> oui = rtw_wpa;
> else if (type == WMM)
> oui = wmm;
> else if (type == WPS)
> oui = wps;
> else if (type == P2P)
> oui = p2p;
> else
> return false;
>
> return !memcmp(mem, oui, 4);
> }
>
> so for instance the P2P uses would become
>
> else if (is_oui_type(oui, P2P))
> and
> if (is_oui_type(frame_body + 2, P2P)) {
>
> though I think 4 byte OUIs are just odd.
>
> https://en.wikipedia.org/wiki/Organizationally_unique_identifier
>
> An organizationally unique identifier (OUI) is a 24-bit number that uniquely identifies a vendor, manufacturer, or other organization.
>
>
>

Hi,

is that good? May I do the same for others ouis? One small inline for each oui type instead
of a switch...

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 3cd9c61eec99..7d31f359cf37 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1664,7 +1664,7 @@ static void update_bcn_p2p_ie(struct adapter *padapter)

static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui)
{
- if (!memcmp(RTW_WPA_OUI, oui, 4))
+ if (is_rtw_wpa_oui(oui))
update_bcn_wpa_ie(padapter);

else if (!memcmp(WMM_OUI, oui, 4))
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 8aadcf72a7ba..e05f70e434a2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -57,7 +57,6 @@ static u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
/**************************************************
OUI definitions for the vendor specific IE
***************************************************/
-unsigned char RTW_WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01};
unsigned char WMM_OUI[] = {0x00, 0x50, 0xf2, 0x02};
unsigned char WPS_OUI[] = {0x00, 0x50, 0xf2, 0x04};
unsigned char P2P_OUI[] = {0x50, 0x6F, 0x9A, 0x09};
@@ -3194,7 +3193,7 @@ void issue_assocreq(struct adapter *padapter)

switch (pIE->ElementID) {
case WLAN_EID_VENDOR_SPECIFIC:
- if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) ||
+ if ((is_rtw_wpa_oui(pIE->data)) ||
(!memcmp(pIE->data, WMM_OUI, 4)) ||
(!memcmp(pIE->data, WPS_OUI, 4))) {
vs_ie_length = pIE->Length;
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 760b0ea4e9bd..8c73e44459eb 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1490,7 +1490,7 @@ unsigned int is_ap_in_tkip(struct adapter *padapter)

switch (pIE->ElementID) {
case WLAN_EID_VENDOR_SPECIFIC:
- if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) && (!memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4)))
+ if ((is_rtw_wpa_oui(pIE->data)) && (!memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4)))
return true;

break;
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index 1658450b386e..95ff682ef877 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -541,4 +541,10 @@ extern u32 g_wait_hiq_empty;
extern u8 g_fwdl_wintint_rdy_fail;
extern u8 g_fwdl_chksum_fail;

+/* OUI verification ruotines */
+static inline bool is_rtw_wpa_oui(const u8 *mem)
+{
+ static const char rtw_wpa[] = {0x00, 0x50, 0xf2, 0x01};
+ return !memcmp(mem, rtw_wpa, 4);
+}
#endif /* __DRV_TYPES_H__ */
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index fb283dc04ee2..14b570658b77 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -96,8 +96,6 @@ MCS rate definitions
#define MCS_RATE_4R (0xffffffff)
#define MCS_RATE_2R_13TO15_OFF (0x00001fff)

-
-extern unsigned char RTW_WPA_OUI[];
extern unsigned char WMM_OUI[];
extern unsigned char WPS_OUI[];
extern unsigned char WFD_OUI[];

thank you in advance,

fabio