* [PATCH 0/3] staging: r8188eu: some refactoring and cleanup
@ 2022-04-05 12:42 Vihas Makwana
2022-04-05 12:42 ` [PATCH 1/3] staging: r8188eu: drop redundant if check in IS_MCAST Vihas Makwana
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Vihas Makwana @ 2022-04-05 12:42 UTC (permalink / raw)
To: Larry Finger, Phillip Potter, Greg Kroah-Hartman,
Michael Straube, Dan Carpenter, Pavel Skripkin
Cc: linux-staging, linux-kernel, Vihas Makwana
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(-)
--
2.30.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] staging: r8188eu: drop redundant if check in IS_MCAST
2022-04-05 12:42 [PATCH 0/3] staging: r8188eu: some refactoring and cleanup Vihas Makwana
@ 2022-04-05 12:42 ` Vihas Makwana
2022-04-05 12:42 ` [PATCH 2/3] staging: r8188eu: drop redundant if check in check_fwstate Vihas Makwana
2022-04-05 12:42 ` [PATCH 3/3] staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error Vihas Makwana
2 siblings, 0 replies; 6+ messages in thread
From: Vihas Makwana @ 2022-04-05 12:42 UTC (permalink / raw)
To: Larry Finger, Phillip Potter, Greg Kroah-Hartman,
Michael Straube, Dan Carpenter, Pavel Skripkin
Cc: linux-staging, linux-kernel, Vihas Makwana
The if check is redundant. Drop it and simplify the funciton.
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
---
drivers/staging/r8188eu/include/wifi.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h
index e10cf17d6..88ed6b4a0 100644
--- a/drivers/staging/r8188eu/include/wifi.h
+++ b/drivers/staging/r8188eu/include/wifi.h
@@ -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)
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] staging: r8188eu: drop redundant if check in check_fwstate
2022-04-05 12:42 [PATCH 0/3] staging: r8188eu: some refactoring and cleanup Vihas Makwana
2022-04-05 12:42 ` [PATCH 1/3] staging: r8188eu: drop redundant if check in IS_MCAST Vihas Makwana
@ 2022-04-05 12:42 ` Vihas Makwana
2022-04-05 14:13 ` Greg Kroah-Hartman
2022-04-05 12:42 ` [PATCH 3/3] staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error Vihas Makwana
2 siblings, 1 reply; 6+ messages in thread
From: Vihas Makwana @ 2022-04-05 12:42 UTC (permalink / raw)
To: Larry Finger, Phillip Potter, Greg Kroah-Hartman,
Michael Straube, Dan Carpenter, Pavel Skripkin
Cc: linux-staging, linux-kernel, Vihas Makwana
The 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.
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
---
drivers/staging/r8188eu/include/rtw_mlme.h | 43 +---------------------
1 file changed, 1 insertion(+), 42 deletions(-)
diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h
index 37d217aaf..3b6f70ad8 100644
--- a/drivers/staging/r8188eu/include/rtw_mlme.h
+++ b/drivers/staging/r8188eu/include/rtw_mlme.h
@@ -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);
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error
2022-04-05 12:42 [PATCH 0/3] staging: r8188eu: some refactoring and cleanup Vihas Makwana
2022-04-05 12:42 ` [PATCH 1/3] staging: r8188eu: drop redundant if check in IS_MCAST Vihas Makwana
2022-04-05 12:42 ` [PATCH 2/3] staging: r8188eu: drop redundant if check in check_fwstate Vihas Makwana
@ 2022-04-05 12:42 ` Vihas Makwana
2022-04-05 14:14 ` Greg Kroah-Hartman
2 siblings, 1 reply; 6+ messages in thread
From: Vihas Makwana @ 2022-04-05 12:42 UTC (permalink / raw)
To: Larry Finger, Phillip Potter, Greg Kroah-Hartman,
Michael Straube, Dan Carpenter, Pavel Skripkin
Cc: linux-staging, linux-kernel, Vihas Makwana
The if check and variable "value" is redundant. Drop it and simplify
the funciton.
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
---
drivers/staging/r8188eu/include/usb_ops.h | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/staging/r8188eu/include/usb_ops.h b/drivers/staging/r8188eu/include/usb_ops.h
index ddc46cb44..c5982704c 100644
--- a/drivers/staging/r8188eu/include/usb_ops.h
+++ b/drivers/staging/r8188eu/include/usb_ops.h
@@ -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;
}
/*
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] staging: r8188eu: drop redundant if check in check_fwstate
2022-04-05 12:42 ` [PATCH 2/3] staging: r8188eu: drop redundant if check in check_fwstate Vihas Makwana
@ 2022-04-05 14:13 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2022-04-05 14:13 UTC (permalink / raw)
To: Vihas Makwana
Cc: Larry Finger, Phillip Potter, Michael Straube, Dan Carpenter,
Pavel Skripkin, linux-staging, linux-kernel
On Tue, Apr 05, 2022 at 06:12:39PM +0530, Vihas Makwana wrote:
> The 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.
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error
2022-04-05 12:42 ` [PATCH 3/3] staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error Vihas Makwana
@ 2022-04-05 14:14 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2022-04-05 14:14 UTC (permalink / raw)
To: Vihas Makwana
Cc: Larry Finger, Phillip Potter, Michael Straube, Dan Carpenter,
Pavel Skripkin, linux-staging, linux-kernel
On Tue, Apr 05, 2022 at 06:12:40PM +0530, Vihas Makwana wrote:
> The if check and variable "value" is redundant. Drop it and simplify
> the funciton.
>
> Signed-off-by: Vihas Makwana <makvihas@gmail.com>
> ---
> drivers/staging/r8188eu/include/usb_ops.h | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/include/usb_ops.h b/drivers/staging/r8188eu/include/usb_ops.h
> index ddc46cb44..c5982704c 100644
> --- a/drivers/staging/r8188eu/include/usb_ops.h
> +++ b/drivers/staging/r8188eu/include/usb_ops.h
> @@ -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;
> }
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-06 1:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 12:42 [PATCH 0/3] staging: r8188eu: some refactoring and cleanup Vihas Makwana
2022-04-05 12:42 ` [PATCH 1/3] staging: r8188eu: drop redundant if check in IS_MCAST Vihas Makwana
2022-04-05 12:42 ` [PATCH 2/3] staging: r8188eu: drop redundant if check in check_fwstate Vihas Makwana
2022-04-05 14:13 ` Greg Kroah-Hartman
2022-04-05 12:42 ` [PATCH 3/3] staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error Vihas Makwana
2022-04-05 14:14 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).