staging: r8188eu: cleanup
cover staging: r8188eu: cleanup
These patches address style issues found by checkpatch.
Rebecca Mckeever (6):
staging: r8188eu: place constants on the right side of tests
staging: r8188eu: remove else after return
staging: r8188eu: correct misspelling in comment "conider" ->
"consider"
staging: r8188eu: format block comments
staging: r8188eu: remove unnecessary braces in conditional statements
staging: r8188eu: remove spaces before tabs
drivers/staging/r8188eu/core/rtw_cmd.c | 70 +++++++++++++------------- 1 file changed, 34 insertions(+), 36 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/6 staging: r8188eu: place constants on the right side of tests
Conform to Linux kernel coding style.
Reported by checkpatch:
WARNING: Comparisons should place the constant on the right side of the test
--- drivers/staging/r8188eu/core/rtw_cmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/r8188eu/core/rtw_cmd.c +3 -3
@@ -189,7 +189,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) cmd_obj->padapter = padapter; res =rtw_cmd_filter (pcmdpriv, cmd_obj); -if (_FAIL == res) { +if (res == _FAIL) {rtw_free_cmd_obj (cmd_obj); goto exit; }
@@ -260,7 +260,7 @@ int rtw_cmd_thread(void *context)if (!pcmd)continue ; -if (_FAIL ==rtw_cmd_filter (pcmdpriv, pcmd)) { +if (rtw_cmd_filter (pcmdpriv, pcmd) == _FAIL) { pcmd->res =H2C_DROPPED ; goto post_process; }
@@ -613,7 +613,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu res =rtw_enqueue_cmd (cmdpriv, cmdobj); }else {/* no need to enqueue, do the cmd hdl directly and free cmd parameter */ -if (H2C_SUCCESS !=disconnect_hdl (padapter, (u8 *)param)) +if (disconnect_hdl (padapter, (u8 *)param) !=H2C_SUCCESS ) res = _FAIL;kfree (param); }
Signature · 1 line
2.32.0
PATCH 2/6 staging: r8188eu: remove else after return
In reply to Rebecca MckeeverConform to Linux kernel coding style.
Reported by checkpatch:
WARNING: else is not generally useful after a break or return
--- drivers/staging/r8188eu/core/rtw_cmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_cmd.c +4 -2
@@ -1427,8 +1427,10 @@ void rtw_disassoc_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)spin_unlock_bh (&pmlmepriv->lock);return ; - }else /* clear bridge database */ -nat25_db_cleanup (padapter); + } + +/* clear bridge database */ +nat25_db_cleanup (padapter);/* free cmd */ rtw_free_cmd_obj (pcmd);
Signature · 1 line
2.32.0
PATCH 3/6 staging: r8188eu: correct misspelling in comment "conider" -> "consider"
In reply to Rebecca MckeeverCorrect spelling typo. Reported by checkpatch:
CHECK: 'conider' may be misspelled - perhaps 'consider'?
--- drivers/staging/r8188eu/core/rtw_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_cmd.c +1 -1
@@ -293,7 +293,7 @@ int rtw_cmd_thread(void *context)rtw_free_cmd_obj (pcmd); else/* todo: !!! fill rsp_buf to pcmd->rsp if (pcmd->rsp!= NULL) */ - pcmd_callback(pcmd->padapter, pcmd);/* need conider that free cmd_obj in rtw_cmd_callback */ + pcmd_callback(pcmd->padapter, pcmd);/* need consider that free cmd_obj in rtw_cmd_callback */ }else {rtw_free_cmd_obj (pcmd); }
Signature · 1 line
2.32.0
PATCH 4/6 staging: r8188eu: format block comments
In reply to Rebecca MckeeverAdd ' * ' or ' ' to beginning of block comment lines to conform to Linux kernel coding style.
Reported by checkpatch:
WARNING: Block comments use * on subsequent lines
--- drivers/staging/r8188eu/core/rtw_cmd.c | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/staging/r8188eu/core/rtw_cmd.c +14 -15
@@ -12,9 +12,9 @@#include "../include/rtl8188e_dm.h" /* -Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. -No irqsave is necessary. -*/ +* Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. +* No irqsave is necessary. +*/ static int _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) {
@@ -97,14 +97,13 @@ static void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) }/* -Calling Context: - -rtw_enqueue_cmd can only be called between kernel thread, -since only spin_lock is used. - -ISR/Call-Back functions can't call this sub-function. - -*/ +* Calling Context: +* +* rtw_enqueue_cmd can only be called between kernel thread, +* since only spin_lock is used. +* +* ISR/Call-Back functions can't call this sub-function. +*/ static int _rtw_enqueue_cmd (struct __queue *queue,struct cmd_obj *obj) {
@@ -319,10 +318,10 @@ int rtw_cmd_thread(void *context) }/* -rtw_sitesurvey_cmd(~) -### NOTE:#### (!!!!) -MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock -*/ +* rtw_sitesurvey_cmd(~) +* ### NOTE:#### (!!!!) +* MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock +*/ u8 rtw_sitesurvey_cmd (struct adapter *padapter,struct ndis_802_11_ssid *ssid,int ssid_num,struct rtw_ieee80211_channel *ch,int ch_num) {
Signature · 1 line
2.32.0
Re: [PATCH 4/6] staging: r8188eu: format block comments
Quoted 56 lines · Rebecca Mckeever
Add ' * ' or ' ' to beginning of block comment lines to conform to Linux kernel coding style.
Reported by checkpatch:
WARNING: Block comments use * on subsequent lines
Signed-off-by Rebecca Mckeever <[email protected]>--- drivers/staging/r8188eu/core/rtw_cmd.c | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-)drivers/staging/r8188eu/core/rtw_cmd.c +10
-12@@ -12,9 +12,9 @@#include "../include/rtl8188e_dm.h" /* -Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. -No irqsave is necessary. -*/ +* Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. +* No irqsave is necessary. +*/ static int _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) {@@ -97,14 +97,13 @@ static void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) }/* -Calling Context: - -rtw_enqueue_cmd can only be called between kernel thread, -since only spin_lock is used. - -ISR/Call-Back functions can't call this sub-function. - -*/ +* Calling Context: +* +* rtw_enqueue_cmd can only be called between kernel thread, +* since only spin_lock is used. +* +* ISR/Call-Back functions can't call this sub-function. +*/ static int _rtw_enqueue_cmd (struct __queue *queue,struct cmd_obj *obj) {@@ -319,10 +318,10 @@ int rtw_cmd_thread(void *context) }/* -rtw_sitesurvey_cmd(~)
drivers/staging/r8188eu/core/rtw_cmd.c int rtw_cmd_thread(void *context) · line 327
Quoted 10 lines
drivers/staging/r8188eu/core/rtw_cmd.c +4
-3-### NOTE:#### (!!!!) -MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock -*/ +* rtw_sitesurvey_cmd(~) +* ### NOTE:#### (!!!!) +* MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock +*/ u8 rtw_sitesurvey_cmd (struct adapter *padapter,struct ndis_802_11_ssid *ssid,int ssid_num,struct rtw_ieee80211_channel *ch,int ch_num) {
These changes are OK, but the rules in drivers/net/wireless specify using
/* abcd
rather than
/*
* abcd
Thus, if and when this driver is accepted into the drivers/net/wireless tree, another change will be needed. I suggest doing that now.
Larry
Re: [PATCH 4/6] staging: r8188eu: format block comments
Hi Larry,
Quoted 69 lines · Larry Finger
Quoted 51 lines · Rebecca Mckeever
Add ' * ' or ' ' to beginning of block comment lines to conform to Linux kernel coding style.
Reported by checkpatch:
WARNING: Block comments use * on subsequent lines
Signed-off-by Rebecca Mckeever <[email protected]>--- drivers/staging/r8188eu/core/rtw_cmd.c | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-)drivers/staging/r8188eu/core/rtw_cmd.c +10
-12@@ -12,9 +12,9 @@#include "../include/rtl8188e_dm.h" /* -Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. -No irqsave is necessary. -*/ +* Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. +* No irqsave is necessary. +*/ static int _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) {@@ -97,14 +97,13 @@ static void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) }/* -Calling Context: - -rtw_enqueue_cmd can only be called between kernel thread, -since only spin_lock is used. - -ISR/Call-Back functions can't call this sub-function. - -*/ +* Calling Context: +* +* rtw_enqueue_cmd can only be called between kernel thread, +* since only spin_lock is used. +* +* ISR/Call-Back functions can't call this sub-function. +*/ static int _rtw_enqueue_cmd (struct __queue *queue,struct cmd_obj *obj) {@@ -319,10 +318,10 @@ int rtw_cmd_thread(void *context) }/* -rtw_sitesurvey_cmd(~) drivers/staging/r8188eu/core/rtw_cmd.c int rtw_cmd_thread(void *context) · line 326
Quoted 10 lines
drivers/staging/r8188eu/core/rtw_cmd.c +4
-3-### NOTE:#### (!!!!) -MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock -*/ +* rtw_sitesurvey_cmd(~) +* ### NOTE:#### (!!!!) +* MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock +*/ u8 rtw_sitesurvey_cmd (struct adapter *padapter,struct ndis_802_11_ssid *ssid,int ssid_num,struct rtw_ieee80211_channel *ch,int ch_num) {These changes are OK, but the rules in
drivers/net/wirelessspecify using/* abcd
rather than
Quoted 7 lines
/*
* abcdThus, if and when this driver is accepted into the
drivers/net/wirelesstree, another change will be needed. I suggest doing that now.Larry
To clarify, I should make that change in this file?
And would it be better to make a new patch for it, or make a revision to this patch?
Thanks,
Rebecca
PATCH 5/6 staging: r8188eu: remove unnecessary braces in conditional statements
In reply to Rebecca MckeeverConform to Linux kernel coding style.
Reported by checkpatch:
WARNING: braces {} are not necessary for single statement blocks
WARNING: braces {} are not necessary for any arm of this statement
--- drivers/staging/r8188eu/core/rtw_cmd.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/staging/r8188eu/core/rtw_cmd.c +4 -7
@@ -331,13 +331,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid,struct cmd_priv *pcmdpriv = &padapter->cmdpriv;struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -if (check_fwstate (pmlmepriv, _FW_LINKED)) { +if (check_fwstate (pmlmepriv, _FW_LINKED))rtw_lps_ctrl_wk_cmd (padapter,LPS_CTRL_SCAN ,1 ); - } -if (check_fwstate (pmlmepriv, _FW_LINKED)) { +if (check_fwstate (pmlmepriv, _FW_LINKED))p2p_ps_wk_cmd (padapter,P2P_PS_SCAN ,1 ); - } ph2c =kzalloc (sizeof (struct cmd_obj ),GFP_ATOMIC );if (!ph2c)
@@ -517,11 +515,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecuritypriv->authenticator_ie[0 ] = (unsigned char )psecnetwork->IELength; -if (psecnetwork->IELength -12 <255 ) { +if (psecnetwork->IELength -12 <255 )memcpy (&psecuritypriv->authenticator_ie[1 ], &psecnetwork->IEs[12 ], psecnetwork->IELength -12 ); - }else { +else memcpy (&psecuritypriv->authenticator_ie[1 ], &psecnetwork->IEs[12 ],255 ); - } psecnetwork->IELength =0 ;/* Added by Albert 2009/02/18 */
Signature · 1 line
2.32.0
PATCH 6/6 staging: r8188eu: remove spaces before tabs
In reply to Rebecca MckeeverConform to Linux kernel coding style.
Reported by checkpatch:
WARNING: please, no space before tabs
--- drivers/staging/r8188eu/core/rtw_cmd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/r8188eu/core/rtw_cmd.c +8 -8
@@ -548,9 +548,9 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) phtpriv->ht_option = false;if (pregistrypriv->ht_enable) { -/* Added by Albert 2010/06/23 */ -/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ -/* Especially for Realtek 8192u SoftAP. */ +/* Added by Albert 2010/06/23 */ +/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ +/* Especially for Realtek 8192u SoftAP. */ if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) {
@@ -1010,7 +1010,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)u8 res = _SUCCESS;/* if (!pwrctrlpriv->bLeisurePs) */ -/* return res; */ +/* return res; */ if (enqueue) { ph2c =kzalloc (sizeof (struct cmd_obj ),GFP_ATOMIC );
@@ -1151,8 +1151,8 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType) } pdrvextra_cmd_parm->ec_id =P2P_PROTO_WK_CID ; - pdrvextra_cmd_parm->type_size = intCmdType;/* As the command tppe. */ - pdrvextra_cmd_parm->pbuf =NULL ;/* Must be NULL here */ + pdrvextra_cmd_parm->type_size = intCmdType;/* As the command tppe. */ + pdrvextra_cmd_parm->pbuf =NULL ;/* Must be NULL here */ init_h2fwcmd_w_parm_no_rsp (ph2c, pdrvextra_cmd_parm,GEN_CMD_CODE (_Set_Drv_Extra));
@@ -1378,8 +1378,8 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf)p2p_ps_wk_hdl (padapter, pdrvextra_cmd->type_size);break ;case P2P_PROTO_WK_CID : -/* Commented by Albert 2011/07/01 */ -/* I used the type_size as the type command */ +/* Commented by Albert 2011/07/01 */ +/* I used the type_size as the type command */ p2p_protocol_wk_hdl (padapter, pdrvextra_cmd->type_size);break ;case CHECK_HIQ_WK_CID :
Signature · 1 line
2.32.0
Re: [PATCH 6/6] staging: r8188eu: remove spaces before tabs
Quoted 49 lines · Rebecca Mckeever
Conform to Linux kernel coding style.
Reported by checkpatch:
WARNING: please, no space before tabs
Signed-off-by Rebecca Mckeever <[email protected]>--- drivers/staging/r8188eu/core/rtw_cmd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/staging/r8188eu/core/rtw_cmd.c +6
-6@@ -548,9 +548,9 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) phtpriv->ht_option = false;if (pregistrypriv->ht_enable) { -/* Added by Albert 2010/06/23 */ -/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ -/* Especially for Realtek 8192u SoftAP. */ +/* Added by Albert 2010/06/23 */ +/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ +/* Especially for Realtek 8192u SoftAP. */ if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) {@@ -1010,7 +1010,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)u8 res = _SUCCESS;/* if (!pwrctrlpriv->bLeisurePs) */ -/* return res; */ +/* return res; */ if (enqueue) { ph2c =kzalloc (sizeof (struct cmd_obj ),GFP_ATOMIC );@@ -1151,8 +1151,8 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType) } pdrvextra_cmd_parm->ec_id =P2P_PROTO_WK_CID ; - pdrvextra_cmd_parm->type_size = intCmdType;/* As the command tppe. */ - pdrvextra_cmd_parm->pbuf =NULL ;/* Must be NULL here */ + pdrvextra_cmd_parm->type_size = intCmdType;/* As the command tppe. */ + pdrvextra_cmd_parm->pbuf =NULL ;/* Must be NULL here */ init_h2fwcmd_w_parm_no_rsp (ph2c, pdrvextra_cmd_parm,GEN_CMD_CODE (_Set_Drv_Extra));
drivers/staging/r8188eu/core/rtw_cmd.c u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf) · line 1385
Quoted 10 lines
drivers/staging/r8188eu/core/rtw_cmd.c +2
-2@@ -1378,8 +1378,8 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf)p2p_ps_wk_hdl (padapter, pdrvextra_cmd->type_size);break ;case P2P_PROTO_WK_CID : -/* Commented by Albert 2011/07/01 */ -/* I used the type_size as the type command */ +/* Commented by Albert 2011/07/01 */ +/* I used the type_size as the type command */ p2p_protocol_wk_hdl (padapter, pdrvextra_cmd->type_size);break ;case CHECK_HIQ_WK_CID :
Congratulations on a very clear set of patches. Each performs a single change exactly as required by the rules.
For all 6,
Thanks,
Larry
Re: [PATCH 6/6] staging: r8188eu: remove spaces before tabs
In reply to Rebecca MckeeverQuoted 16 lines · Rebecca Mckeever
Conform to Linux kernel coding style.
Reported by checkpatch:
WARNING: please, no space before tabs
Signed-off-by Rebecca Mckeever <[email protected]>--- drivers/staging/r8188eu/core/rtw_cmd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/staging/r8188eu/core/rtw_cmd.c +0
-0
drivers/staging/r8188eu/core/rtw_cmd.c u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) · line 551
Quoted 7 lines
drivers/staging/r8188eu/core/rtw_cmd.c +1
-3@@ -548,9 +548,9 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) phtpriv->ht_option = false;if (pregistrypriv->ht_enable) { -/* Added by Albert 2010/06/23 */ -/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ -/* Especially for Realtek 8192u SoftAP. */ +/* Added by Albert 2010/06/23 */
In follow on patches you can delete these sorts of "Added by Albert 2010" comments.
drivers/staging/r8188eu/core/rtw_cmd.c u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) · line 1013
Quoted 11 lines
drivers/staging/r8188eu/core/rtw_cmd.c +3
-1+/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ +/* Especially for Realtek 8192u SoftAP. */ if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) {@@ -1010,7 +1010,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)u8 res = _SUCCESS;/* if (!pwrctrlpriv->bLeisurePs) */ -/* return res; */ +/* return res; */
And this commented out code.
drivers/staging/r8188eu/core/rtw_cmd.c u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType) · line 1154
Quoted 10 lines
drivers/staging/r8188eu/core/rtw_cmd.c +1
-2if (enqueue) { ph2c =kzalloc (sizeof (struct cmd_obj ),GFP_ATOMIC );@@ -1151,8 +1151,8 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType) } pdrvextra_cmd_parm->ec_id =P2P_PROTO_WK_CID ; - pdrvextra_cmd_parm->type_size = intCmdType;/* As the command tppe. */ - pdrvextra_cmd_parm->pbuf =NULL ;/* Must be NULL here */ + pdrvextra_cmd_parm->type_size = intCmdType;/* As the command tppe. */
^
s/tppe/type/. It's noting the "size = type". (Which is an ugly hack).
regards,
dan carpenter