Skip to contentSkip to conversation

staging: wlan-ng: replace rate macros

PATCH Superseded Luke Koch 2 participants 3 messages Apr 15, 2023 – Apr 17, 2023 Staging

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Luke Koch

author
#0 lore raw

PATCH v2 1/1 staging: wlan-ng: replace rate macros

Change p80211msg_dot11req_scan_results rate members to struct arrays instead of individually numbered member structs.
Replace macros to set rates with loops to avoid checkpatch warning and adhere to linux coding style.

Reported by checkpatch:

CHECK: Macro argument reuse 'N' - possible side-effects?

Signed off by: Luke Koch <[email protected]>
---
v2: - Fix array underflow and conditions with respect to the start at 0

---
 drivers/staging/wlan-ng/p80211metastruct.h | 18 +-------
 drivers/staging/wlan-ng/prism2mgmt.c       | 52 +++++++---------------
 2 files changed, 18 insertions(+), 52 deletions(-)
drivers/staging/wlan-ng/p80211metastruct.h +2 -16
index 4adc64580185..e963227f797c 100644
@@ -114,22 +114,8 @@ struct p80211msg_dot11req_scan_results {
 	struct p80211item_uint32 cfpollreq;
 	struct p80211item_uint32 privacy;
 	struct p80211item_uint32 capinfo;
-	struct p80211item_uint32 basicrate1;
-	struct p80211item_uint32 basicrate2;
-	struct p80211item_uint32 basicrate3;
-	struct p80211item_uint32 basicrate4;
-	struct p80211item_uint32 basicrate5;
-	struct p80211item_uint32 basicrate6;
-	struct p80211item_uint32 basicrate7;
-	struct p80211item_uint32 basicrate8;
-	struct p80211item_uint32 supprate1;
-	struct p80211item_uint32 supprate2;
-	struct p80211item_uint32 supprate3;
-	struct p80211item_uint32 supprate4;
-	struct p80211item_uint32 supprate5;
-	struct p80211item_uint32 supprate6;
-	struct p80211item_uint32 supprate7;
-	struct p80211item_uint32 supprate8;
+	struct p80211item_uint32 basicrate[8];
+	struct p80211item_uint32 supprate[8];
 } __packed;
 
 struct p80211msg_dot11req_start {
drivers/staging/wlan-ng/prism2mgmt.c +16 -36

58 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw

drivers/staging/wlan-ng/prism2mgmt.c int prism2mgmt_scan_results(struct wlandevice *wlandev, void *msgp) · line 443

Quoted 4 lines · Luke Koch
drivers/staging/wlan-ng/prism2mgmt.c +4 -0
+	for (int i = 0; i < 8; i++) {
+		if (count > i &&
+		    DOT11_RATE5_ISBASIC_GET(item->supprates[i])) {
+			req->basicrate[i] .data = item->supprates[i];
                                         ^

Could you remove these spaces before the .data and .status? Otherwise it looks good to me.

regards,
dan carpenter

author
#2 lore raw
Quoted 8 lines · Dan Carpenter

drivers/staging/wlan-ng/prism2mgmt.c int prism2mgmt_scan_results(struct wlandevice *wlandev, void *msgp) · line 443

Quoted 4 lines · Luke Koch
drivers/staging/wlan-ng/prism2mgmt.c +4 -0
+	for (int i = 0; i < 8; i++) {
+		if (count > i &&
+		    DOT11_RATE5_ISBASIC_GET(item->supprates[i])) {
+			req->basicrate[i] .data = item->supprates[i];
                                         ^

Could you remove these spaces before the .data and .status? Otherwise it looks good to me.

Sure, the spaces must have been leftovers from the token pasting and I unfortunately overlooked them. Thanks for reviewing!

Best regards,
Luke Koch