Skip to contentSkip to conversation

staging: wlan-ng: Fix third argument going over 80 characters

PATCH Superseded John B. Wyatt IV 3 participants 4 messages Mar 21, 2020 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: wlan-ng: Fix third argument going over 80 characters

Create a new 'status' variable to store the value of a long argument that goes over 80 characters. The status variable is also used for an if check. Replacing that long statement in both places makes the code much easier to read.

Note: the status variable is assigned after a needed byte order conversion for usbin->rxfrm.desc.status, which uses a reference.

Issue reported by checkpatch.

---
v2: Resubmitting after git rebase and comments from Julia Lawall <[email protected]>

 drivers/staging/wlan-ng/hfa384x_usb.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/wlan-ng/hfa384x_usb.c +5 -4
index f8485601aead..9016e6b32efc 100644
@@ -3252,15 +3252,16 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb)
 	struct hfa384x *hw = wlandev->priv;
 	int hdrlen;
 	struct p80211_rxmeta *rxmeta;
-	u16 data_len;
-	u16 fc;
+	u16 data_len, fc, status;
 
 	/* Byte order convert once up front. */
 	le16_to_cpus(&usbin->rxfrm.desc.status);
 	le32_to_cpus(&usbin->rxfrm.desc.time);
 
 	/* Now handle frame based on port# */
-	switch (HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status)) {
+	status = HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status);
+
+	switch (status) {
 	case 0:
 		fc = le16_to_cpu(usbin->rxfrm.desc.frame_control);
 
@@ -3319,7 +3320,7 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb)
 	default:
 		netdev_warn(hw->wlandev->netdev,
 			    "Received frame on unsupported port=%d\n",
-			    HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status));
+			    status);
 		break;
 	}
 }
Signature · 1 line
2.25.1
#1 lore raw
Quoted 24 lines · John B. Wyatt IV

Create a new 'status' variable to store the value of a long argument that goes over 80 characters. The status variable is also used for an if check. Replacing that long statement in both places makes the code much easier to read.

Note: the status variable is assigned after a needed byte order conversion for usbin->rxfrm.desc.status, which uses a reference.

Issue reported by checkpatch.

---
v2: Resubmitting after git rebase and comments from Julia Lawall <[email protected]>

 drivers/staging/wlan-ng/hfa384x_usb.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/wlan-ng/hfa384x_usb.c +0 -0
index f8485601aead..9016e6b32efc 100644

drivers/staging/wlan-ng/hfa384x_usb.c static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb) · line 3255

Quoted 6 lines
drivers/staging/wlan-ng/hfa384x_usb.c +1 -2
@@ -3252,15 +3252,16 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb)
 	struct hfa384x *hw = wlandev->priv;
 	int hdrlen;
 	struct p80211_rxmeta *rxmeta;
-	u16 data_len;
-	u16 fc;
+	u16 data_len, fc, status;

No need to change data_len, or fc definitions, just add a new line here instead for status.

thanks,

greg k-h

#2 lore raw
Quoted 20 lines · On Sat, 21 Mar 2020 10:34:02 +0100 Greg Kroah-Hartman…
Quoted 19 lines · John B. Wyatt IV

Create a new 'status' variable to store the value of a long argument that goes over 80 characters. The status variable is also used for an if check. Replacing that long statement in both places makes the code much easier to read.

Note: the status variable is assigned after a needed byte order conversion for usbin->rxfrm.desc.status, which uses a reference.

Issue reported by checkpatch.

---
v2: Resubmitting after git rebase and comments from Julia Lawall <[email protected]>

 drivers/staging/wlan-ng/hfa384x_usb.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Quoted 14 lines

drivers/staging/wlan-ng/hfa384x_usb.c static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb) · line 3255

Quoted 11 lines
drivers/staging/wlan-ng/hfa384x_usb.c +1 -2
index f8485601aead..9016e6b32efc 100644
@@ -3252,15 +3252,16 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb)
 	struct hfa384x *hw = wlandev->priv;
 	int hdrlen;
 	struct p80211_rxmeta *rxmeta;
-	u16 data_len;
-	u16 fc;
+	u16 data_len, fc, status;  

No need to change data_len, or fc definitions, just add a new line here instead for status.

My bad, I suggested that John would change that because to me:

	u16 data_len;
	u16 fc;
	u16 status;

looks only slightly worse than:

	u16 data_len;
	u16 fc;

but still it's horrible. If the idea is to avoid unrelated changes, yeah, I get it :)

Signature · 1 line
Stefano
#3 lore raw
Quoted 44 lines · Stefano Brivio
Quoted 20 lines · On Sat, 21 Mar 2020 10:34:02 +0100 Greg Kroah-Hartman…
Quoted 19 lines · John B. Wyatt IV

Create a new 'status' variable to store the value of a long argument that goes over 80 characters. The status variable is also used for an if check. Replacing that long statement in both places makes the code much easier to read.

Note: the status variable is assigned after a needed byte order conversion for usbin->rxfrm.desc.status, which uses a reference.

Issue reported by checkpatch.

---
v2: Resubmitting after git rebase and comments from Julia Lawall <[email protected]>

 drivers/staging/wlan-ng/hfa384x_usb.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Quoted 14 lines

drivers/staging/wlan-ng/hfa384x_usb.c static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb) · line 3255

Quoted 11 lines
drivers/staging/wlan-ng/hfa384x_usb.c +1 -2
index f8485601aead..9016e6b32efc 100644
@@ -3252,15 +3252,16 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb)
 	struct hfa384x *hw = wlandev->priv;
 	int hdrlen;
 	struct p80211_rxmeta *rxmeta;
-	u16 data_len;
-	u16 fc;
+	u16 data_len, fc, status;  

No need to change data_len, or fc definitions, just add a new line here instead for status.

My bad, I suggested that John would change that because to me:

	u16 data_len;
	u16 fc;
	u16 status;
Quoted 7 lines

looks only slightly worse than:

	u16 data_len;
	u16 fc;

but still it's horrible. If the idea is to avoid unrelated changes, yeah, I get it :)

The idea is to avoid unrelated changes :)