staging: r8188eu: some refactoring and cleanup
cover staging: r8188eu: some refactoring and cleanup
Drop some redundant checks and cleanup the unused functions.
Vihas Makwana (3):
staging: r8188eu: drop redundant if check in IS_MCAST
staging: r8188eu: drop redundant if check in check_fwstate
staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error
drivers/staging/r8188eu/include/rtw_mlme.h | 43 +--------------------- drivers/staging/r8188eu/include/usb_ops.h | 7 +--- drivers/staging/r8188eu/include/wifi.h | 5 +-- 3 files changed, 3 insertions(+), 52 deletions(-)
Signature · 1 line
2.30.2
PATCH 1/3 staging: r8188eu: drop redundant if check in IS_MCAST
The if check is redundant. Drop it and simplify the funciton.
--- drivers/staging/r8188eu/include/wifi.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/r8188eu/include/wifi.h +1 -4
@@ -244,10 +244,7 @@ enum WIFI_REG_DOMAIN {static inline bool IS_MCAST (unsigned char *da) { -if ((*da) &0x01 ) -return true; -else -return false; +return (*da) &0x01 ; }static inline unsigned char *get_da (unsigned char *pframe)
Signature · 1 line
2.30.2
PATCH 2/3 staging: r8188eu: drop redundant if check in check_fwstate
In reply to Vihas MakwanaThe if check is redundant. Drop it and simplify the funciton.
Also, drop clr_fwstate(), clr_fwstate_ex(), up_scanned_network() and down_scanned_network() as they are not used anywhere.
--- drivers/staging/r8188eu/include/rtw_mlme.h | 43 +--------------------- 1 file changed, 1 insertion(+), 42 deletions(-)
drivers/staging/r8188eu/include/rtw_mlme.h +1 -42
@@ -453,15 +453,7 @@ static inline u8 *get_bssid(struct mlme_priv *pmlmepriv)static inline bool check_fwstate (struct mlme_priv *pmlmepriv,int state) { -if (pmlmepriv->fw_state & state) -return true; - -return false; -} - -static inline int get_fwstate (struct mlme_priv *pmlmepriv) -{ -return pmlmepriv->fw_state; +return pmlmepriv->fw_state & state; }/*
@@ -487,39 +479,6 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state) pmlmepriv->bScanInProcess = false; } -/* -* No Limit on the calling context, -* therefore set it to be the critical section... -*/ -static inline void clr_fwstate (struct mlme_priv *pmlmepriv,int state) -{ -spin_lock_bh (&pmlmepriv->lock); -if (check_fwstate (pmlmepriv, state)) - pmlmepriv->fw_state ^= state; -spin_unlock_bh (&pmlmepriv->lock); -} - -static inline void clr_fwstate_ex (struct mlme_priv *pmlmepriv,int state) -{ -spin_lock_bh (&pmlmepriv->lock); -_clr_fwstate_ (pmlmepriv, state); -spin_unlock_bh (&pmlmepriv->lock); -} - -static inline void up_scanned_network (struct mlme_priv *pmlmepriv) -{ -spin_lock_bh (&pmlmepriv->lock); - pmlmepriv->num_of_scanned++; -spin_unlock_bh (&pmlmepriv->lock); -} - -static inline void down_scanned_network (struct mlme_priv *pmlmepriv) -{ -spin_lock_bh (&pmlmepriv->lock); - pmlmepriv->num_of_scanned--; -spin_unlock_bh (&pmlmepriv->lock); -} -static inline void set_scanned_network_val (struct mlme_priv *pmlmepriv,int val) {spin_lock_bh (&pmlmepriv->lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerRe: [PATCH 2/3] staging: r8188eu: drop redundant if check in check_fwstate
Quoted 4 lines · Vihas Makwana
The if check is redundant. Drop it and simplify the funciton.
Also, drop
clr_fwstate(),clr_fwstate_ex(),up_scanned_network()anddown_scanned_network()as they are not used anywhere.
When you write "also" in a changelog text, that's a huge hint that you should break this up into multiple patches.
Remember, do only one logical thing per change. This should be split up into 2 patches.
thanks,
greg k-h
PATCH 3/3 staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error
In reply to Vihas MakwanaThe if check and variable "value" is redundant. Drop it and simplify the funciton.
--- drivers/staging/r8188eu/include/usb_ops.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/staging/r8188eu/include/usb_ops.h +1 -6
@@ -27,12 +27,7 @@*/ static inline bool rtw_inc_and_chk_continual_urb_error (struct dvobj_priv *dvobj) { -int value =atomic_inc_return (&dvobj->continual_urb_error); - -if (value >MAX_CONTINUAL_URB_ERR ) -return true; - -return false; +return atomic_inc_return (&dvobj->continual_urb_error) >MAX_CONTINUAL_URB_ERR ; }/*
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerRe: [PATCH 3/3] staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error
Quoted 14 lines · Vihas Makwana
The if check and variable "value" is redundant. Drop it and simplify the funciton.
Signed-off-by Vihas Makwana <[email protected]>--- drivers/staging/r8188eu/include/usb_ops.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/staging/r8188eu/include/usb_ops.h +0
-0@@ -27,12 +27,7 @@*/
drivers/staging/r8188eu/include/usb_ops.h line 31
Quoted 10 lines
drivers/staging/r8188eu/include/usb_ops.h +1
-6static inline bool rtw_inc_and_chk_continual_urb_error (struct dvobj_priv *dvobj) { -int value =atomic_inc_return (&dvobj->continual_urb_error); - -if (value >MAX_CONTINUAL_URB_ERR ) -return true; - -return false; +return atomic_inc_return (&dvobj->continual_urb_error) >MAX_CONTINUAL_URB_ERR ; }
Let's leave this as-is because it's a mess and should be fixed up anyway. No need to count urb errors as atomic values, this is crazy.
thanks,
greg k-h