Skip to contentSkip to conversation

staging: wlan-ng: Fix sparse warning of restricted __le16

PATCH In review simran singhal 3 participants 11 messages Mar 2, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 staging: wlan-ng: Fix sparse warning of restricted __le16

This patch fixes the following sparse warning:
warning: cast to restricted __le16

---
 drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/staging/wlan-ng/prism2sta.c +25 -26
index 984804b..82d3a70 100644
@@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
 			qualmsg->noise.status =
 			    P80211ENUM_msgitem_status_data_ok;
 
-			qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
-			qualmsg->level.data =
-				le16_to_cpu(hw->qual.asl_curr_bss);
-			qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
+			qualmsg->link.data = hw->qual.cq_curr_bss;
+			qualmsg->level.data = hw->qual.asl_curr_bss;
+			qualmsg->noise.data = hw->qual.anl_curr_fc;
 			qualmsg->txrate.data = hw->txrate;
 
 			break;
@@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the nic id fields in host byte order */
-	hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
-	hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
-	hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
-	hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
+	hw->ident_nic.id = hw->ident_nic.id;
+	hw->ident_nic.variant = hw->ident_nic.variant;
+	hw->ident_nic.major = hw->ident_nic.major;
+	hw->ident_nic.minor = hw->ident_nic.minor;
 
 	netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
 		    hw->ident_nic.id, hw->ident_nic.major,
@@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the private fw id fields in host byte order */
-	hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
-	hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
-	hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
-	hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
+	hw->ident_pri_fw.id = hw->ident_pri_fw.id;
+	hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
+	hw->ident_pri_fw.major = hw->ident_pri_fw.major;
+	hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
 
 	netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
 		    hw->ident_pri_fw.id, hw->ident_pri_fw.major,
@@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the station fw id fields in host byte order */
-	hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
-	hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
-	hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
-	hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
+	hw->ident_sta_fw.id = hw->ident_sta_fw.id;
+	hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
+	hw->ident_sta_fw.major = hw->ident_sta_fw.major;
+	hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
 
 	/* strip out the 'special' variant bits */
 	hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
@@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	/* get all the Compatibility range, modem interface supplier
 	 * fields in byte order
 	 */
