Commit 18c7f792 authored by Moritz Muehlenhoff's avatar Moritz Muehlenhoff Committed by Greg Kroah-Hartman

Staging: wlan-ng: Replace local byteorder macros

Replace hfa384x2host_16(), hfa384x2host_32(), host2hfa384x_16()
and host2hfa384x_32() with standard byteorder macros.
Signed-off-by: default avatarMoritz Muehlenhoff <jmm@debian.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 465e7417
...@@ -328,14 +328,6 @@ PD Record codes ...@@ -328,14 +328,6 @@ PD Record codes
#define HFA384x_STATUS_RESULT_SET(value) (((u16)(value)) << 8) #define HFA384x_STATUS_RESULT_SET(value) (((u16)(value)) << 8)
/* Byte Order */
#ifdef __KERNEL__
#define hfa384x2host_16(n) (__le16_to_cpu((u16)(n)))
#define hfa384x2host_32(n) (__le32_to_cpu((u32)(n)))
#define host2hfa384x_16(n) (__cpu_to_le16((u16)(n)))
#define host2hfa384x_32(n) (__cpu_to_le32((u32)(n)))
#endif
/* Host Maintained State Info */ /* Host Maintained State Info */
#define HFA384x_STATE_PREINIT 0 #define HFA384x_STATE_PREINIT 0
#define HFA384x_STATE_INIT 1 #define HFA384x_STATE_INIT 1
...@@ -1143,13 +1135,13 @@ static inline int hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val) ...@@ -1143,13 +1135,13 @@ static inline int hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val)
int result = 0; int result = 0;
result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16)); result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
if (result == 0) if (result == 0)
*((u16 *) val) = hfa384x2host_16(*((u16 *) val)); *((u16 *) val) = le16_to_cpu(*((u16 *) val));
return result; return result;
} }
static inline int hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val) static inline int hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val)
{ {
u16 value = host2hfa384x_16(val); u16 value = cpu_to_le16(val);
return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value)); return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
} }
...@@ -1166,7 +1158,7 @@ hfa384x_drvr_setconfig_async(hfa384x_t *hw, ...@@ -1166,7 +1158,7 @@ hfa384x_drvr_setconfig_async(hfa384x_t *hw,
static inline int static inline int
hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val) hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val)
{ {
u16 value = host2hfa384x_16(val); u16 value = cpu_to_le16(val);
return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
NULL, NULL); NULL, NULL);
} }
......
This diff is collapsed.
...@@ -172,7 +172,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) ...@@ -172,7 +172,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp)
hw->ident_sta_fw.variant) > hw->ident_sta_fw.variant) >
HFA384x_FIRMWARE_VERSION(1, 5, 0)) { HFA384x_FIRMWARE_VERSION(1, 5, 0)) {
if (msg->scantype.data != P80211ENUM_scantype_active) if (msg->scantype.data != P80211ENUM_scantype_active)
word = host2hfa384x_16(msg->maxchanneltime.data); word = cpu_to_le16(msg->maxchanneltime.data);
else else
word = 0; word = 0;
...@@ -187,7 +187,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) ...@@ -187,7 +187,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp)
/* set up the txrate to be 2MBPS. Should be fastest basicrate... */ /* set up the txrate to be 2MBPS. Should be fastest basicrate... */
word = HFA384x_RATEBIT_2; word = HFA384x_RATEBIT_2;
scanreq.txRate = host2hfa384x_16(word); scanreq.txRate = cpu_to_le16(word);
/* set up the channel list */ /* set up the channel list */
word = 0; word = 0;
...@@ -198,10 +198,10 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) ...@@ -198,10 +198,10 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp)
/* channel 1 is BIT 0 ... channel 14 is BIT 13 */ /* channel 1 is BIT 0 ... channel 14 is BIT 13 */
word |= (1 << (channel - 1)); word |= (1 << (channel - 1));
} }
scanreq.channelList = host2hfa384x_16(word); scanreq.channelList = cpu_to_le16(word);
/* set up the ssid, if present. */ /* set up the ssid, if present. */
scanreq.ssid.len = host2hfa384x_16(msg->ssid.data.len); scanreq.ssid.len = cpu_to_le16(msg->ssid.data.len);
memcpy(scanreq.ssid.data, msg->ssid.data.data, msg->ssid.data.len); memcpy(scanreq.ssid.data, msg->ssid.data.data, msg->ssid.data.len);
/* Enable the MAC port if it's not already enabled */ /* Enable the MAC port if it's not already enabled */
...@@ -230,7 +230,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) ...@@ -230,7 +230,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp)
/* Construct a bogus SSID and assign it to OwnSSID and /* Construct a bogus SSID and assign it to OwnSSID and
* DesiredSSID * DesiredSSID
*/ */
wordbuf[0] = host2hfa384x_16(WLAN_SSID_MAXLEN); wordbuf[0] = cpu_to_le16(WLAN_SSID_MAXLEN);
get_random_bytes(&wordbuf[1], WLAN_SSID_MAXLEN); get_random_bytes(&wordbuf[1], WLAN_SSID_MAXLEN);
result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFOWNSSID, result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFOWNSSID,
wordbuf, wordbuf,
...@@ -399,8 +399,8 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) ...@@ -399,8 +399,8 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
/* signal and noise */ /* signal and noise */
req->signal.status = P80211ENUM_msgitem_status_data_ok; req->signal.status = P80211ENUM_msgitem_status_data_ok;
req->noise.status = P80211ENUM_msgitem_status_data_ok; req->noise.status = P80211ENUM_msgitem_status_data_ok;
req->signal.data = hfa384x2host_16(item->sl); req->signal.data = le16_to_cpu(item->sl);
req->noise.data = hfa384x2host_16(item->anl); req->noise.data = le16_to_cpu(item->anl);
/* BSSID */ /* BSSID */
req->bssid.status = P80211ENUM_msgitem_status_data_ok; req->bssid.status = P80211ENUM_msgitem_status_data_ok;
...@@ -409,7 +409,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) ...@@ -409,7 +409,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
/* SSID */ /* SSID */
req->ssid.status = P80211ENUM_msgitem_status_data_ok; req->ssid.status = P80211ENUM_msgitem_status_data_ok;
req->ssid.data.len = hfa384x2host_16(item->ssid.len); req->ssid.data.len = le16_to_cpu(item->ssid.len);
memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len); memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len);
/* supported rates */ /* supported rates */
...@@ -449,7 +449,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) ...@@ -449,7 +449,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
/* beacon period */ /* beacon period */
req->beaconperiod.status = P80211ENUM_msgitem_status_data_ok; req->beaconperiod.status = P80211ENUM_msgitem_status_data_ok;
req->beaconperiod.data = hfa384x2host_16(item->bcnint); req->beaconperiod.data = le16_to_cpu(item->bcnint);
/* timestamps */ /* timestamps */
req->timestamp.status = P80211ENUM_msgitem_status_data_ok; req->timestamp.status = P80211ENUM_msgitem_status_data_ok;
...@@ -459,14 +459,14 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) ...@@ -459,14 +459,14 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
/* atim window */ /* atim window */
req->ibssatimwindow.status = P80211ENUM_msgitem_status_data_ok; req->ibssatimwindow.status = P80211ENUM_msgitem_status_data_ok;
req->ibssatimwindow.data = hfa384x2host_16(item->atim); req->ibssatimwindow.data = le16_to_cpu(item->atim);
/* Channel */ /* Channel */
req->dschannel.status = P80211ENUM_msgitem_status_data_ok; req->dschannel.status = P80211ENUM_msgitem_status_data_ok;
req->dschannel.data = hfa384x2host_16(item->chid); req->dschannel.data = le16_to_cpu(item->chid);
/* capinfo bits */ /* capinfo bits */
count = hfa384x2host_16(item->capinfo); count = le16_to_cpu(item->capinfo);
/* privacy flag */ /* privacy flag */
req->privacy.status = P80211ENUM_msgitem_status_data_ok; req->privacy.status = P80211ENUM_msgitem_status_data_ok;
......
...@@ -730,10 +730,10 @@ static int prism2mib_priv(mibrec_t *mib, ...@@ -730,10 +730,10 @@ static int prism2mib_priv(mibrec_t *mib,
HFA384x_RID_CNFWPADATA, HFA384x_RID_CNFWPADATA,
(u8 *)&wpa, (u8 *)&wpa,
sizeof(wpa)); sizeof(wpa));
pstr->len = hfa384x2host_16(wpa.datalen); pstr->len = le16_to_cpu(wpa.datalen);
memcpy(pstr->data, wpa.data, pstr->len); memcpy(pstr->data, wpa.data, pstr->len);
} else { } else {
wpa.datalen = host2hfa384x_16(pstr->len); wpa.datalen = cpu_to_le16(pstr->len);
memcpy(wpa.data, pstr->data, pstr->len); memcpy(wpa.data, pstr->data, pstr->len);
result = result =
...@@ -768,7 +768,7 @@ static int prism2mib_priv(mibrec_t *mib, ...@@ -768,7 +768,7 @@ static int prism2mib_priv(mibrec_t *mib,
void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
{ {
bytestr->len = host2hfa384x_16((u16) (pstr->len)); bytestr->len = cpu_to_le16((u16) (pstr->len));
memcpy(bytestr->data, pstr->data, pstr->len); memcpy(bytestr->data, pstr->data, pstr->len);
} }
...@@ -809,7 +809,7 @@ void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr) ...@@ -809,7 +809,7 @@ void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr)
void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
{ {
pstr->len = (u8) (hfa384x2host_16((u16) (bytestr->len))); pstr->len = (u8) (le16_to_cpu((u16) (bytestr->len)));
memcpy(pstr->data, bytestr->data, pstr->len); memcpy(pstr->data, bytestr->data, pstr->len);
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment