staging: rtl8188eu: fix line over 80 characters - style
PATCH 1/3 staging: rtl8188eu: fix line over 80 characters - style
Line break array declaration to clear a 'line over 80 characters' checkpatch warning. For consistency replace 0x0 with 0x00.
--- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +4 -1
@@ -39,7 +39,10 @@ extern unsigned char REALTEK_96B_IE[];/******************************************************** MCS rate definitions *********************************************************/ -unsigned char MCS_rate_1R[16 ] = {0xff ,0x00 ,0x0 ,0x0 ,0x01 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 }; +unsigned char MCS_rate_1R[16 ] = { +0xff ,0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 +};/******************************************************** ChannelPlan definitions
Signature · 1 line
2.19.0
PATCH 2/3 staging: rtl8188eu: cleanup array declaration - style
Cleanup array declaration to clear two 'line over 80 characters' checkpatch warnings and improve readability.
--- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +14 -18
@@ -3836,24 +3836,20 @@ Following are the initialization functions for WiFi MLME*****************************************************************************/ static struct mlme_handler mlme_sta_tbl[] = { - {WIFI_ASSOCREQ ,"OnAssocReq" , &OnAssocReq}, - {WIFI_ASSOCRSP ,"OnAssocRsp" , &OnAssocRsp}, - {WIFI_REASSOCREQ ,"OnReAssocReq" , &OnAssocReq}, - {WIFI_REASSOCRSP ,"OnReAssocRsp" , &OnAssocRsp}, - {WIFI_PROBEREQ ,"OnProbeReq" , &OnProbeReq}, - {WIFI_PROBERSP ,"OnProbeRsp" , &OnProbeRsp}, - -/*---------------------------------------------------------- -below 2 are reserved ------------------------------------------------------------*/ - {0 ,"DoReserved" , &DoReserved}, - {0 ,"DoReserved" , &DoReserved}, - {WIFI_BEACON ,"OnBeacon" , &OnBeacon}, - {WIFI_ATIM ,"OnATIM" , &OnAtim}, - {WIFI_DISASSOC ,"OnDisassoc" , &OnDisassoc}, - {WIFI_AUTH ,"OnAuth" , &OnAuthClient}, - {WIFI_DEAUTH ,"OnDeAuth" , &OnDeAuth}, - {WIFI_ACTION ,"OnAction" , &OnAction}, + {WIFI_ASSOCREQ ,"OnAssocReq" , &OnAssocReq}, + {WIFI_ASSOCRSP ,"OnAssocRsp" , &OnAssocRsp}, + {WIFI_REASSOCREQ ,"OnReAssocReq" , &OnAssocReq}, + {WIFI_REASSOCRSP ,"OnReAssocRsp" , &OnAssocRsp}, + {WIFI_PROBEREQ ,"OnProbeReq" , &OnProbeReq}, + {WIFI_PROBERSP ,"OnProbeRsp" , &OnProbeRsp}, + {0 ,"DoReserved" , &DoReserved}, + {0 ,"DoReserved" , &DoReserved}, + {WIFI_BEACON ,"OnBeacon" , &OnBeacon}, + {WIFI_ATIM ,"OnATIM" , &OnAtim}, + {WIFI_DISASSOC ,"OnDisassoc" , &OnDisassoc}, + {WIFI_AUTH ,"OnAuth" , &OnAuthClient}, + {WIFI_DEAUTH ,"OnDeAuth" , &OnDeAuth}, + {WIFI_ACTION ,"OnAction" , &OnAction}, };int init_hw_mlme_ext (struct adapter *padapter)
Signature · 1 line
2.19.0
PATCH 3/3 staging: rtl8188eu: rewrite if tests - style
In reply to Michael StraubeRewrite if tests to clear a 'line over 80 characters' and 'Comparisons should place the constant on the right side of the test' checkpatch warning.
--- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +1 -1
@@ -3957,7 +3957,7 @@ static void init_channel_list(struct adapter *padapter,if (!has_channel (channel_set, chanset_size, ch))continue ; -if ((0 == padapter->registrypriv.ht_enable) && (8 == o->inc)) +if (!padapter->registrypriv.ht_enable && o->inc ==8 )continue ; if ((0 == (padapter->registrypriv.cbw40_enable & BIT(1))) &&
Signature · 1 line
2.19.0
Quoted 2 lines · Michael Straube
Line break array declaration to clear a 'line over 80 characters' checkpatch warning. For consistency replace
0x0with0x00.
[]
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +0
-0
[]
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c extern unsigned char REALTEK_96B_IE[]; · line 45
Quoted 9 lines
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +4
-1@@ -39,7 +39,10 @@ extern unsigned char REALTEK_96B_IE[];/******************************************************** MCS rate definitions *********************************************************/ -unsigned char MCS_rate_1R[16 ] = {0xff ,0x00 ,0x0 ,0x0 ,0x01 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 }; +unsigned char MCS_rate_1R[16 ] = { +0xff ,0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 +};
Might as well make this const u8.
Here and as well the extern declarations in
drivers/staging/rtl8188eu/core/rtw_mlme.c
and
drivers/staging/rtl8188eu/include/rtw_mlme.h
Re: [PATCH 2/3] staging: rtl8188eu: cleanup array declaration - style
In reply to Michael StraubeQuoted 2 lines · Michael Straube
Cleanup array declaration to clear two 'line over 80 characters' checkpatch warnings and improve readability.
[]
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +0
-0
[]
Quoted 27 lines
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +5
-18@@ -3836,24 +3836,20 @@ Following are the initialization functions for WiFi MLME*****************************************************************************/ static struct mlme_handler mlme_sta_tbl[] = { - {WIFI_ASSOCREQ ,"OnAssocReq" , &OnAssocReq}, - {WIFI_ASSOCRSP ,"OnAssocRsp" , &OnAssocRsp}, - {WIFI_REASSOCREQ ,"OnReAssocReq" , &OnAssocReq}, - {WIFI_REASSOCRSP ,"OnReAssocRsp" , &OnAssocRsp}, - {WIFI_PROBEREQ ,"OnProbeReq" , &OnProbeReq}, - {WIFI_PROBERSP ,"OnProbeRsp" , &OnProbeRsp}, - -/*---------------------------------------------------------- -below 2 are reserved ------------------------------------------------------------*/ - {0 ,"DoReserved" , &DoReserved}, - {0 ,"DoReserved" , &DoReserved}, - {WIFI_BEACON ,"OnBeacon" , &OnBeacon}, - {WIFI_ATIM ,"OnATIM" , &OnAtim}, - {WIFI_DISASSOC ,"OnDisassoc" , &OnDisassoc}, - {WIFI_AUTH ,"OnAuth" , &OnAuthClient}, - {WIFI_DEAUTH ,"OnDeAuth" , &OnDeAuth}, - {WIFI_ACTION ,"OnAction" , &OnAction}, + {WIFI_ASSOCREQ ,"OnAssocReq" , &OnAssocReq}, + {WIFI_ASSOCRSP ,"OnAssocRsp" , &OnAssocRsp}, + {WIFI_REASSOCREQ ,"OnReAssocReq" , &OnAssocReq}, + {WIFI_REASSOCRSP ,"OnReAssocRsp" , &OnAssocRsp}, + {WIFI_PROBEREQ ,"OnProbeReq" , &OnProbeReq},
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c Following are the initialization functions for WiFi MLME · line 3853
Quoted 10 lines
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +9
-0+ {WIFI_PROBERSP, "OnProbeRsp", &OnProbeRsp}, + {0, "DoReserved", &DoReserved}, + {0, "DoReserved", &DoReserved}, + {WIFI_BEACON, "OnBeacon", &OnBeacon}, + {WIFI_ATIM, "OnATIM", &OnAtim}, + {WIFI_DISASSOC, "OnDisassoc", &OnDisassoc}, + {WIFI_AUTH, "OnAuth", &OnAuthClient}, + {WIFI_DEAUTH, "OnDeAuth", &OnDeAuth}, + {WIFI_ACTION, "OnAction", &OnAction}, };
Perhaps const here too, and as well, the struct declaration could use const char * instead of char *
Re: [PATCH 2/3] staging: rtl8188eu: cleanup array declaration - style
Quoted 38 lines · Joe Perches
Quoted 2 lines · Michael Straube
Cleanup array declaration to clear two 'line over 80 characters' checkpatch warnings and improve readability.
[]
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +0
-0[]
Quoted 32 lines
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +10
-18@@ -3836,24 +3836,20 @@ Following are the initialization functions for WiFi MLME*****************************************************************************/ static struct mlme_handler mlme_sta_tbl[] = { - {WIFI_ASSOCREQ ,"OnAssocReq" , &OnAssocReq}, - {WIFI_ASSOCRSP ,"OnAssocRsp" , &OnAssocRsp}, - {WIFI_REASSOCREQ ,"OnReAssocReq" , &OnAssocReq}, - {WIFI_REASSOCRSP ,"OnReAssocRsp" , &OnAssocRsp}, - {WIFI_PROBEREQ ,"OnProbeReq" , &OnProbeReq}, - {WIFI_PROBERSP ,"OnProbeRsp" , &OnProbeRsp}, - -/*---------------------------------------------------------- -below 2 are reserved ------------------------------------------------------------*/ - {0 ,"DoReserved" , &DoReserved}, - {0 ,"DoReserved" , &DoReserved}, - {WIFI_BEACON ,"OnBeacon" , &OnBeacon}, - {WIFI_ATIM ,"OnATIM" , &OnAtim}, - {WIFI_DISASSOC ,"OnDisassoc" , &OnDisassoc}, - {WIFI_AUTH ,"OnAuth" , &OnAuthClient}, - {WIFI_DEAUTH ,"OnDeAuth" , &OnDeAuth}, - {WIFI_ACTION ,"OnAction" , &OnAction}, + {WIFI_ASSOCREQ ,"OnAssocReq" , &OnAssocReq}, + {WIFI_ASSOCRSP ,"OnAssocRsp" , &OnAssocRsp}, + {WIFI_REASSOCREQ ,"OnReAssocReq" , &OnAssocReq}, + {WIFI_REASSOCRSP ,"OnReAssocRsp" , &OnAssocRsp}, + {WIFI_PROBEREQ ,"OnProbeReq" , &OnProbeReq}, + {WIFI_PROBERSP ,"OnProbeRsp" , &OnProbeRsp}, + {0 ,"DoReserved" , &DoReserved}, + {0 ,"DoReserved" , &DoReserved}, + {WIFI_BEACON ,"OnBeacon" , &OnBeacon}, + {WIFI_ATIM ,"OnATIM" , &OnAtim},
Quoted 9 lines
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c Following are the initialization functions for WiFi MLME · line 3853
Quoted 5 lines
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +4
-0+ {WIFI_DISASSOC, "OnDisassoc", &OnDisassoc}, + {WIFI_AUTH, "OnAuth", &OnAuthClient}, + {WIFI_DEAUTH, "OnDeAuth", &OnDeAuth}, + {WIFI_ACTION, "OnAction", &OnAction}, };Perhaps const here too, and as well, the struct declaration could use const char * instead of char *
Just to be sure, it should be
static const struct mlme_handler mlme_sta_tbl[] = {
?
Re: [PATCH 2/3] staging: rtl8188eu: cleanup array declaration - style
In reply to Joe PerchesQuoted 5 lines · Joe Perches
Quoted 1 line
static struct mlme_handler mlme_sta_tbl[] = {Perhaps const here too, and as well, the struct declaration could use const char * instead of char *
Making it const gives following warning.
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c: In function 'mgt_dispatcher':drivers/staging/rtl8188eu/core/rtw_mlme_ext.c:4114:9: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
ptable = mlme_sta_tbl;
^So I'll only change the char * to const char *.
Thanks.
Am 03.10.18 um 23:26 schrieb Joe Perches:
Quoted 18 lines · Michael Straube
Quoted 2 lines
Line break array declaration to clear a 'line over 80 characters' checkpatch warning. For consistency replace
0x0with0x00.[]
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +0
-0[]
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c extern unsigned char REALTEK_96B_IE[]; · line 45
Quoted 9 lines
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +4
-1@@ -39,7 +39,10 @@ extern unsigned char REALTEK_96B_IE[];/******************************************************** MCS rate definitions *********************************************************/ -unsigned char MCS_rate_1R[16 ] = {0xff ,0x00 ,0x0 ,0x0 ,0x01 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 }; +unsigned char MCS_rate_1R[16 ] = { +0xff ,0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 +};Might as well make this const u8.
Quoted 6 lines
Here and as well the extern declarations in
drivers/staging/rtl8188eu/core/rtw_mlme.c
and
drivers/staging/rtl8188eu/include/rtw_mlme.h
I'll send a patch with your suggestions.
Thanks.
Michael
Re: [PATCH 2/3] staging: rtl8188eu: cleanup array declaration - style
In reply to Michael StraubeQuoted 8 lines · Michael Straube
Quoted 5 lines · Joe Perches
Quoted 1 line
static struct mlme_handler mlme_sta_tbl[] = {Perhaps const here too, and as well, the struct declaration could use const char * instead of char *
Quoted 5 lines
Making it const gives following warning.
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c: In function 'mgt_dispatcher':drivers/staging/rtl8188eu/core/rtw_mlme_ext.c:4114:9: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
ptable =mlme_sta_tbl;
No worries, then it's not appropriate to use const.
It's just most common for this sort of table to be const but if this driver is reassigning values in the table, then it can't be const.
It is possible though that the code might not be suitable for multiple simultaneous instances of the device type.
Dunno. I don't use it nor have I inspected the code.