Skip to contentSkip to conversation

staging: wlan-ng: Resolve various warnings reported by checkpatch.pl

PATCH In review Soumyajit Deb 2 participants 8 messages Mar 27, 2020 – Mar 30, 2020 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: wlan-ng: Resolve various warnings reported by checkpatch.pl

This patchset resolve warnings issued by checkpatch.pl
This patchset properly aligns the lines of a function call and breaks a line into two lines to respect the 80 character width constraint. This helps in maintaining a uniform Linux Kernel coding style.

Soumyajit Deb (2):
staging: wlang-ng: Properly align the lines of function call
staging: wlan-ng: Line over 80 characters

 drivers/staging/wlan-ng/cfg80211.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 staging: wlang-ng: Properly align the lines of function call

Align the lines of function call to improve code readability and to adhere to the uniform Linux Kernel coding style. Reported by checkpatch.pl

---
 drivers/staging/wlan-ng/cfg80211.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)
drivers/staging/wlan-ng/cfg80211.c +13 -14
index fac38c842ac5..3d17037f954e 100644
@@ -359,16 +359,15 @@ static int prism2_scan(struct wiphy *wiphy,
 		freq = ieee80211_channel_to_frequency(msg2.dschannel.data,
 						      NL80211_BAND_2GHZ);
 		bss = cfg80211_inform_bss(wiphy,
-			ieee80211_get_channel(wiphy, freq),
-			CFG80211_BSS_FTYPE_UNKNOWN,
-			(const u8 *)&msg2.bssid.data.data,
-			msg2.timestamp.data, msg2.capinfo.data,
-			msg2.beaconperiod.data,
-			ie_buf,
-			ie_len,
-			(msg2.signal.data - 65536) * 100, /* Conversion to signed type */
-			GFP_KERNEL
-		);
+					  ieee80211_get_channel(wiphy, freq),
+					  CFG80211_BSS_FTYPE_UNKNOWN,
+					  (const u8 *)&msg2.bssid.data.data,
+					  msg2.timestamp.data, msg2.capinfo.data,
+					  msg2.beaconperiod.data,
+					  ie_buf,
+					  ie_len,
+					  (msg2.signal.data - 65536) * 100, /* Conversion to signed type */
+					  GFP_KERNEL);
 
 		if (!bss) {
 			err = -ENOMEM;
@@ -473,8 +472,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
 				return -EINVAL;
 
 			result = prism2_domibset_uint32(wlandev,
-				DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
-				sme->key_idx);
+							DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
+							sme->key_idx);
 			if (result)
 				goto exit;
 
@@ -586,8 +585,8 @@ static int prism2_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
 		data = MBM_TO_DBM(mbm);
 
 	result = prism2_domibset_uint32(wlandev,
-		DIDMIB_DOT11PHY_TXPOWERTABLE_CURRENTTXPOWERLEVEL,
-		data);
+					DIDMIB_DOT11PHY_TXPOWERTABLE_CURRENTTXPOWERLEVEL,
+					data);
 
 	if (result) {
 		err = -EFAULT;
Signature · 1 line
2.17.1
#2 lore raw

Re: [Outreachy kernel] [Outreachy Kernel][PATCH 1/2] staging: wlang-ng: Properly align the lines of function call

Quoted 25 lines · On Fri, 27 Mar 2020 20:12:28 +0530 Soumyajit Deb <[email protected]>…

Align the lines of function call to improve code readability and to adhere to the uniform Linux Kernel coding style. Reported by checkpatch.pl

---
 drivers/staging/wlan-ng/cfg80211.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)
