Skip to contentSkip to conversation

staging: rtl8723bs: core: fix line over 80 characters warning

PATCH Superseded Anirudh Rayabharam 5 participants 8 messages Mar 26, 2019 – Mar 30, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: core: fix line over 80 characters warning

Shorten the expression by re-using the part that was already computed to fix the line over 80 characters warning reported by checkpatch.pl.

---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
index 18fabf5ff44b..bc0230672457 100644
@@ -2336,8 +2336,8 @@ void rtw_ap_restore_network(struct adapter *padapter)
 			Update_RA_Entry(padapter, psta);
 			/* pairwise key */
 			/* per sta pairwise key and settings */
-			if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
-				(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
+			if ((psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) ||
+				(psecuritypriv->dot11PrivacyAlgrthm == _AES_)) {
 				rtw_setstakey_cmd(padapter, psta, true, false);
 			}
 		}
Signature · 1 line
2.17.1
#1 lore raw
Quoted 1 line · Anirudh Rayabharam

Shorten the expression by re-using the part that was already computed to

This confused me. Better to phrase it like:

Shorten the expression by using the "psecuritypriv" pointer.

Quoted 12 lines

fix the line over 80 characters warning reported by checkpatch.pl.

---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
index 18fabf5ff44b..bc0230672457 100644

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter *padapter) · line 2340

Quoted 7 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
@@ -2336,8 +2336,8 @@ void rtw_ap_restore_network(struct adapter *padapter)
 			Update_RA_Entry(padapter, psta);
 			/* pairwise key */
 			/* per sta pairwise key and settings */
-			if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
-				(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
+			if ((psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) ||
+				(psecuritypriv->dot11PrivacyAlgrthm == _AES_)) {

It's better to align it slightly different as well. In the kernel we would normally align the second condition to match the first one.

I probably would have gotten rid of the parenthesis as well. I don't like double parenthesis around == because I reserve that for = assignment conditions.

			if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_ ||
			    psecuritypriv->dot11PrivacyAlgrthm == _AES_) {
				rtw_setstakey_cmd(padapter, psta, true, false);

When you're changing just a couple lines like this you can get away with making multiple white space changes at the same time because the One Thing that the patch does is "Clean up a Condition". There is some flexibility in the One thing Per Patch rule, but you have to sell it in the right way. The patch description would be:

Checkpatch.pl complains that this line is over 80 characters. We should use the "psecuritypriv" for consistency. It's not aligned properly and there are too many parenthesis.

This patch just cleans up a condition, it doesn't affect runtime.

regards,
dan carpenter

#2 lore raw

PATCH v2 1/1 staging: rtl8723bs: core: fix line over 80 characters warning

In reply to Anirudh Rayabharam

Checkpatch.pl complains that these lines are over 80 characters. Use the "psecuritypriv" pointer for consistency, remove unnecessary parantheses and fix the alignment.

This patch just cleans up a condition, it doesn't affect runtime.

---
v2: Made the commit message clearer, removed unnecessary parantheses and fixed
the alignment as suggested by Dan Carpenter <[email protected]>

 drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
index 18fabf5ff44b..8062b7f36de2 100644
@@ -2336,8 +2336,8 @@ void rtw_ap_restore_network(struct adapter *padapter)
 			Update_RA_Entry(padapter, psta);
 			/* pairwise key */
 			/* per sta pairwise key and settings */
-			if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
-				(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
+			if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_ ||
+			    psecuritypriv->dot11PrivacyAlgrthm == _AES_) {
 				rtw_setstakey_cmd(padapter, psta, true, false);
 			}
 		}
Signature · 1 line
2.17.1
#4 lore raw
In reply to Anirudh Rayabharam
Quoted 5 lines · Anirudh Rayabharam

Checkpatch.pl complains that these lines are over 80 characters. Use the "psecuritypriv" pointer for consistency, remove unnecessary parantheses and fix the alignment.

This patch just cleans up a condition, it doesn't affect runtime.

[]

drivers/staging/rtl8723bs/core/rtw_ap.c

Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0

[]

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter *padapter) · line 2342

Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
@@ -2336,8 +2336,8 @@ void rtw_ap_restore_network(struct adapter *padapter)
 			Update_RA_Entry(padapter, psta);
 			/* pairwise key */
 			/* per sta pairwise key and settings */