-	hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
-	hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
-	hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
-	hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
-	hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
+	hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
+	hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
+	hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
+	hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
+	hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
 
 	netdev_info(wlandev->netdev,
 		    "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
@@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	/* get all the Compatibility range, controller interface supplier
 	 * fields in byte order
 	 */
-	hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
-	hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
-	hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
-	hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
-	hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
+	hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
+	hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
+	hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
+	hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
+	hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
 
 	netdev_info(wlandev->netdev,
 		    "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/6 staging: wlan-ng: Fix sparse warnings

This patch fixes the following sparse warnings:

drivers/staging/wlan-ng/hfa384x_usb.c:1327:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1327:34: expected unsigned short [unsigned] [usertype] type
drivers/staging/wlan-ng/hfa384x_usb.c:1327:34: got restricted __le16 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:1328:33: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1328:33: expected unsigned short [unsigned] [usertype] cmd
drivers/staging/wlan-ng/hfa384x_usb.c:1328:33: got restricted __le16 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:1329:35: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1329:35: expected unsigned short [unsigned] [usertype] parm0
drivers/staging/wlan-ng/hfa384x_usb.c:1329:35: got restricted __le16 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:1330:35: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1330:35: expected unsigned short [unsigned] [usertype] parm1
drivers/staging/wlan-ng/hfa384x_usb.c:1330:35: got restricted __le16 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:1331:35: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1331:35: expected unsigned short [unsigned] [usertype] parm2
drivers/staging/wlan-ng/hfa384x_usb.c:1331:35: got restricted __le16 [usertype] <noident>

---
 drivers/staging/wlan-ng/hfa384x_usb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wlan-ng/hfa384x_usb.c +5 -5
index 6134eba..a7ff572 100644
@@ -1324,11 +1324,11 @@ hfa384x_docmd(struct hfa384x *hw,
 	}
 
 	/* Initialize the command */
-	ctlx->outbuf.cmdreq.type = cpu_to_le16(HFA384x_USB_CMDREQ);
-	ctlx->outbuf.cmdreq.cmd = cpu_to_le16(cmd->cmd);
-	ctlx->outbuf.cmdreq.parm0 = cpu_to_le16(cmd->parm0);
-	ctlx->outbuf.cmdreq.parm1 = cpu_to_le16(cmd->parm1);
-	ctlx->outbuf.cmdreq.parm2 = cpu_to_le16(cmd->parm2);
+	ctlx->outbuf.cmdreq.type = HFA384x_USB_CMDREQ;
+	ctlx->outbuf.cmdreq.cmd = cmd->cmd;
+	ctlx->outbuf.cmdreq.parm0 = cmd->parm0;
+	ctlx->outbuf.cmdreq.parm1 = cmd->parm1;
+	ctlx->outbuf.cmdreq.parm2 = cmd->parm2;
 
 	ctlx->outbufsize = sizeof(ctlx->outbuf.cmdreq);
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 3/6 staging: wlan-ng: Fix sparse warnings in hfa384x_usb.c

In reply to simran singhal

drivers/staging/wlan-ng/hfa384x_usb.c:3520:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3520:34: expected unsigned int [unsigned] [usertype] datarate
drivers/staging/wlan-ng/hfa384x_usb.c:3520:34: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3521:33: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3521:33: expected unsigned int [unsigned] [usertype] antenna
drivers/staging/wlan-ng/hfa384x_usb.c:3521:33: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3522:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3522:34: expected unsigned int [unsigned] [usertype] priority
drivers/staging/wlan-ng/hfa384x_usb.c:3522:34: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3523:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3523:34: expected unsigned int [unsigned] [usertype] ssi_type
drivers/staging/wlan-ng/hfa384x_usb.c:3523:34: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3524:36: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3524:36: expected signed int [signed] [usertype] [explicitly-signed] ssi_signal
drivers/staging/wlan-ng/hfa384x_usb.c:3524:36: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3525:35: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3525:35: expected signed int [signed] [usertype] [explicitly-signed] ssi_noise
drivers/staging/wlan-ng/hfa384x_usb.c:3525:35: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3526:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3526:34: expected unsigned int [unsigned] [usertype] preamble
drivers/staging/wlan-ng/hfa384x_usb.c:3526:34: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3527:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3527:34: expected unsigned int [unsigned] [usertype] encoding
drivers/staging/wlan-ng/hfa384x_usb.c:3527:34: got restricted __be32 [usertype] <noident>

---
 drivers/staging/wlan-ng/hfa384x_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/wlan-ng/hfa384x_usb.c +8 -8
index a7ff572..cdf987b 100644
@@ -3517,14 +3517,14 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev,
 		caphdr->hosttime = __cpu_to_be64(jiffies);
 		caphdr->phytype = htonl(4);	/* dss_dot11_b */
 		caphdr->channel = htonl(hw->sniff_channel);
-		caphdr->datarate = htonl(rxdesc->rate);
-		caphdr->antenna = htonl(0);	/* unknown */
-		caphdr->priority = htonl(0);	/* unknown */
-		caphdr->ssi_type = htonl(3);	/* rssi_raw */
-		caphdr->ssi_signal = htonl(rxdesc->signal);
-		caphdr->ssi_noise = htonl(rxdesc->silence);
-		caphdr->preamble = htonl(0);	/* unknown */
-		caphdr->encoding = htonl(1);	/* cck */
+		caphdr->datarate = be32_to_cpu(htonl(rxdesc->rate));
+		caphdr->antenna = be32_to_cpu(htonl(0));	/* unknown */
+		caphdr->priority = be32_to_cpu(htonl(0));	/* unknown */
+		caphdr->ssi_type = be32_to_cpu(htonl(3));	/* rssi_raw */
+		caphdr->ssi_signal = be32_to_cpu(htonl(rxdesc->signal));
+		caphdr->ssi_noise = be32_to_cpu(htonl(rxdesc->silence));
+		caphdr->preamble = be32_to_cpu(htonl(0));	/* unknown */
+		caphdr->encoding = be32_to_cpu(htonl(1));	/* cck */
 	}
 
 	/* Copy the 802.11 header to the skb
Signature · 1 line
2.7.4
#3 lore raw

PATCH 4/6 staging: fbtft: Fix sparse warnings of incorrect type in assignment

In reply to simran singhal

drivers/staging/fbtft/fbtft-bus.c:166:36: warning: incorrect type in assignment (different base types)
drivers/staging/fbtft/fbtft-bus.c:166:36: expected unsigned short [unsigned] [short] [usertype] <noident>
drivers/staging/fbtft/fbtft-bus.c:166:36: got restricted __be16 [usertype] <noident>

drivers/staging/fbtft/fbtft-io.c:74:29: warning: incorrect type in assignment (different base types)
drivers/staging/fbtft/fbtft-io.c:74:29: expected unsigned long long [unsigned] [long] [long long] [usertype] <noident>
drivers/staging/fbtft/fbtft-io.c:74:29: got restricted __be64 [usertype] <noident>

---
 drivers/staging/fbtft/fbtft-bus.c | 2 +-
 drivers/staging/fbtft/fbtft-io.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/fbtft/fbtft-bus.c +1 -1
index ec45043..df2223e 100644
@@ -163,7 +163,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
 						to_copy, remain - to_copy);
 
 		for (i = 0; i < to_copy; i++)
-			txbuf16[i] = cpu_to_be16(vmem16[i]);
+			txbuf16[i] = vmem16[i];
 
 		vmem16 = vmem16 + to_copy;
 		ret = par->fbtftops.write(par, par->txbuf.buf,
drivers/staging/fbtft/fbtft-io.c +1 -1
index d868405..ffb9a3b 100644
@@ -71,7 +71,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len)
 			src++;
 		}
 		tmp |= ((*src & 0x0100) ? 1 : 0);
-		*(u64 *)dst = cpu_to_be64(tmp);
+		*(__be64 *)dst = cpu_to_be64(tmp);
 		dst += 8;
 		*dst++ = (u8)(*src++ & 0x00FF);
 		added++;
Signature · 1 line
2.7.4
#4 lore raw

PATCH 5/6 staging: rtl8192u: Fix Sparse warning of cast from restricted __le16

In reply to simran singhal

This patch fixes the following Sparse warning-

drivers/staging/rtl8192u/r8192U_dm.c:2307:49: warning: cast from restricted __le16 drivers/staging/rtl8192u/r8192U_dm.c:2308:44: warning: cast from restricted __le16 drivers/staging/rtl8192u/r8192U_dm.c:2309:44: warning: cast from restricted __le16

And added space before '|'

---
 drivers/staging/rtl8192u/r8192U_dm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +3 -3
index 9209aad..e1c83a3 100644
@@ -2304,9 +2304,9 @@ static void dm_check_edca_turbo(
 				/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
 				dm_init_edca_turbo(dev);
 				u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
-				u4bAcParam = (((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
-					(((u32)(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
-					(((u32)(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
+				u4bAcParam = ((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET) |
+					((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET) |
+					((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET) |
 					((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET);
 				/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
 				write_nic_dword(dev, EDCAPARA_BE,  u4bAcParam);
Signature · 1 line
2.7.4
#5 lore raw

PATCH 6/6 staging: rtl8192u: Fix Sparse warning of cast to restricted __le16

In reply to simran singhal

This patch fixes the following Sparse warnings:-

drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16

---
 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +1 -1
index 4d6c928..713f1d6 100644
@@ -174,7 +174,7 @@ static inline u16 Mk16(u8 hi, u8 lo)
 
 static inline u16 Mk16_le(u16 *v)
 {
-	return le16_to_cpu(*v);
+	return *v;
 }
 
 
Signature · 1 line
2.7.4
#6 lore raw
In reply to simran singhal
Quoted 2 lines · simran singhal

This patch fixes the following sparse warning:
warning: cast to restricted __le16

You commit message should not say just fix X. What have you done to carry out the fix and why is this the correct approach?

julia

Quoted 113 lines
---
 drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/staging/wlan-ng/prism2sta.c +25 -27
index 984804b..82d3a70 100644
@@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
 			qualmsg->noise.status =
 			    P80211ENUM_msgitem_status_data_ok;
 
-			qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
-			qualmsg->level.data =
-				le16_to_cpu(hw->qual.asl_curr_bss);
-			qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
+			qualmsg->link.data = hw->qual.cq_curr_bss;
+			qualmsg->level.data = hw->qual.asl_curr_bss;
+			qualmsg->noise.data = hw->qual.anl_curr_fc;
 			qualmsg->txrate.data = hw->txrate;
 
 			break;
@@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the nic id fields in host byte order */
-	hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
-	hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
-	hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
-	hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
+	hw->ident_nic.id = hw->ident_nic.id;
+	hw->ident_nic.variant = hw->ident_nic.variant;
+	hw->ident_nic.major = hw->ident_nic.major;
+	hw->ident_nic.minor = hw->ident_nic.minor;
 
 	netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
 		    hw->ident_nic.id, hw->ident_nic.major,
@@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the private fw id fields in host byte order */
-	hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
-	hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
-	hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
-	hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
+	hw->ident_pri_fw.id = hw->ident_pri_fw.id;
+	hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
+	hw->ident_pri_fw.major = hw->ident_pri_fw.major;
+	hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
 
 	netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
 		    hw->ident_pri_fw.id, hw->ident_pri_fw.major,
@@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the station fw id fields in host byte order */
-	hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
-	hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
-	hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
-	hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
+	hw->ident_sta_fw.id = hw->ident_sta_fw.id;
+	hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
+	hw->ident_sta_fw.major = hw->ident_sta_fw.major;
+	hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
 
 	/* strip out the 'special' variant bits */
 	hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
@@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	/* get all the Compatibility range, modem interface supplier
 	 * fields in byte order
 	 */
-	hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
-	hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
-	hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
-	hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
-	hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
+	hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
+	hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
+	hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
+	hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
+	hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
 
 	netdev_info(wlandev->netdev,
 		    "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
@@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	/* get all the Compatibility range, controller interface supplier
 	 * fields in byte order
 	 */
-	hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
-	hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
-	hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
-	hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
-	hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
+	hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
+	hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
+	hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
+	hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
+	hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
 
 	netdev_info(wlandev->netdev,
 		    "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#7 lore raw
Quoted 9 lines · Julia Lawall
Quoted 2 lines · simran singhal

This patch fixes the following sparse warning:
warning: cast to restricted __le16

You commit message should not say just fix X. What have you done to carry out the fix and why is this the correct approach?

This comment applies to all of the patches in the series.

julia

Quoted 124 lines

julia

Quoted 106 lines
---
 drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/staging/wlan-ng/prism2sta.c +25 -27
index 984804b..82d3a70 100644
@@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
 			qualmsg->noise.status =
 			    P80211ENUM_msgitem_status_data_ok;
 
-			qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
-			qualmsg->level.data =
-				le16_to_cpu(hw->qual.asl_curr_bss);
-			qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
+			qualmsg->link.data = hw->qual.cq_curr_bss;
+			qualmsg->level.data = hw->qual.asl_curr_bss;
+			qualmsg->noise.data = hw->qual.anl_curr_fc;
 			qualmsg->txrate.data = hw->txrate;
 
 			break;
@@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the nic id fields in host byte order */
-	hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
-	hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
-	hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
-	hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
+	hw->ident_nic.id = hw->ident_nic.id;
+	hw->ident_nic.variant = hw->ident_nic.variant;
+	hw->ident_nic.major = hw->ident_nic.major;
+	hw->ident_nic.minor = hw->ident_nic.minor;
 
 	netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
 		    hw->ident_nic.id, hw->ident_nic.major,
@@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the private fw id fields in host byte order */
-	hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
-	hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
-	hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
-	hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
+	hw->ident_pri_fw.id = hw->ident_pri_fw.id;
+	hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
+	hw->ident_pri_fw.major = hw->ident_pri_fw.major;
+	hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
 
 	netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
 		    hw->ident_pri_fw.id, hw->ident_pri_fw.major,
@@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	}
 
 	/* get all the station fw id fields in host byte order */
-	hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
-	hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
-	hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
-	hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
+	hw->ident_sta_fw.id = hw->ident_sta_fw.id;
+	hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
+	hw->ident_sta_fw.major = hw->ident_sta_fw.major;
+	hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
 
 	/* strip out the 'special' variant bits */
 	hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
@@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	/* get all the Compatibility range, modem interface supplier
 	 * fields in byte order
 	 */
-	hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
-	hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
-	hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
-	hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
-	hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
+	hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
+	hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
+	hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
+	hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
+	hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
 
 	netdev_info(wlandev->netdev,
 		    "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
@@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
 	/* get all the Compatibility range, controller interface supplier
 	 * fields in byte order
 	 */
-	hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
-	hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
-	hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
-	hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
-	hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
+	hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
+	hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
+	hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
+	hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
+	hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
 
 	netdev_info(wlandev->netdev,
 		    "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
--

2.7.4

Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021047350.3414%40hadrien.
For more options, visit https://groups.google.com/d/optout.

#8 lore raw
Quoted 11 lines · Julia Lawall
Quoted 7 lines · Julia Lawall
Quoted 2 lines · simran singhal

This patch fixes the following sparse warning:
warning: cast to restricted __le16

Quoted 7 lines
Quoted 2 lines

You commit message should not say just fix X. What have you done to carry out the fix and why is this the correct approach?

This comment applies to all of the patches in the series.

julia

The changes and sparse warnings for them seems reasonable to me as after doing the
change sparse was not showing error like cast to __le16 or something like this. Also it compiled perfectly.

Quoted 124 lines
Quoted 124 lines

julia

Quoted 106 lines
---
 drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/staging/wlan-ng/prism2sta.c +25 -27
index 984804b..82d3a70 100644
@@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
                    qualmsg->noise.status =
                        P80211ENUM_msgitem_status_data_ok;
 
-                   qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
-                   qualmsg->level.data =
-                           le16_to_cpu(hw->qual.asl_curr_bss);
-                   qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
+                   qualmsg->link.data = hw->qual.cq_curr_bss;
+                   qualmsg->level.data = hw->qual.asl_curr_bss;
+                   qualmsg->noise.data = hw->qual.anl_curr_fc;
                    qualmsg->txrate.data = hw->txrate;
 
                    break;
@@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the nic id fields in host byte order */
-   hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
-   hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
-   hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
-   hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
+   hw->ident_nic.id = hw->ident_nic.id;
+   hw->ident_nic.variant = hw->ident_nic.variant;
+   hw->ident_nic.major = hw->ident_nic.major;
+   hw->ident_nic.minor = hw->ident_nic.minor;
 
    netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
                hw->ident_nic.id, hw->ident_nic.major,
@@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the private fw id fields in host byte order */
-   hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
-   hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
-   hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
-   hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
+   hw->ident_pri_fw.id = hw->ident_pri_fw.id;
+   hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
+   hw->ident_pri_fw.major = hw->ident_pri_fw.major;
+   hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
 
    netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
                hw->ident_pri_fw.id, hw->ident_pri_fw.major,
@@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the station fw id fields in host byte order */
-   hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
-   hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
-   hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
-   hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
+   hw->ident_sta_fw.id = hw->ident_sta_fw.id;
+   hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
+   hw->ident_sta_fw.major = hw->ident_sta_fw.major;
+   hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
 
    /* strip out the 'special' variant bits */
    hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
@@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    /* get all the Compatibility range, modem interface supplier
     * fields in byte order
     */
-   hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
-   hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
-   hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
-   hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
-   hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
+   hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
+   hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
+   hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
+   hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
+   hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
 
    netdev_info(wlandev->netdev,
                "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
@@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    /* get all the Compatibility range, controller interface supplier
     * fields in byte order
     */
-   hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
-   hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
-   hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
-   hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
-   hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
+   hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
+   hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
+   hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
+   hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
+   hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
 
    netdev_info(wlandev->netdev,
                "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
--

2.7.4

Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021047350.3414%40hadrien.
For more options, visit https://groups.google.com/d/optout.

#9 lore raw
Quoted 15 lines · SIMRAN SINGHAL
Quoted 14 lines · Julia Lawall
Quoted 9 lines · Julia Lawall
Quoted 2 lines · simran singhal

This patch fixes the following sparse warning:
warning: cast to restricted __le16

You commit message should not say just fix X. What have you done to carry out the fix and why is this the correct approach?

Quoted 8 lines
Quoted 4 lines

This comment applies to all of the patches in the series.

julia

The changes and sparse warnings for them seems reasonable to me as after doing the
change sparse was not showing error like cast to __le16 or something like this. Also it compiled perfectly.

This doesn't mean that it actually works. The function calls at least may have been put there for a reason. Maysbe you can find other patches that relate to this call and see what they do.

julia

Quoted 132 lines
Quoted 109 lines
Quoted 109 lines

julia

Quoted 106 lines
---
 drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/staging/wlan-ng/prism2sta.c +25 -27
index 984804b..82d3a70 100644
@@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
                    qualmsg->noise.status =
                        P80211ENUM_msgitem_status_data_ok;
 
-                   qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
-                   qualmsg->level.data =
-                           le16_to_cpu(hw->qual.asl_curr_bss);
-                   qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
+                   qualmsg->link.data = hw->qual.cq_curr_bss;
+                   qualmsg->level.data = hw->qual.asl_curr_bss;
+                   qualmsg->noise.data = hw->qual.anl_curr_fc;
                    qualmsg->txrate.data = hw->txrate;
 
                    break;
@@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the nic id fields in host byte order */
-   hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
-   hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
-   hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
-   hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
+   hw->ident_nic.id = hw->ident_nic.id;
+   hw->ident_nic.variant = hw->ident_nic.variant;
+   hw->ident_nic.major = hw->ident_nic.major;
+   hw->ident_nic.minor = hw->ident_nic.minor;
 
    netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
                hw->ident_nic.id, hw->ident_nic.major,
@@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the private fw id fields in host byte order */
-   hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
-   hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
-   hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
-   hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
+   hw->ident_pri_fw.id = hw->ident_pri_fw.id;
+   hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
+   hw->ident_pri_fw.major = hw->ident_pri_fw.major;
+   hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
 
    netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
                hw->ident_pri_fw.id, hw->ident_pri_fw.major,
@@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the station fw id fields in host byte order */
-   hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
-   hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
-   hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
-   hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
+   hw->ident_sta_fw.id = hw->ident_sta_fw.id;
+   hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
+   hw->ident_sta_fw.major = hw->ident_sta_fw.major;
+   hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
 
    /* strip out the 'special' variant bits */
    hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
@@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    /* get all the Compatibility range, modem interface supplier
     * fields in byte order
     */
-   hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
-   hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
-   hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
-   hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
-   hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
+   hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
+   hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
+   hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
+   hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
+   hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
 
    netdev_info(wlandev->netdev,
                "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
@@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    /* get all the Compatibility range, controller interface supplier
     * fields in byte order
     */
-   hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
-   hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
-   hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
-   hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
-   hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
+   hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
+   hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
+   hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
+   hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
+   hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
 
    netdev_info(wlandev->netdev,
                "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
--

2.7.4

Quoted 15 lines
Quoted 8 lines
Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021047350.3414%40hadrien.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CALrZqyNGZcP8c9oeS65r-PRTPpwcn664iB2WvWdx3ccD5KRRLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#10 lore raw
Quoted 28 lines · Julia Lawall
Quoted 15 lines · SIMRAN SINGHAL
Quoted 14 lines · Julia Lawall
Quoted 9 lines · Julia Lawall
Quoted 2 lines · simran singhal

This patch fixes the following sparse warning:
warning: cast to restricted __le16

You commit message should not say just fix X. What have you done to carry out the fix and why is this the correct approach?

Quoted 8 lines
Quoted 4 lines

This comment applies to all of the patches in the series.

julia

The changes and sparse warnings for them seems reasonable to me as after doing the
change sparse was not showing error like cast to __le16 or something like this. Also it compiled perfectly.

Quoted 5 lines

This doesn't mean that it actually works. The function calls at least may have been put there for a reason. Maysbe you can find other patches that relate to this call and see what they do.

julia

Hi Simran,

Just following on Julia's feedback and I see you've gotten a message that this breaks little endian machines.

Good for you for trying to go deeper. I'd suggest taking this one at a time and figure out what is going on with one of them. As Julia says, with this kind of change, you will have to prove why it is correct. (You might not be able to change any of these - I don't know, but I know you'll learn something!)

Look here - and then pick one to trace through -
https://kernelnewbies.org/EndianIssues

Generally - probably best to test the waters with something of this type, with a single patch. Get that nailed, then move onto a patchset, if you have a pattern.

Heads down & good luck!

alisons

Quoted 141 lines
Quoted 134 lines
Quoted 111 lines
Quoted 111 lines

julia

Quoted 106 lines
---
 drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/staging/wlan-ng/prism2sta.c +25 -27
index 984804b..82d3a70 100644
@@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
                    qualmsg->noise.status =
                        P80211ENUM_msgitem_status_data_ok;
 
-                   qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
-                   qualmsg->level.data =
-                           le16_to_cpu(hw->qual.asl_curr_bss);
-                   qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
+                   qualmsg->link.data = hw->qual.cq_curr_bss;
+                   qualmsg->level.data = hw->qual.asl_curr_bss;
+                   qualmsg->noise.data = hw->qual.anl_curr_fc;
                    qualmsg->txrate.data = hw->txrate;
 
                    break;
@@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the nic id fields in host byte order */
-   hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
-   hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
-   hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
-   hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
+   hw->ident_nic.id = hw->ident_nic.id;
+   hw->ident_nic.variant = hw->ident_nic.variant;
+   hw->ident_nic.major = hw->ident_nic.major;
+   hw->ident_nic.minor = hw->ident_nic.minor;
 
    netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
                hw->ident_nic.id, hw->ident_nic.major,
@@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the private fw id fields in host byte order */
-   hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
-   hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
-   hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
-   hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
+   hw->ident_pri_fw.id = hw->ident_pri_fw.id;
+   hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
+   hw->ident_pri_fw.major = hw->ident_pri_fw.major;
+   hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
 
    netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
                hw->ident_pri_fw.id, hw->ident_pri_fw.major,
@@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    }
 
    /* get all the station fw id fields in host byte order */
-   hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
-   hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
-   hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
-   hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
+   hw->ident_sta_fw.id = hw->ident_sta_fw.id;
+   hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
+   hw->ident_sta_fw.major = hw->ident_sta_fw.major;
+   hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
 
    /* strip out the 'special' variant bits */
    hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
@@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    /* get all the Compatibility range, modem interface supplier
     * fields in byte order
     */
-   hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
-   hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
-   hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
-   hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
-   hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
+   hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
+   hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
+   hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
+   hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
+   hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
 
    netdev_info(wlandev->netdev,
                "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
@@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
    /* get all the Compatibility range, controller interface supplier
     * fields in byte order
     */
-   hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
-   hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
-   hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
-   hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
-   hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
+   hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
+   hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
+   hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
+   hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
+   hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
 
    netdev_info(wlandev->netdev,
                "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
--

2.7.4

Quoted 15 lines
Quoted 8 lines
Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021047350.3414%40hadrien.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CALrZqyNGZcP8c9oeS65r-PRTPpwcn664iB2WvWdx3ccD5KRRLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021213050.3414%40hadrien.
For more options, visit https://groups.google.com/d/optout.