drivers/staging/wlan-ng/cfg80211.c +0 -8
index fac38c842ac5..3d17037f954e 100644
@@ -359,16 +359,15 @@ static int prism2_scan(struct wiphy *wiphy,
 		freq = ieee80211_channel_to_frequency(msg2.dschannel.data,
 						      NL80211_BAND_2GHZ);
 		bss = cfg80211_inform_bss(wiphy,
-			ieee80211_get_channel(wiphy, freq),
-			CFG80211_BSS_FTYPE_UNKNOWN,
-			(const u8 *)&msg2.bssid.data.data,
-			msg2.timestamp.data, msg2.capinfo.data,
-			msg2.beaconperiod.data,
-			ie_buf,
-			ie_len,
-			(msg2.signal.data - 65536) * 100, /* Conversion to signed type */

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 369

Quoted 10 lines
drivers/staging/wlan-ng/cfg80211.c +8 -2
-			GFP_KERNEL
-		);
+					  ieee80211_get_channel(wiphy, freq),
+					  CFG80211_BSS_FTYPE_UNKNOWN,
+					  (const u8 *)&msg2.bssid.data.data,
+					  msg2.timestamp.data, msg2.capinfo.data,
+					  msg2.beaconperiod.data,
+					  ie_buf,
+					  ie_len,
+					  (msg2.signal.data - 65536) * 100, /* Conversion to signed type */

So... wait a moment:

- March 21, 17:30 UTC: you ask me on IRC how to fix the checkpatch warning you're introducing now. You propose to move the comment on a line by itself. I suggest that you write a test program and find out if this conversion can be done in another way. You say you will do that

- March 27, 10:58 UTC: you ask me on IRC if you can use a cast to "i32". I have a déjà vu, can't really remember who asked me this, and suggest that you write a test program. You say you will do that

- March 27, 12:12 UTC: you send the same question to this list

- March 27, 14:45 UTC: you send this patch

...why, exactly?

Signature · 1 line
Stefano
#3 lore raw

Re: [Outreachy kernel] [Outreachy Kernel][PATCH 1/2] staging: wlang-ng: Properly align the lines of function call

Sorry for the inconvenience.
Now I am also confused a bit too
But as much as I understand,
this patch is somewhat different from the change I wanted by casting to i32.

This patch just addresses the warning of properly aligning the lines as reported by checkpatch.pl.
While, the change of casting to i32 was for line over 80 characters warning, which is a different warning altogether, so that change must be addressed in some other patch.
I wanted to cast to i32 so that I can shorten the line and resolve the warning of line over 80 character as reported by checkpatch.pl

Sorry, for any misunderstanding. I am very new to kernel development and was confused a bit about the process then.
Sorry for any mistake on my part.

Quoted 67 lines · Stefano Brivio

Review

Quoted 10 lines · On Fri, 27 Mar 2020 20:12:28 +0530 Soumyajit Deb <[email protected]>…

Align the lines of function call to improve code readability and to adhere to the uniform Linux Kernel coding style. Reported by checkpatch.pl

---
 drivers/staging/wlan-ng/cfg80211.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/wlan-ng/cfg80211.c

Quoted 5 lines

index fac38c842ac5..3d17037f954e 100644

drivers/staging/wlan-ng/cfg80211.c +0 -0
@@ -359,16 +359,15 @@ static int prism2_scan(struct wiphy *wiphy,
              freq = ieee80211_channel_to_frequency(msg2.dschannel.data,

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 369

Quoted 10 lines
drivers/staging/wlan-ng/cfg80211.c +0 -8
                                                    NL80211_BAND_2GHZ);
              bss = cfg80211_inform_bss(wiphy,
-                     ieee80211_get_channel(wiphy, freq),
-                     CFG80211_BSS_FTYPE_UNKNOWN,
-                     (const u8 *)&msg2.bssid.data.data,
-                     msg2.timestamp.data, msg2.capinfo.data,
-                     msg2.beaconperiod.data,
-                     ie_buf,
-                     ie_len,
-                     (msg2.signal.data - 65536) * 100, /* Conversion to

signed type */

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy,

Quoted 3 lines
drivers/staging/wlan-ng/cfg80211.c +1 -2
-                     GFP_KERNEL
-             );
+                                       ieee80211_get_channel(wiphy,

freq),

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 364

Quoted 2 lines
drivers/staging/wlan-ng/cfg80211.c +2 -0
+                                       CFG80211_BSS_FTYPE_UNKNOWN,
+                                       (const u8

*)&msg2.bssid.data.data,

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 365

Quoted 1 line
drivers/staging/wlan-ng/cfg80211.c +1 -0
+                                       msg2.timestamp.data,

msg2.capinfo.data,

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy,

Quoted 4 lines
drivers/staging/wlan-ng/cfg80211.c +4 -0
+                                       msg2.beaconperiod.data,
+                                       ie_buf,
+                                       ie_len,
+                                       (msg2.signal.data - 65536) *

100, /* Conversion to signed type */

So... wait a moment:

- March 21, 17:30 UTC: you ask me on IRC how to fix the checkpatch warning you're introducing now. You propose to move the comment on a line by itself. I suggest that you write a test program and find out if this conversion can be done in another way. You say you will do that

- March 27, 10:58 UTC: you ask me on IRC if you can use a cast to "i32". I have a déjà vu, can't really remember who asked me this, and suggest that you write a test program. You say you will do that

- March 27, 12:12 UTC: you send the same question to this list

- March 27, 14:45 UTC: you send this patch

...why, exactly?

--
Stefano

#4 lore raw

Re: [Outreachy kernel] [Outreachy Kernel][PATCH 1/2] staging: wlang-ng: Properly align the lines of function call

Is there any issue with this patch?
Please let me know, so I can rectify them and send v2 of the patch if needed.

Quoted 88 lines · Soumyajit Deb

Sorry for the inconvenience.
Now I am also confused a bit too
But as much as I understand,
this patch is somewhat different from the change I wanted by casting to i32.

This patch just addresses the warning of properly aligning the lines as reported by checkpatch.pl.
While, the change of casting to i32 was for line over 80 characters warning, which is a different warning altogether, so that change must be addressed in some other patch.
I wanted to cast to i32 so that I can shorten the line and resolve the warning of line over 80 character as reported by checkpatch.pl

Sorry, for any misunderstanding. I am very new to kernel development and was confused a bit about the process then.
Sorry for any mistake on my part.

Quoted 67 lines · Stefano Brivio

Review

Quoted 10 lines · On Fri, 27 Mar 2020 20:12:28 +0530 Soumyajit Deb <[email protected]>…

Align the lines of function call to improve code readability and to adhere to the uniform Linux Kernel coding style. Reported by checkpatch.pl

---
 drivers/staging/wlan-ng/cfg80211.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/wlan-ng/cfg80211.c

Quoted 5 lines

index fac38c842ac5..3d17037f954e 100644

drivers/staging/wlan-ng/cfg80211.c +0 -0
@@ -359,16 +359,15 @@ static int prism2_scan(struct wiphy *wiphy,
              freq = ieee80211_channel_to_frequency(msg2.dschannel.data,

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 369

Quoted 10 lines
drivers/staging/wlan-ng/cfg80211.c +0 -8
                                                    NL80211_BAND_2GHZ);
              bss = cfg80211_inform_bss(wiphy,
-                     ieee80211_get_channel(wiphy, freq),
-                     CFG80211_BSS_FTYPE_UNKNOWN,
-                     (const u8 *)&msg2.bssid.data.data,
-                     msg2.timestamp.data, msg2.capinfo.data,
-                     msg2.beaconperiod.data,
-                     ie_buf,
-                     ie_len,
-                     (msg2.signal.data - 65536) * 100, /* Conversion

to signed type */

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy,

Quoted 3 lines
drivers/staging/wlan-ng/cfg80211.c +1 -2
-                     GFP_KERNEL
-             );
+                                       ieee80211_get_channel(wiphy,

freq),

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 364

Quoted 2 lines
drivers/staging/wlan-ng/cfg80211.c +2 -0
+                                       CFG80211_BSS_FTYPE_UNKNOWN,
+                                       (const u8

*)&msg2.bssid.data.data,

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 365

Quoted 1 line
drivers/staging/wlan-ng/cfg80211.c +1 -0
+                                       msg2.timestamp.data,

msg2.capinfo.data,

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy,

Quoted 4 lines
drivers/staging/wlan-ng/cfg80211.c +4 -0
+                                       msg2.beaconperiod.data,
+                                       ie_buf,
+                                       ie_len,
+                                       (msg2.signal.data - 65536) *

100, /* Conversion to signed type */

So... wait a moment:

- March 21, 17:30 UTC: you ask me on IRC how to fix the checkpatch warning you're introducing now. You propose to move the comment on a line by itself. I suggest that you write a test program and find out if this conversion can be done in another way. You say you will do that

- March 27, 10:58 UTC: you ask me on IRC if you can use a cast to "i32". I have a déjà vu, can't really remember who asked me this, and suggest that you write a test program. You say you will do that

- March 27, 12:12 UTC: you send the same question to this list

- March 27, 14:45 UTC: you send this patch

...why, exactly?

--
Stefano

#5 lore raw

Re: [Outreachy kernel] [Outreachy Kernel][PATCH 1/2] staging: wlang-ng: Properly align the lines of function call

Quoted 1 line · On Mon, 30 Mar 2020 15:44:43 +0530 Soumyajit Deb <[email protected]>…

Is there any issue with this patch?

Yes, it makes the code even less readable because it reaches 115 columns.

Signature · 1 line
Stefano
#6 lore raw

Re: [Outreachy kernel] [Outreachy Kernel][PATCH 1/2] staging: wlang-ng: Properly align the lines of function call

In reply to Soumyajit Deb

Soumyajit,

Quoted 4 lines · On Mon, 30 Mar 2020 15:25:03 +0530 Soumyajit Deb <[email protected]>…

Sorry for the inconvenience.
Now I am also confused a bit too
But as much as I understand,
this patch is somewhat different from the change I wanted by casting to i32.

Can you please stop top-quoting first? This:
https://en.wikipedia.org/wiki/Posting_style#Bottom-posting

is the preferred way to comment on code and intervene in discussions on the communities we'll be working with.

Quoted 2 lines

This patch just addresses the warning of properly aligning the lines as reported by checkpatch.pl.

...but it makes the problem worse, because instead of just 89 columns you reach 115 columns and you also exceed 80 columns with code, not just with comments. That's how the two things are (obviously) related.

Quoted 9 lines

While, the change of casting to i32 was for line over 80 characters warning, which is a different warning altogether, so that change must be addressed in some other patch.
I wanted to cast to i32 so that I can shorten the line and resolve the warning of line over 80 character as reported by checkpatch.pl

Sorry, for any misunderstanding. I am very new to kernel development and was confused a bit about the process then.
Sorry for any mistake on my part.

No, sorry, but if you ask about something three times, and three times I give you the same answer, well, the confusion will start happening on my side.

I understand you might be tempted to find the easiest possible patches to have a number of formal submissions, instead of losing your time writing a simple test program (which would tell you that 'i32' doesn't exist, by the way). I don't think it's a reasonable approach, though.

Signature · 1 line
Stefano
#7 lore raw

PATCH 2/2 staging: wlan-ng: Line over 80 characters

In reply to Soumyajit Deb

Move the last argument of the line to the next line to prevent the line from exceeding 80 character width limit.
Reported by checkpatch.pl

---
 drivers/staging/wlan-ng/cfg80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/wlan-ng/cfg80211.c +2 -1
index 3d17037f954e..9ab57822979b 100644
@@ -362,7 +362,8 @@ static int prism2_scan(struct wiphy *wiphy,
 					  ieee80211_get_channel(wiphy, freq),
 					  CFG80211_BSS_FTYPE_UNKNOWN,
 					  (const u8 *)&msg2.bssid.data.data,
-					  msg2.timestamp.data, msg2.capinfo.data,
+					  msg2.timestamp.data,
+					  msg2.capinfo.data,
 					  msg2.beaconperiod.data,
 					  ie_buf,
 					  ie_len,
Signature · 1 line
2.17.1