All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings
@ 2022-05-16 17:03 Vihas Makwana
  2022-05-16 17:03 ` [PATCH 1/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_p2p Vihas Makwana
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Vihas Makwana @ 2022-05-16 17:03 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Greg Kroah-Hartman, Michael Straube
  Cc: linux-staging, linux-kernel, Dan Carpenter, Pavel Skripkin,
	Vihas Makwana

This patchset fixes following checkpatch warning:
    WARNING: Comparisons should place the constant on the right side of the test

Compiled tested only.

Vihas Makwana (3):
  staging: r8188eu: fix checkpatch warnings in rtw_p2p
  staging: r8188eu: fix checkpatch warnings in rtw_pwrctrl
  staging: r8188eu: fix checkpatch warnings in rtw_wlan_util

 drivers/staging/r8188eu/core/rtw_p2p.c       |  8 ++++----
 drivers/staging/r8188eu/core/rtw_pwrctrl.c   | 12 ++++++------
 drivers/staging/r8188eu/core/rtw_wlan_util.c |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_p2p
  2022-05-16 17:03 [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings Vihas Makwana
@ 2022-05-16 17:03 ` Vihas Makwana
  2022-05-16 17:03 ` [PATCH 2/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_pwrctrl Vihas Makwana
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Vihas Makwana @ 2022-05-16 17:03 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Greg Kroah-Hartman, Michael Straube
  Cc: linux-staging, linux-kernel, Dan Carpenter, Pavel Skripkin,
	Vihas Makwana

Refactor the code to fix following warning:
    WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Vihas Makwana <makvihas@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_p2p.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c
index 59bb1bd12..c3884c49b 100644
--- a/drivers/staging/r8188eu/core/rtw_p2p.c
+++ b/drivers/staging/r8188eu/core/rtw_p2p.c
@@ -872,7 +872,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l
 				}
 
 				psta->dev_name_len = 0;
-				if (WPS_ATTR_DEVICE_NAME == be16_to_cpu(*(__be16 *)pattr_content)) {
+				if (be16_to_cpu(*(__be16 *)pattr_content) == WPS_ATTR_DEVICE_NAME) {
 					dev_name_len = be16_to_cpu(*(__be16 *)(pattr_content + 2));
 
 					psta->dev_name_len = (sizeof(psta->dev_name) < dev_name_len) ? sizeof(psta->dev_name) : dev_name_len;
@@ -1213,7 +1213,7 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe
 				if (attr_content == P2P_STATUS_SUCCESS) {
 					/*	Do nothing. */
 				} else {
-					if (P2P_STATUS_FAIL_INFO_UNAVAILABLE == attr_content) {
+					if (attr_content == P2P_STATUS_FAIL_INFO_UNAVAILABLE) {
 						rtw_p2p_set_state(pwdinfo, P2P_STATE_RX_INFOR_NOREADY);
 					} else {
 						rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL);
@@ -1891,7 +1891,7 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role)
 
 	if (role == P2P_ROLE_DEVICE || role == P2P_ROLE_CLIENT || role == P2P_ROLE_GO) {
 		/* leave IPS/Autosuspend */
-		if (_FAIL == rtw_pwr_wakeup(padapter)) {
+		if (rtw_pwr_wakeup(padapter) == _FAIL) {
 			ret = _FAIL;
 			goto exit;
 		}
@@ -1905,7 +1905,7 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role)
 		init_wifidirect_info(padapter, role);
 
 	} else if (role == P2P_ROLE_DISABLE) {
-		if (_FAIL == rtw_pwr_wakeup(padapter)) {
+		if (rtw_pwr_wakeup(padapter) == _FAIL) {
 			ret = _FAIL;
 			goto exit;
 		}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_pwrctrl
  2022-05-16 17:03 [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings Vihas Makwana
  2022-05-16 17:03 ` [PATCH 1/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_p2p Vihas Makwana
@ 2022-05-16 17:03 ` Vihas Makwana
  2022-05-16 19:45   ` Pavel Skripkin
  2022-05-16 17:03 ` [PATCH 3/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_wlan_util Vihas Makwana
  2022-05-16 19:49 ` [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings Pavel Skripkin
  3 siblings, 1 reply; 7+ messages in thread
From: Vihas Makwana @ 2022-05-16 17:03 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Greg Kroah-Hartman, Michael Straube
  Cc: linux-staging, linux-kernel, Dan Carpenter, Pavel Skripkin,
	Vihas Makwana

Refactor the code to fix following warnings:
    WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Vihas Makwana <makvihas@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 6990808ef..a54d47ba8 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -59,7 +59,7 @@ int ips_leave(struct adapter *padapter)
 			pwrpriv->rf_pwrstate = rf_on;
 		}
 
-		if ((_WEP40_ == psecuritypriv->dot11PrivacyAlgrthm) || (_WEP104_ == psecuritypriv->dot11PrivacyAlgrthm)) {
+		if ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_)) {
 			set_channel_bwmode(padapter, padapter->mlmeextpriv.cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
 			for (keyid = 0; keyid < 4; keyid++) {
 				if (pmlmepriv->key_mask & BIT(keyid)) {
@@ -198,7 +198,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
 		return;
 
 	if (pwrpriv->pwr_mode == ps_mode) {
-		if (PS_MODE_ACTIVE == ps_mode)
+		if (ps_mode == PS_MODE_ACTIVE)
 			return;
 
 		if ((pwrpriv->smart_ps == smart_ps) &&
@@ -356,7 +356,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 
 	pwrctrlpriv->LpsIdleCount = 0;
 	pwrctrlpriv->power_mgnt = padapter->registrypriv.power_mgnt;/*  PS_MODE_MIN; */
-	pwrctrlpriv->bLeisurePs = PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt;
+	pwrctrlpriv->bLeisurePs =  pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE;
 
 	pwrctrlpriv->bFwCurrentInPSMode = false;
 
@@ -409,12 +409,12 @@ int rtw_pm_set_lps(struct adapter *padapter, u8 mode)
 
 	if (mode < PS_MODE_NUM) {
 		if (pwrctrlpriv->power_mgnt != mode) {
-			if (PS_MODE_ACTIVE == mode)
+			if (mode == PS_MODE_ACTIVE)
 				LeaveAllPowerSaveMode(padapter);
 			else
 				pwrctrlpriv->LpsIdleCount = 2;
 			pwrctrlpriv->power_mgnt = mode;
-			pwrctrlpriv->bLeisurePs = PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt;
+			pwrctrlpriv->bLeisurePs = pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE;
 		}
 	} else {
 		ret = -EINVAL;
@@ -432,7 +432,7 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode)
 		return 0;
 	} else if (mode == IPS_NONE) {
 		rtw_ips_mode_req(pwrctrlpriv, mode);
-		if ((padapter->bSurpriseRemoved == 0) && (_FAIL == rtw_pwr_wakeup(padapter)))
+		if ((padapter->bSurpriseRemoved == 0) && (rtw_pwr_wakeup(padapter) == _FAIL))
 			return -EFAULT;
 	} else {
 		return -EINVAL;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_wlan_util
  2022-05-16 17:03 [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings Vihas Makwana
  2022-05-16 17:03 ` [PATCH 1/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_p2p Vihas Makwana
  2022-05-16 17:03 ` [PATCH 2/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_pwrctrl Vihas Makwana
@ 2022-05-16 17:03 ` Vihas Makwana
  2022-05-16 19:49 ` [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings Pavel Skripkin
  3 siblings, 0 replies; 7+ messages in thread
From: Vihas Makwana @ 2022-05-16 17:03 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Greg Kroah-Hartman, Michael Straube
  Cc: linux-staging, linux-kernel, Dan Carpenter, Pavel Skripkin,
	Vihas Makwana

Refactor the code to fix following warnings:
    WARNING: Comparisons should place the constant on the right side of the test
    CHECK: Comparison to NULL could be written "p"

Signed-off-by: Vihas Makwana <makvihas@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
index 27035eac6..3f4456901 100644
--- a/drivers/staging/r8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c
@@ -962,7 +962,7 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 *pframe, u32 packet_len)
 	else
 		hidden_ssid = false;
 
-	if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) {
+	if (p && (!hidden_ssid && (*(p + 1)))) {
 		memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
 		bssid->Ssid.SsidLength = *(p + 1);
 	} else {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_pwrctrl
  2022-05-16 17:03 ` [PATCH 2/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_pwrctrl Vihas Makwana
@ 2022-05-16 19:45   ` Pavel Skripkin
  2022-05-17 13:51     ` Vihas Makwana
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Skripkin @ 2022-05-16 19:45 UTC (permalink / raw)
  To: Vihas Makwana, Larry Finger, Phillip Potter, Greg Kroah-Hartman,
	Michael Straube
  Cc: linux-staging, linux-kernel, Dan Carpenter

Hi Vihas,

On 5/16/22 20:03, Vihas Makwana wrote:
> Refactor the code to fix following warnings:
>      WARNING: Comparisons should place the constant on the right side of the test
> 
> Signed-off-by: Vihas Makwana <makvihas@gmail.com>
> ---

[code snip]

>   		if ((pwrpriv->smart_ps == smart_ps) &&
> @@ -356,7 +356,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
>   
>   	pwrctrlpriv->LpsIdleCount = 0;
>   	pwrctrlpriv->power_mgnt = padapter->registrypriv.power_mgnt;/*  PS_MODE_MIN; */
> -	pwrctrlpriv->bLeisurePs = PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt;
> +	pwrctrlpriv->bLeisurePs =  pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE;
>   

Please remove extra space




With regards,
Pavel Skripkin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings
  2022-05-16 17:03 [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings Vihas Makwana
                   ` (2 preceding siblings ...)
  2022-05-16 17:03 ` [PATCH 3/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_wlan_util Vihas Makwana
@ 2022-05-16 19:49 ` Pavel Skripkin
  3 siblings, 0 replies; 7+ messages in thread
From: Pavel Skripkin @ 2022-05-16 19:49 UTC (permalink / raw)
  To: Vihas Makwana, Larry Finger, Phillip Potter, Greg Kroah-Hartman,
	Michael Straube
  Cc: linux-staging, linux-kernel, Dan Carpenter

Hi Vihas,

On 5/16/22 20:03, Vihas Makwana wrote:
> This patchset fixes following checkpatch warning:
>      WARNING: Comparisons should place the constant on the right side of the test
> 
> Compiled tested only.
> 
> Vihas Makwana (3):
>    staging: r8188eu: fix checkpatch warnings in rtw_p2p
>    staging: r8188eu: fix checkpatch warnings in rtw_pwrctrl
>    staging: r8188eu: fix checkpatch warnings in rtw_wlan_util
> 
>   drivers/staging/r8188eu/core/rtw_p2p.c       |  8 ++++----
>   drivers/staging/r8188eu/core/rtw_pwrctrl.c   | 12 ++++++------
>   drivers/staging/r8188eu/core/rtw_wlan_util.c |  2 +-
>   3 files changed, 11 insertions(+), 11 deletions(-)
> 
checkpatch warns about the subjects. See an example for 1/3, but it's 
related to all 3.

> WARNING: A patch subject line should describe the change not the tool that found it
> #4: 
> Subject: [PATCH 1/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_p2p
> 
> total: 0 errors, 1 warnings, 0 checks, 32 lines checked




With regards,
Pavel Skripkin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_pwrctrl
  2022-05-16 19:45   ` Pavel Skripkin
@ 2022-05-17 13:51     ` Vihas Makwana
  0 siblings, 0 replies; 7+ messages in thread
From: Vihas Makwana @ 2022-05-17 13:51 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: Larry Finger, Phillip Potter, Greg Kroah-Hartman,
	Michael Straube, linux-staging, linux-kernel, Dan Carpenter

On Tue, May 17, 2022 at 1:15 AM Pavel Skripkin <paskripkin@gmail.com> wrote:
>
> Hi Vihas,
>
> On 5/16/22 20:03, Vihas Makwana wrote:
> > Refactor the code to fix following warnings:
> >      WARNING: Comparisons should place the constant on the right side of the test
> >
> > Signed-off-by: Vihas Makwana <makvihas@gmail.com>
> > ---
>
> [code snip]
>
> >               if ((pwrpriv->smart_ps == smart_ps) &&
> > @@ -356,7 +356,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
> >
> >       pwrctrlpriv->LpsIdleCount = 0;
> >       pwrctrlpriv->power_mgnt = padapter->registrypriv.power_mgnt;/*  PS_MODE_MIN; */
> > -     pwrctrlpriv->bLeisurePs = PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt;
> > +     pwrctrlpriv->bLeisurePs =  pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE;
> >
>
> Please remove extra space
>
Oh sorry, my bad. Will submit a v2.
>
>
> With regards,
> Pavel Skripkin



-- 
Thanks,
Vihas

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-17 13:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 17:03 [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings Vihas Makwana
2022-05-16 17:03 ` [PATCH 1/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_p2p Vihas Makwana
2022-05-16 17:03 ` [PATCH 2/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_pwrctrl Vihas Makwana
2022-05-16 19:45   ` Pavel Skripkin
2022-05-17 13:51     ` Vihas Makwana
2022-05-16 17:03 ` [PATCH 3/3] staging: r8188eu: fix checkpatch.pl warnings in rtw_wlan_util Vihas Makwana
2022-05-16 19:49 ` [PATCH 0/3] staging: r8188eu: fix checkpatch.pl warnings Pavel Skripkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.