-			if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
-				(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
+			if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_ ||
+			    psecuritypriv->dot11PrivacyAlgrthm == _AES_) {
 				rtw_setstakey_cmd(padapter, psta, true, false);
 			}

You could remove the unnecessary {} braces here too

maintainer
#5 lore raw
In reply to Anirudh Rayabharam
Quoted 20 lines · Anirudh Rayabharam

Checkpatch.pl complains that these lines are over 80 characters. Use the "psecuritypriv" pointer for consistency, remove unnecessary parantheses and fix the alignment.

This patch just cleans up a condition, it doesn't affect runtime.

---
v2: Made the commit message clearer, removed unnecessary parantheses and fixed
the alignment as suggested by Dan Carpenter <[email protected]>

 drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
index 18fabf5ff44b..8062b7f36de2 100644

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter *padapter) · line 2343

Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
@@ -2336,8 +2336,8 @@ void rtw_ap_restore_network(struct adapter *padapter)
 			Update_RA_Entry(padapter, psta);
 			/* pairwise key */
 			/* per sta pairwise key and settings */
-			if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
-				(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
+			if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_ ||
+			    psecuritypriv->dot11PrivacyAlgrthm == _AES_) {
 				rtw_setstakey_cmd(padapter, psta, true, false);
 			}
 		}

Patch does not apply to my staging-next branch :(

Please rebase and resend.

thanks,

greg k-h

#6 lore raw
In reply to Anirudh Rayabharam
Quoted 32 lines · Anirudh Rayabharam

Checkpatch.pl complains that these lines are over 80 characters. Use the "psecuritypriv" pointer for consistency, remove unnecessary parantheses and fix the alignment.

This patch just cleans up a condition, it doesn't affect runtime.

---
v2: Made the commit message clearer, removed unnecessary parantheses and fixed
the alignment as suggested by Dan Carpenter <[email protected]>

 drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
index 18fabf5ff44b..8062b7f36de2 100644
@@ -2336,8 +2336,8 @@ void rtw_ap_restore_network(struct adapter *padapter)
 			Update_RA_Entry(padapter, psta);
 			/* pairwise key */
 			/* per sta pairwise key and settings */
-			if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
-				(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
+			if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_ ||
+			    psecuritypriv->dot11PrivacyAlgrthm == _AES_) {
 				rtw_setstakey_cmd(padapter, psta, true, false);
 			}
 		}
Signature · 1 line
2.17.1

Unfortunately, the v2 of this patch was missed and v1 was applied to Greg's staging tree. So, I am abandoning v2 of this patch. I will fix the alignment and braces issue in a new patch.

Reviewed-by on v1 1/1
#7 lore raw
In reply to Anirudh Rayabharam
Quoted 13 lines · Anirudh Rayabharam

Shorten the expression by re-using the part that was already computed to fix the line over 80 characters warning reported by checkpatch.pl.

---
  drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
index 18fabf5ff44b..bc0230672457 100644

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter *padapter) · line 2342

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
@@ -2336,8 +2336,8 @@ void rtw_ap_restore_network(struct adapter *padapter)
  			Update_RA_Entry(padapter, psta);
  			/* pairwise key */
  			/* per sta pairwise key and settings */
-			if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
-				(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
+			if ((psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) ||
+				(psecuritypriv->dot11PrivacyAlgrthm == _AES_)) {
  				rtw_setstakey_cmd(padapter, psta, true, false);
  			}

Get rid of this {}.fix this .

Now patch looks good after Dan comment.

Cheers,
-Mukesh

Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
  		}