Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hostap annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Al Viro and committed by
David S. Miller
8a9faf3c 3eb9b41f

+233 -235
+17 -17
drivers/net/wireless/hostap/hostap_80211.h
··· 5 5 #include <net/ieee80211_crypt.h> 6 6 7 7 struct hostap_ieee80211_mgmt { 8 - u16 frame_control; 9 - u16 duration; 8 + __le16 frame_control; 9 + __le16 duration; 10 10 u8 da[6]; 11 11 u8 sa[6]; 12 12 u8 bssid[6]; 13 - u16 seq_ctrl; 13 + __le16 seq_ctrl; 14 14 union { 15 15 struct { 16 - u16 auth_alg; 17 - u16 auth_transaction; 18 - u16 status_code; 16 + __le16 auth_alg; 17 + __le16 auth_transaction; 18 + __le16 status_code; 19 19 /* possibly followed by Challenge text */ 20 20 u8 variable[0]; 21 21 } __attribute__ ((packed)) auth; 22 22 struct { 23 - u16 reason_code; 23 + __le16 reason_code; 24 24 } __attribute__ ((packed)) deauth; 25 25 struct { 26 - u16 capab_info; 27 - u16 listen_interval; 26 + __le16 capab_info; 27 + __le16 listen_interval; 28 28 /* followed by SSID and Supported rates */ 29 29 u8 variable[0]; 30 30 } __attribute__ ((packed)) assoc_req; 31 31 struct { 32 - u16 capab_info; 33 - u16 status_code; 34 - u16 aid; 32 + __le16 capab_info; 33 + __le16 status_code; 34 + __le16 aid; 35 35 /* followed by Supported rates */ 36 36 u8 variable[0]; 37 37 } __attribute__ ((packed)) assoc_resp, reassoc_resp; 38 38 struct { 39 - u16 capab_info; 40 - u16 listen_interval; 39 + __le16 capab_info; 40 + __le16 listen_interval; 41 41 u8 current_ap[6]; 42 42 /* followed by SSID and Supported rates */ 43 43 u8 variable[0]; 44 44 } __attribute__ ((packed)) reassoc_req; 45 45 struct { 46 - u16 reason_code; 46 + __le16 reason_code; 47 47 } __attribute__ ((packed)) disassoc; 48 48 struct { 49 49 } __attribute__ ((packed)) probe_req; 50 50 struct { 51 51 u8 timestamp[8]; 52 - u16 beacon_int; 53 - u16 capab_info; 52 + __le16 beacon_int; 53 + __le16 capab_info; 54 54 /* followed by some of SSID, Supported rates, 55 55 * FH Params, DS Params, CF Params, IBSS Params, TIM */ 56 56 u8 variable[0];
+1 -1
drivers/net/wireless/hostap/hostap_80211_rx.c
··· 1039 1039 memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); 1040 1040 memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); 1041 1041 } else { 1042 - u16 len; 1042 + __be16 len; 1043 1043 /* Leave Ethernet header part of hdr and full payload */ 1044 1044 skb_pull(skb, hdrlen); 1045 1045 len = htons(skb->len);
+38 -34
drivers/net/wireless/hostap/hostap_ap.c
··· 258 258 sta->addr, ap->tx_callback_poll); 259 259 } else { 260 260 int deauth = sta->timeout_next == STA_DEAUTH; 261 - u16 resp; 261 + __le16 resp; 262 262 PDEBUG(DEBUG_AP, "%s: sending %s info to STA %s" 263 263 "(last=%lu, jiffies=%lu)\n", 264 264 local->dev->name, ··· 300 300 int resend) 301 301 { 302 302 u8 addr[ETH_ALEN]; 303 - u16 resp; 303 + __le16 resp; 304 304 int i; 305 305 306 306 PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name); 307 307 memset(addr, 0xff, ETH_ALEN); 308 308 309 - resp = __constant_cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); 309 + resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); 310 310 311 311 /* deauth message sent; try to resend it few times; the message is 312 312 * broadcast, so it may be delayed until next DTIM; there is not much ··· 462 462 int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) 463 463 { 464 464 struct sta_info *sta; 465 - u16 resp; 465 + __le16 resp; 466 466 467 467 spin_lock_bh(&ap->sta_table_lock); 468 468 sta = ap_get_sta(ap, mac); ··· 628 628 struct ap_data *ap = data; 629 629 struct net_device *dev = ap->local->dev; 630 630 struct ieee80211_hdr_4addr *hdr; 631 - u16 fc, *pos, auth_alg, auth_transaction, status; 631 + u16 fc, auth_alg, auth_transaction, status; 632 + __le16 *pos; 632 633 struct sta_info *sta = NULL; 633 634 char *txt = NULL; 634 635 DECLARE_MAC_BUF(mac); ··· 650 649 return; 651 650 } 652 651 653 - pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 652 + pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 654 653 auth_alg = le16_to_cpu(*pos++); 655 654 auth_transaction = le16_to_cpu(*pos++); 656 655 status = le16_to_cpu(*pos++); ··· 699 698 struct ap_data *ap = data; 700 699 struct net_device *dev = ap->local->dev; 701 700 struct ieee80211_hdr_4addr *hdr; 702 - u16 fc, *pos, status; 701 + u16 fc, status; 702 + __le16 *pos; 703 703 struct sta_info *sta = NULL; 704 704 char *txt = NULL; 705 705 DECLARE_MAC_BUF(mac); ··· 738 736 goto done; 739 737 } 740 738 741 - pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 739 + pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 742 740 pos++; 743 741 status = le16_to_cpu(*pos++); 744 742 if (status == WLAN_STATUS_SUCCESS) { ··· 1300 1298 struct ap_data *ap = local->ap; 1301 1299 char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; 1302 1300 int len, olen; 1303 - u16 auth_alg, auth_transaction, status_code, *pos; 1301 + u16 auth_alg, auth_transaction, status_code; 1302 + __le16 *pos; 1304 1303 u16 resp = WLAN_STATUS_SUCCESS, fc; 1305 1304 struct sta_info *sta = NULL; 1306 1305 struct ieee80211_crypt_data *crypt; ··· 1335 1332 crypt = local->crypt[idx]; 1336 1333 } 1337 1334 1338 - pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 1335 + pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 1339 1336 auth_alg = __le16_to_cpu(*pos); 1340 1337 pos++; 1341 1338 auth_transaction = __le16_to_cpu(*pos); ··· 1468 1465 } 1469 1466 1470 1467 fail: 1471 - pos = (u16 *) body; 1468 + pos = (__le16 *) body; 1472 1469 *pos = cpu_to_le16(auth_alg); 1473 1470 pos++; 1474 1471 *pos = cpu_to_le16(auth_transaction + 1); ··· 1513 1510 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; 1514 1511 char body[12], *p, *lpos; 1515 1512 int len, left; 1516 - u16 *pos; 1513 + __le16 *pos; 1517 1514 u16 resp = WLAN_STATUS_SUCCESS; 1518 1515 struct sta_info *sta = NULL; 1519 1516 int send_deauth = 0; ··· 1543 1540 atomic_inc(&sta->users); 1544 1541 spin_unlock_bh(&local->ap->sta_table_lock); 1545 1542 1546 - pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 1543 + pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 1547 1544 sta->capability = __le16_to_cpu(*pos); 1548 1545 pos++; left -= 2; 1549 1546 sta->listen_interval = __le16_to_cpu(*pos); ··· 1639 1636 } 1640 1637 1641 1638 fail: 1642 - pos = (u16 *) body; 1639 + pos = (__le16 *) body; 1643 1640 1644 1641 if (send_deauth) { 1645 - *pos = __constant_cpu_to_le16( 1646 - WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH); 1642 + *pos = cpu_to_le16(WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH); 1647 1643 pos++; 1648 1644 } else { 1649 1645 /* FIX: CF-Pollable and CF-PollReq should be set to match the 1650 1646 * values in beacons/probe responses */ 1651 1647 /* FIX: how about privacy and WEP? */ 1652 1648 /* capability */ 1653 - *pos = __constant_cpu_to_le16(WLAN_CAPABILITY_ESS); 1649 + *pos = cpu_to_le16(WLAN_CAPABILITY_ESS); 1654 1650 pos++; 1655 1651 1656 1652 /* status_code */ 1657 - *pos = __cpu_to_le16(resp); 1653 + *pos = cpu_to_le16(resp); 1658 1654 pos++; 1659 1655 1660 - *pos = __cpu_to_le16((sta && sta->aid > 0 ? sta->aid : 0) | 1656 + *pos = cpu_to_le16((sta && sta->aid > 0 ? sta->aid : 0) | 1661 1657 BIT(14) | BIT(15)); /* AID */ 1662 1658 pos++; 1663 1659 ··· 1683 1681 0x96 : 0x16; 1684 1682 (*lpos)++; 1685 1683 } 1686 - pos = (u16 *) p; 1684 + pos = (__le16 *) p; 1687 1685 } 1688 1686 1689 1687 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | ··· 1720 1718 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; 1721 1719 char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); 1722 1720 int len; 1723 - u16 reason_code, *pos; 1721 + u16 reason_code; 1722 + __le16 *pos; 1724 1723 struct sta_info *sta = NULL; 1725 1724 DECLARE_MAC_BUF(mac); 1726 1725 ··· 1732 1729 return; 1733 1730 } 1734 1731 1735 - pos = (u16 *) body; 1736 - reason_code = __le16_to_cpu(*pos); 1732 + pos = (__le16 *) body; 1733 + reason_code = le16_to_cpu(*pos); 1737 1734 1738 1735 PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, " 1739 1736 "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, ··· 1763 1760 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; 1764 1761 char *body = skb->data + IEEE80211_MGMT_HDR_LEN; 1765 1762 int len; 1766 - u16 reason_code, *pos; 1763 + u16 reason_code; 1764 + __le16 *pos; 1767 1765 struct sta_info *sta = NULL; 1768 1766 DECLARE_MAC_BUF(mac); 1769 1767 ··· 1775 1771 return; 1776 1772 } 1777 1773 1778 - pos = (u16 *) body; 1779 - reason_code = __le16_to_cpu(*pos); 1774 + pos = (__le16 *) body; 1775 + reason_code = le16_to_cpu(*pos); 1780 1776 1781 1777 PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, " 1782 1778 "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, ··· 1821 1817 { 1822 1818 struct net_device *dev = local->dev; 1823 1819 struct sta_info *sta; 1824 - u16 reason; 1820 + __le16 reason; 1825 1821 1826 1822 spin_lock_bh(&local->ap->sta_table_lock); 1827 1823 sta = ap_get_sta(local->ap, hdr->addr2); ··· 1835 1831 return; 1836 1832 } 1837 1833 1838 - reason = __constant_cpu_to_le16( 1839 - WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); 1834 + reason = cpu_to_le16(WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); 1840 1835 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | 1841 1836 ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? 1842 1837 IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC), ··· 1895 1892 return; 1896 1893 } 1897 1894 1898 - aid = __le16_to_cpu(hdr->duration_id); 1895 + aid = le16_to_cpu(hdr->duration_id); 1899 1896 if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) { 1900 1897 PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); 1901 1898 return; ··· 2001 1998 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; 2002 1999 char *body = skb->data + IEEE80211_MGMT_HDR_LEN; 2003 2000 int len, left; 2004 - u16 *pos, beacon_int, capability; 2001 + u16 beacon_int, capability; 2002 + __le16 *pos; 2005 2003 char *ssid = NULL; 2006 2004 unsigned char *supp_rates = NULL; 2007 2005 int ssid_len = 0, supp_rates_len = 0; ··· 2017 2013 return; 2018 2014 } 2019 2015 2020 - pos = (u16 *) body; 2016 + pos = (__le16 *) body; 2021 2017 left = len; 2022 2018 2023 2019 /* Timestamp (8 octets) */ 2024 2020 pos += 4; left -= 8; 2025 2021 /* Beacon interval (2 octets) */ 2026 - beacon_int = __le16_to_cpu(*pos); 2022 + beacon_int = le16_to_cpu(*pos); 2027 2023 pos++; left -= 2; 2028 2024 /* Capability information (2 octets) */ 2029 - capability = __le16_to_cpu(*pos); 2025 + capability = le16_to_cpu(*pos); 2030 2026 pos++; left -= 2; 2031 2027 2032 2028 if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS &&
+17 -17
drivers/net/wireless/hostap/hostap_common.h
··· 188 188 189 189 struct hfa384x_comp_ident 190 190 { 191 - u16 id; 192 - u16 variant; 193 - u16 major; 194 - u16 minor; 191 + __le16 id; 192 + __le16 variant; 193 + __le16 major; 194 + __le16 minor; 195 195 } __attribute__ ((packed)); 196 196 197 197 #define HFA384X_COMP_ID_PRI 0x15 ··· 200 200 201 201 struct hfa384x_sup_range 202 202 { 203 - u16 role; 204 - u16 id; 205 - u16 variant; 206 - u16 bottom; 207 - u16 top; 203 + __le16 role; 204 + __le16 id; 205 + __le16 variant; 206 + __le16 bottom; 207 + __le16 top; 208 208 } __attribute__ ((packed)); 209 209 210 210 211 211 struct hfa384x_build_id 212 212 { 213 - u16 pri_seq; 214 - u16 sec_seq; 213 + __le16 pri_seq; 214 + __le16 sec_seq; 215 215 } __attribute__ ((packed)); 216 216 217 217 /* FD01 - Download Buffer */ 218 218 struct hfa384x_rid_download_buffer 219 219 { 220 - u16 page; 221 - u16 offset; 222 - u16 length; 220 + __le16 page; 221 + __le16 offset; 222 + __le16 length; 223 223 } __attribute__ ((packed)); 224 224 225 225 /* BSS connection quality (RID FD43 range, RID FD51 dBm-normalized) */ 226 226 struct hfa384x_comms_quality { 227 - u16 comm_qual; /* 0 .. 92 */ 228 - u16 signal_level; /* 27 .. 154 */ 229 - u16 noise_level; /* 27 .. 154 */ 227 + __le16 comm_qual; /* 0 .. 92 */ 228 + __le16 signal_level; /* 27 .. 154 */ 229 + __le16 noise_level; /* 27 .. 154 */ 230 230 } __attribute__ ((packed)); 231 231 232 232
+10 -12
drivers/net/wireless/hostap/hostap_download.c
··· 100 100 101 101 #ifdef PRISM2_PCI 102 102 { 103 - u16 *pos = (u16 *) buf; 103 + __le16 *pos = (__le16 *) buf; 104 104 while (len > 0) { 105 105 *pos++ = HFA384X_INW_DATA(HFA384X_AUXDATA_OFF); 106 106 len -= 2; ··· 131 131 132 132 #ifdef PRISM2_PCI 133 133 { 134 - u16 *pos = (u16 *) buf; 134 + __le16 *pos = (__le16 *) buf; 135 135 while (len > 0) { 136 136 HFA384X_OUTW_DATA(*pos++, HFA384X_AUXDATA_OFF); 137 137 len -= 2; ··· 147 147 148 148 static int prism2_pda_ok(u8 *buf) 149 149 { 150 - u16 *pda = (u16 *) buf; 150 + __le16 *pda = (__le16 *) buf; 151 151 int pos; 152 152 u16 len, pdr; 153 153 ··· 544 544 struct net_device *dev = local->dev; 545 545 int ret = 0, i; 546 546 struct { 547 - u16 page; 548 - u16 offset; 549 - u16 len; 547 + __le16 page; 548 + __le16 offset; 549 + __le16 len; 550 550 } dlbuffer; 551 551 u32 bufaddr; 552 552 ··· 565 565 goto out; 566 566 } 567 567 568 - dlbuffer.page = le16_to_cpu(dlbuffer.page); 569 - dlbuffer.offset = le16_to_cpu(dlbuffer.offset); 570 - dlbuffer.len = le16_to_cpu(dlbuffer.len); 571 - 572 568 printk(KERN_DEBUG "Download buffer: %d bytes at 0x%04x:0x%04x\n", 573 - dlbuffer.len, dlbuffer.page, dlbuffer.offset); 569 + le16_to_cpu(dlbuffer.len), 570 + le16_to_cpu(dlbuffer.page), 571 + le16_to_cpu(dlbuffer.offset)); 574 572 575 - bufaddr = (dlbuffer.page << 7) + dlbuffer.offset; 573 + bufaddr = (le16_to_cpu(dlbuffer.page) << 7) + le16_to_cpu(dlbuffer.offset); 576 574 577 575 local->hw_downloading = 1; 578 576
+5 -5
drivers/net/wireless/hostap/hostap_hw.c
··· 1075 1075 { 1076 1076 struct hostap_interface *iface; 1077 1077 local_info_t *local; 1078 - u16 tmp; 1078 + __le16 tmp; 1079 1079 int ret = 0; 1080 1080 1081 1081 iface = netdev_priv(dev); ··· 1084 1084 hostap_set_word(dev, HFA384X_RID_TICKTIME, 2000); 1085 1085 1086 1086 if (!local->fw_ap) { 1087 - tmp = hostap_get_porttype(local); 1088 - ret = hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, tmp); 1087 + u16 tmp1 = hostap_get_porttype(local); 1088 + ret = hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, tmp1); 1089 1089 if (ret) { 1090 1090 printk("%s: Port type setting to %d failed\n", 1091 - dev->name, tmp); 1091 + dev->name, tmp1); 1092 1092 goto fail; 1093 1093 } 1094 1094 } ··· 1117 1117 ret = -EINVAL; 1118 1118 goto fail; 1119 1119 } 1120 - local->channel_mask = __le16_to_cpu(tmp); 1120 + local->channel_mask = le16_to_cpu(tmp); 1121 1121 1122 1122 if (local->channel < 1 || local->channel > 14 || 1123 1123 !(local->channel_mask & (1 << (local->channel - 1)))) {
+2 -2
drivers/net/wireless/hostap/hostap_info.c
··· 303 303 int i, result_size, copy_len, new_count; 304 304 struct hfa384x_hostscan_result *results, *prev; 305 305 unsigned long flags; 306 - u16 *pos; 306 + __le16 *pos; 307 307 u8 *ptr; 308 308 309 309 wake_up_interruptible(&local->hostscan_wq); ··· 314 314 return; 315 315 } 316 316 317 - pos = (u16 *) buf; 317 + pos = (__le16 *) buf; 318 318 copy_len = result_size = le16_to_cpu(*pos); 319 319 if (result_size == 0) { 320 320 printk(KERN_DEBUG "%s: invalid result_size (0) in "
+31 -35
drivers/net/wireless/hostap/hostap_ioctl.c
··· 84 84 if (len < 2) 85 85 return 0; 86 86 87 - val = le16_to_cpu(*(u16 *) buf); /* string length */ 87 + val = le16_to_cpu(*(__le16 *) buf); /* string length */ 88 88 89 89 if (len - 2 < val || val > 10) 90 90 return 0; ··· 496 496 { 497 497 struct hostap_interface *iface; 498 498 local_info_t *local; 499 - u16 val; 499 + __le16 val; 500 500 501 501 iface = netdev_priv(dev); 502 502 local = iface->local; ··· 506 506 0) 507 507 return -EINVAL; 508 508 509 - sens->value = __le16_to_cpu(val); 509 + sens->value = le16_to_cpu(val); 510 510 sens->fixed = 1; 511 511 512 512 return 0; ··· 561 561 { 562 562 struct hostap_interface *iface; 563 563 local_info_t *local; 564 - u16 val; 564 + __le16 val; 565 565 566 566 iface = netdev_priv(dev); 567 567 local = iface->local; 568 568 569 569 if (rts->disabled) 570 - val = __constant_cpu_to_le16(2347); 570 + val = cpu_to_le16(2347); 571 571 else if (rts->value < 0 || rts->value > 2347) 572 572 return -EINVAL; 573 573 else 574 - val = __cpu_to_le16(rts->value); 574 + val = cpu_to_le16(rts->value); 575 575 576 576 if (local->func->set_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2) || 577 577 local->func->reset_port(dev)) ··· 588 588 { 589 589 struct hostap_interface *iface; 590 590 local_info_t *local; 591 - u16 val; 591 + __le16 val; 592 592 593 593 iface = netdev_priv(dev); 594 594 local = iface->local; ··· 597 597 0) 598 598 return -EINVAL; 599 599 600 - rts->value = __le16_to_cpu(val); 600 + rts->value = le16_to_cpu(val); 601 601 rts->disabled = (rts->value == 2347); 602 602 rts->fixed = 1; 603 603 ··· 611 611 { 612 612 struct hostap_interface *iface; 613 613 local_info_t *local; 614 - u16 val; 614 + __le16 val; 615 615 616 616 iface = netdev_priv(dev); 617 617 local = iface->local; 618 618 619 619 if (rts->disabled) 620 - val = __constant_cpu_to_le16(2346); 620 + val = cpu_to_le16(2346); 621 621 else if (rts->value < 256 || rts->value > 2346) 622 622 return -EINVAL; 623 623 else 624 - val = __cpu_to_le16(rts->value & ~0x1); /* even numbers only */ 624 + val = cpu_to_le16(rts->value & ~0x1); /* even numbers only */ 625 625 626 626 local->fragm_threshold = rts->value & ~0x1; 627 627 if (local->func->set_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, &val, ··· 638 638 { 639 639 struct hostap_interface *iface; 640 640 local_info_t *local; 641 - u16 val; 641 + __le16 val; 642 642 643 643 iface = netdev_priv(dev); 644 644 local = iface->local; ··· 647 647 &val, 2, 1) < 0) 648 648 return -EINVAL; 649 649 650 - rts->value = __le16_to_cpu(val); 650 + rts->value = le16_to_cpu(val); 651 651 rts->disabled = (rts->value == 2346); 652 652 rts->fixed = 1; 653 653 ··· 718 718 if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) { 719 719 struct hfa384x_scan_request scan_req; 720 720 memset(&scan_req, 0, sizeof(scan_req)); 721 - scan_req.channel_list = __constant_cpu_to_le16(0x3fff); 722 - scan_req.txrate = __constant_cpu_to_le16(HFA384X_RATES_1MBPS); 721 + scan_req.channel_list = cpu_to_le16(0x3fff); 722 + scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS); 723 723 if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, 724 724 &scan_req, sizeof(scan_req))) { 725 725 printk(KERN_DEBUG "%s: ScanResults request failed - " ··· 812 812 813 813 len = local->func->get_rid(dev, HFA384X_RID_CNFOWNNAME, 814 814 &name, MAX_NAME_LEN + 2, 0); 815 - val = __le16_to_cpu(*(u16 *) name); 815 + val = le16_to_cpu(*(__le16 *) name); 816 816 if (len > MAX_NAME_LEN + 2 || len < 0 || val > MAX_NAME_LEN) 817 817 return -EOPNOTSUPP; 818 818 ··· 963 963 memset(ssid, 0, sizeof(ssid)); 964 964 len = local->func->get_rid(dev, HFA384X_RID_CURRENTSSID, 965 965 &ssid, MAX_SSID_LEN + 2, 0); 966 - val = __le16_to_cpu(*(u16 *) ssid); 966 + val = le16_to_cpu(*(__le16 *) ssid); 967 967 if (len > MAX_SSID_LEN + 2 || len < 0 || val > MAX_SSID_LEN) { 968 968 return -EOPNOTSUPP; 969 969 } ··· 1319 1319 #else /* PRISM2_NO_STATION_MODES */ 1320 1320 struct hostap_interface *iface; 1321 1321 local_info_t *local; 1322 - u16 enable, mcast; 1322 + __le16 enable, mcast; 1323 1323 1324 1324 iface = netdev_priv(dev); 1325 1325 local = iface->local; ··· 1328 1328 < 0) 1329 1329 return -EINVAL; 1330 1330 1331 - if (!__le16_to_cpu(enable)) { 1331 + if (!le16_to_cpu(enable)) { 1332 1332 rrq->disabled = 1; 1333 1333 return 0; 1334 1334 } ··· 1336 1336 rrq->disabled = 0; 1337 1337 1338 1338 if ((rrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { 1339 - u16 timeout; 1339 + __le16 timeout; 1340 1340 if (local->func->get_rid(dev, 1341 1341 HFA384X_RID_CNFPMHOLDOVERDURATION, 1342 1342 &timeout, 2, 1) < 0) 1343 1343 return -EINVAL; 1344 1344 1345 1345 rrq->flags = IW_POWER_TIMEOUT; 1346 - rrq->value = __le16_to_cpu(timeout) * 1024; 1346 + rrq->value = le16_to_cpu(timeout) * 1024; 1347 1347 } else { 1348 - u16 period; 1348 + __le16 period; 1349 1349 if (local->func->get_rid(dev, HFA384X_RID_CNFMAXSLEEPDURATION, 1350 1350 &period, 2, 1) < 0) 1351 1351 return -EINVAL; 1352 1352 1353 1353 rrq->flags = IW_POWER_PERIOD; 1354 - rrq->value = __le16_to_cpu(period) * 1024; 1354 + rrq->value = le16_to_cpu(period) * 1024; 1355 1355 } 1356 1356 1357 1357 if (local->func->get_rid(dev, HFA384X_RID_CNFMULTICASTRECEIVE, &mcast, 1358 1358 2, 1) < 0) 1359 1359 return -EINVAL; 1360 1360 1361 - if (__le16_to_cpu(mcast)) 1361 + if (le16_to_cpu(mcast)) 1362 1362 rrq->flags |= IW_POWER_ALL_R; 1363 1363 else 1364 1364 rrq->flags |= IW_POWER_UNICAST_R; ··· 1435 1435 { 1436 1436 struct hostap_interface *iface; 1437 1437 local_info_t *local; 1438 - u16 shortretry, longretry, lifetime, altretry; 1438 + __le16 shortretry, longretry, lifetime, altretry; 1439 1439 1440 1440 iface = netdev_priv(dev); 1441 1441 local = iface->local; ··· 1448 1448 &lifetime, 2, 1) < 0) 1449 1449 return -EINVAL; 1450 1450 1451 - le16_to_cpus(&shortretry); 1452 - le16_to_cpus(&longretry); 1453 - le16_to_cpus(&lifetime); 1454 - 1455 1451 rrq->disabled = 0; 1456 1452 1457 1453 if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { 1458 1454 rrq->flags = IW_RETRY_LIFETIME; 1459 - rrq->value = lifetime * 1024; 1455 + rrq->value = le16_to_cpu(lifetime) * 1024; 1460 1456 } else { 1461 1457 if (local->manual_retry_count >= 0) { 1462 1458 rrq->flags = IW_RETRY_LIMIT; ··· 1464 1468 rrq->value = local->manual_retry_count; 1465 1469 } else if ((rrq->flags & IW_RETRY_LONG)) { 1466 1470 rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; 1467 - rrq->value = longretry; 1471 + rrq->value = le16_to_cpu(longretry); 1468 1472 } else { 1469 1473 rrq->flags = IW_RETRY_LIMIT; 1470 - rrq->value = shortretry; 1474 + rrq->value = le16_to_cpu(shortretry); 1471 1475 if (shortretry != longretry) 1472 1476 rrq->flags |= IW_RETRY_SHORT; 1473 1477 } ··· 3097 3101 if (buf == NULL) 3098 3102 return -ENOMEM; 3099 3103 3100 - *((u16 *) buf) = cpu_to_le16(len); 3104 + *((__le16 *) buf) = cpu_to_le16(len); 3101 3105 memcpy(buf + 2, elem, len); 3102 3106 3103 3107 kfree(local->generic_elem); ··· 3757 3761 struct hostap_interface *iface = netdev_priv(dev); 3758 3762 local_info_t *local = iface->local; 3759 3763 struct iw_mlme *mlme = (struct iw_mlme *) extra; 3760 - u16 reason; 3764 + __le16 reason; 3761 3765 3762 3766 reason = cpu_to_le16(mlme->reason_code); 3763 3767 ··· 3779 3783 static int prism2_ioctl_mlme(local_info_t *local, 3780 3784 struct prism2_hostapd_param *param) 3781 3785 { 3782 - u16 reason; 3786 + __le16 reason; 3783 3787 3784 3788 reason = cpu_to_le16(param->u.mlme.reason_code); 3785 3789 switch (param->u.mlme.cmd) {
+3 -3
drivers/net/wireless/hostap/hostap_main.c
··· 296 296 int hostap_set_word(struct net_device *dev, int rid, u16 val) 297 297 { 298 298 struct hostap_interface *iface; 299 - u16 tmp = cpu_to_le16(val); 299 + __le16 tmp = cpu_to_le16(val); 300 300 iface = netdev_priv(dev); 301 301 return iface->local->func->set_rid(dev, rid, &tmp, 2); 302 302 } ··· 1095 1095 { 1096 1096 union iwreq_data wrqu; 1097 1097 int ret; 1098 + __le16 val = cpu_to_le16(reason); 1098 1099 1099 1100 if (local->iw_mode != IW_MODE_INFRA || 1100 1101 memcmp(local->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0 || 1101 1102 memcmp(local->bssid, "\x44\x44\x44\x44\x44\x44", ETH_ALEN) == 0) 1102 1103 return 0; 1103 1104 1104 - reason = cpu_to_le16(reason); 1105 1105 ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH, 1106 - (u8 *) &reason, 2); 1106 + (u8 *) &val, 2); 1107 1107 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); 1108 1108 wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); 1109 1109 return ret;
+8 -8
drivers/net/wireless/hostap/hostap_pci.c
··· 128 128 #define HFA384X_INB(a) hfa384x_inb_debug(dev, (a)) 129 129 #define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v)) 130 130 #define HFA384X_INW(a) hfa384x_inw_debug(dev, (a)) 131 - #define HFA384X_OUTW_DATA(v,a) hfa384x_outw_debug(dev, (a), cpu_to_le16((v))) 132 - #define HFA384X_INW_DATA(a) (u16) le16_to_cpu(hfa384x_inw_debug(dev, (a))) 131 + #define HFA384X_OUTW_DATA(v,a) hfa384x_outw_debug(dev, (a), le16_to_cpu((v))) 132 + #define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw_debug(dev, (a))) 133 133 134 134 #else /* PRISM2_IO_DEBUG */ 135 135 ··· 173 173 #define HFA384X_INB(a) hfa384x_inb(dev, (a)) 174 174 #define HFA384X_OUTW(v,a) hfa384x_outw(dev, (a), (v)) 175 175 #define HFA384X_INW(a) hfa384x_inw(dev, (a)) 176 - #define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), cpu_to_le16((v))) 177 - #define HFA384X_INW_DATA(a) (u16) le16_to_cpu(hfa384x_inw(dev, (a))) 176 + #define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), le16_to_cpu((v))) 177 + #define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw(dev, (a))) 178 178 179 179 #endif /* PRISM2_IO_DEBUG */ 180 180 ··· 183 183 int len) 184 184 { 185 185 u16 d_off; 186 - u16 *pos; 186 + __le16 *pos; 187 187 188 188 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; 189 - pos = (u16 *) buf; 189 + pos = (__le16 *) buf; 190 190 191 191 for ( ; len > 1; len -= 2) 192 192 *pos++ = HFA384X_INW_DATA(d_off); ··· 201 201 static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len) 202 202 { 203 203 u16 d_off; 204 - u16 *pos; 204 + __le16 *pos; 205 205 206 206 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; 207 - pos = (u16 *) buf; 207 + pos = (__le16 *) buf; 208 208 209 209 for ( ; len > 1; len -= 2) 210 210 HFA384X_OUTW_DATA(*pos++, d_off);
+101 -101
drivers/net/wireless/hostap/hostap_wlan.h
··· 39 39 } __attribute__ ((packed)); 40 40 41 41 struct linux_wlan_ng_cap_hdr { 42 - u32 version; 43 - u32 length; 44 - u64 mactime; 45 - u64 hosttime; 46 - u32 phytype; 47 - u32 channel; 48 - u32 datarate; 49 - u32 antenna; 50 - u32 priority; 51 - u32 ssi_type; 52 - s32 ssi_signal; 53 - s32 ssi_noise; 54 - u32 preamble; 55 - u32 encoding; 42 + __be32 version; 43 + __be32 length; 44 + __be64 mactime; 45 + __be64 hosttime; 46 + __be32 phytype; 47 + __be32 channel; 48 + __be32 datarate; 49 + __be32 antenna; 50 + __be32 priority; 51 + __be32 ssi_type; 52 + __be32 ssi_signal; 53 + __be32 ssi_noise; 54 + __be32 preamble; 55 + __be32 encoding; 56 56 } __attribute__ ((packed)); 57 57 58 58 #define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ ··· 60 60 61 61 struct hfa384x_rx_frame { 62 62 /* HFA384X RX frame descriptor */ 63 - u16 status; /* HFA384X_RX_STATUS_ flags */ 64 - u32 time; /* timestamp, 1 microsecond resolution */ 63 + __le16 status; /* HFA384X_RX_STATUS_ flags */ 64 + __le32 time; /* timestamp, 1 microsecond resolution */ 65 65 u8 silence; /* 27 .. 154; seems to be 0 */ 66 66 u8 signal; /* 27 .. 154 */ 67 67 u8 rate; /* 10, 20, 55, or 110 */ 68 68 u8 rxflow; 69 - u32 reserved; 69 + __le32 reserved; 70 70 71 71 /* 802.11 */ 72 - u16 frame_control; 73 - u16 duration_id; 72 + __le16 frame_control; 73 + __le16 duration_id; 74 74 u8 addr1[6]; 75 75 u8 addr2[6]; 76 76 u8 addr3[6]; 77 - u16 seq_ctrl; 77 + __le16 seq_ctrl; 78 78 u8 addr4[6]; 79 - u16 data_len; 79 + __le16 data_len; 80 80 81 81 /* 802.3 */ 82 82 u8 dst_addr[6]; 83 83 u8 src_addr[6]; 84 - u16 len; 84 + __be16 len; 85 85 86 86 /* followed by frame data; max 2304 bytes */ 87 87 } __attribute__ ((packed)); ··· 89 89 90 90 struct hfa384x_tx_frame { 91 91 /* HFA384X TX frame descriptor */ 92 - u16 status; /* HFA384X_TX_STATUS_ flags */ 93 - u16 reserved1; 94 - u16 reserved2; 95 - u32 sw_support; 92 + __le16 status; /* HFA384X_TX_STATUS_ flags */ 93 + __le16 reserved1; 94 + __le16 reserved2; 95 + __le32 sw_support; 96 96 u8 retry_count; /* not yet implemented */ 97 97 u8 tx_rate; /* Host AP only; 0 = firmware, or 10, 20, 55, 110 */ 98 - u16 tx_control; /* HFA384X_TX_CTRL_ flags */ 98 + __le16 tx_control; /* HFA384X_TX_CTRL_ flags */ 99 99 100 100 /* 802.11 */ 101 - u16 frame_control; /* parts not used */ 102 - u16 duration_id; 101 + __le16 frame_control; /* parts not used */ 102 + __le16 duration_id; 103 103 u8 addr1[6]; 104 104 u8 addr2[6]; /* filled by firmware */ 105 105 u8 addr3[6]; 106 - u16 seq_ctrl; /* filled by firmware */ 106 + __le16 seq_ctrl; /* filled by firmware */ 107 107 u8 addr4[6]; 108 - u16 data_len; 108 + __le16 data_len; 109 109 110 110 /* 802.3 */ 111 111 u8 dst_addr[6]; 112 112 u8 src_addr[6]; 113 - u16 len; 113 + __be16 len; 114 114 115 115 /* followed by frame data; max 2304 bytes */ 116 116 } __attribute__ ((packed)); ··· 118 118 119 119 struct hfa384x_rid_hdr 120 120 { 121 - u16 len; 122 - u16 rid; 121 + __le16 len; 122 + __le16 rid; 123 123 } __attribute__ ((packed)); 124 124 125 125 ··· 130 130 #define HFA384X_LEVEL_TO_dBm_sign(v) (v) * 100 / 255 - 100 131 131 132 132 struct hfa384x_scan_request { 133 - u16 channel_list; 134 - u16 txrate; /* HFA384X_RATES_* */ 133 + __le16 channel_list; 134 + __le16 txrate; /* HFA384X_RATES_* */ 135 135 } __attribute__ ((packed)); 136 136 137 137 struct hfa384x_hostscan_request { 138 - u16 channel_list; 139 - u16 txrate; 140 - u16 target_ssid_len; 138 + __le16 channel_list; 139 + __le16 txrate; 140 + __le16 target_ssid_len; 141 141 u8 target_ssid[32]; 142 142 } __attribute__ ((packed)); 143 143 144 144 struct hfa384x_join_request { 145 145 u8 bssid[6]; 146 - u16 channel; 146 + __le16 channel; 147 147 } __attribute__ ((packed)); 148 148 149 149 struct hfa384x_info_frame { 150 - u16 len; 151 - u16 type; 150 + __le16 len; 151 + __le16 type; 152 152 } __attribute__ ((packed)); 153 153 154 154 struct hfa384x_comm_tallies { 155 - u16 tx_unicast_frames; 156 - u16 tx_multicast_frames; 157 - u16 tx_fragments; 158 - u16 tx_unicast_octets; 159 - u16 tx_multicast_octets; 160 - u16 tx_deferred_transmissions; 161 - u16 tx_single_retry_frames; 162 - u16 tx_multiple_retry_frames; 163 - u16 tx_retry_limit_exceeded; 164 - u16 tx_discards; 165 - u16 rx_unicast_frames; 166 - u16 rx_multicast_frames; 167 - u16 rx_fragments; 168 - u16 rx_unicast_octets; 169 - u16 rx_multicast_octets; 170 - u16 rx_fcs_errors; 171 - u16 rx_discards_no_buffer; 172 - u16 tx_discards_wrong_sa; 173 - u16 rx_discards_wep_undecryptable; 174 - u16 rx_message_in_msg_fragments; 175 - u16 rx_message_in_bad_msg_fragments; 155 + __le16 tx_unicast_frames; 156 + __le16 tx_multicast_frames; 157 + __le16 tx_fragments; 158 + __le16 tx_unicast_octets; 159 + __le16 tx_multicast_octets; 160 + __le16 tx_deferred_transmissions; 161 + __le16 tx_single_retry_frames; 162 + __le16 tx_multiple_retry_frames; 163 + __le16 tx_retry_limit_exceeded; 164 + __le16 tx_discards; 165 + __le16 rx_unicast_frames; 166 + __le16 rx_multicast_frames; 167 + __le16 rx_fragments; 168 + __le16 rx_unicast_octets; 169 + __le16 rx_multicast_octets; 170 + __le16 rx_fcs_errors; 171 + __le16 rx_discards_no_buffer; 172 + __le16 tx_discards_wrong_sa; 173 + __le16 rx_discards_wep_undecryptable; 174 + __le16 rx_message_in_msg_fragments; 175 + __le16 rx_message_in_bad_msg_fragments; 176 176 } __attribute__ ((packed)); 177 177 178 178 struct hfa384x_comm_tallies32 { 179 - u32 tx_unicast_frames; 180 - u32 tx_multicast_frames; 181 - u32 tx_fragments; 182 - u32 tx_unicast_octets; 183 - u32 tx_multicast_octets; 184 - u32 tx_deferred_transmissions; 185 - u32 tx_single_retry_frames; 186 - u32 tx_multiple_retry_frames; 187 - u32 tx_retry_limit_exceeded; 188 - u32 tx_discards; 189 - u32 rx_unicast_frames; 190 - u32 rx_multicast_frames; 191 - u32 rx_fragments; 192 - u32 rx_unicast_octets; 193 - u32 rx_multicast_octets; 194 - u32 rx_fcs_errors; 195 - u32 rx_discards_no_buffer; 196 - u32 tx_discards_wrong_sa; 197 - u32 rx_discards_wep_undecryptable; 198 - u32 rx_message_in_msg_fragments; 199 - u32 rx_message_in_bad_msg_fragments; 179 + __le32 tx_unicast_frames; 180 + __le32 tx_multicast_frames; 181 + __le32 tx_fragments; 182 + __le32 tx_unicast_octets; 183 + __le32 tx_multicast_octets; 184 + __le32 tx_deferred_transmissions; 185 + __le32 tx_single_retry_frames; 186 + __le32 tx_multiple_retry_frames; 187 + __le32 tx_retry_limit_exceeded; 188 + __le32 tx_discards; 189 + __le32 rx_unicast_frames; 190 + __le32 rx_multicast_frames; 191 + __le32 rx_fragments; 192 + __le32 rx_unicast_octets; 193 + __le32 rx_multicast_octets; 194 + __le32 rx_fcs_errors; 195 + __le32 rx_discards_no_buffer; 196 + __le32 tx_discards_wrong_sa; 197 + __le32 rx_discards_wep_undecryptable; 198 + __le32 rx_message_in_msg_fragments; 199 + __le32 rx_message_in_bad_msg_fragments; 200 200 } __attribute__ ((packed)); 201 201 202 202 struct hfa384x_scan_result_hdr { 203 - u16 reserved; 204 - u16 scan_reason; 203 + __le16 reserved; 204 + __le16 scan_reason; 205 205 #define HFA384X_SCAN_IN_PROGRESS 0 /* no results available yet */ 206 206 #define HFA384X_SCAN_HOST_INITIATED 1 207 207 #define HFA384X_SCAN_FIRMWARE_INITIATED 2 ··· 211 211 #define HFA384X_SCAN_MAX_RESULTS 32 212 212 213 213 struct hfa384x_scan_result { 214 - u16 chid; 215 - u16 anl; 216 - u16 sl; 214 + __le16 chid; 215 + __le16 anl; 216 + __le16 sl; 217 217 u8 bssid[6]; 218 - u16 beacon_interval; 219 - u16 capability; 220 - u16 ssid_len; 218 + __le16 beacon_interval; 219 + __le16 capability; 220 + __le16 ssid_len; 221 221 u8 ssid[32]; 222 222 u8 sup_rates[10]; 223 - u16 rate; 223 + __le16 rate; 224 224 } __attribute__ ((packed)); 225 225 226 226 struct hfa384x_hostscan_result { 227 - u16 chid; 228 - u16 anl; 229 - u16 sl; 227 + __le16 chid; 228 + __le16 anl; 229 + __le16 sl; 230 230 u8 bssid[6]; 231 - u16 beacon_interval; 232 - u16 capability; 233 - u16 ssid_len; 231 + __le16 beacon_interval; 232 + __le16 capability; 233 + __le16 ssid_len; 234 234 u8 ssid[32]; 235 235 u8 sup_rates[10]; 236 - u16 rate; 237 - u16 atim; 236 + __le16 rate; 237 + __le16 atim; 238 238 } __attribute__ ((packed)); 239 239 240 240 struct comm_tallies_sums {