Skip to contentSkip to conversation

d80211: Add sparse bitwise annotations

PATCH New Michael Wu 1 participant 1 message Jul 14, 2006

Subsystems (2)
lore
Share & tools
lore

Michael Wu

author
#0 lore raw

PATCH 1/1 d80211: Add sparse bitwise annotations

This patch adds sparse bitwise annotations to d80211.

---

 include/net/d80211.h       |    6 +++---
 include/net/d80211_mgmt.h  |   42 +++++++++++++++++++++---------------------
 net/d80211/ieee80211_sta.c |    7 +------
 3 files changed, 25 insertions(+), 30 deletions(-)
include/net/d80211.h +3 -3
index 6ae4325..e6dcb0e 100644
@@ -959,12 +959,12 @@ #define IEEE80211_MAX_FRAG_THRESHOLD 234
 #define IEEE80211_MAX_RTS_THRESHOLD 2347
 
 struct ieee80211_hdr {
-	u16 frame_control;
-	u16 duration_id;
+	__le16 frame_control;
+	__le16 duration_id;
 	u8 addr1[6];
 	u8 addr2[6];
 	u8 addr3[6];
-	u16 seq_ctrl;
+	__le16 seq_ctrl;
 	u8 addr4[6];
 } __attribute__ ((packed));
 
include/net/d80211_mgmt.h +21 -21

80 lines not on this page · raw message

net/d80211/ieee80211_sta.c +1 -6
index 82fbe3d..b0cfff1 100644
@@ -1344,7 +1344,6 @@ static void ieee80211_rx_bss_info(struct
 	struct sta_info *sta;
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	u64 timestamp;
-	u8 *pos;
 
 	if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
 		return; /* ignore ProbeResp to foreign address */
@@ -1359,11 +1358,7 @@ #endif
 	if (baselen > len)
 		return;
 
-	pos = mgmt->u.beacon.timestamp;
-	timestamp = ((u64) pos[7] << 56) | ((u64) pos[6] << 48) |
-		((u64) pos[5] << 40) | ((u64) pos[4] << 32) |
-		((u64) pos[3] << 24) | ((u64) pos[2] << 16) |
-		((u64) pos[1] << 8) | ((u64) pos[0]);
+	timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);
 
 	if (sdata->type == IEEE80211_IF_TYPE_IBSS && beacon &&
 	    memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) {