Staging: wlan-ng: Use generic byteorder macros

This patch removes the ieee2host16(), ieee2host32(), host2ieee16()
and host2ieee32() macros and replaces them with the generic ones.

Signed-off-by: Moritz Muehlenhoff <jmm@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Moritz Muehlenhoff 2009-01-21 22:00:45 +01:00 committed by Greg Kroah-Hartman
parent 8a251b55ef
commit ae26230bf9
5 changed files with 14 additions and 19 deletions

View File

@ -130,6 +130,7 @@
#include <asm/bitops.h> #include <asm/bitops.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/byteorder/generic.h>
#include "wlan_compat.h" #include "wlan_compat.h"
@ -3817,7 +3818,7 @@ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb)
switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) ) switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) )
{ {
case 0: case 0:
fc = ieee2host16(usbin->rxfrm.desc.frame_control); fc = le16_to_cpu(usbin->rxfrm.desc.frame_control);
/* If exclude and we receive an unencrypted, drop it */ /* If exclude and we receive an unencrypted, drop it */
if ( (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) && if ( (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) &&
@ -3918,7 +3919,7 @@ static void hfa384x_int_rxmonitor( wlandevice_t *wlandev, hfa384x_usb_rxfrm_t *r
/* Don't forget the status, time, and data_len fields are in host order */ /* Don't forget the status, time, and data_len fields are in host order */
/* Figure out how big the frame is */ /* Figure out how big the frame is */
fc = ieee2host16(rxdesc->frame_control); fc = le16_to_cpu(rxdesc->frame_control);
hdrlen = p80211_headerlen(fc); hdrlen = p80211_headerlen(fc);
datalen = hfa384x2host_16(rxdesc->data_len); datalen = hfa384x2host_16(rxdesc->data_len);

View File

@ -63,6 +63,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/byteorder/generic.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
@ -192,7 +193,7 @@ int skb_ether_to_p80211( wlandevice_t *wlandev, u32 ethconv, struct sk_buff *skb
/* Set up the 802.11 header */ /* Set up the 802.11 header */
/* It's a data frame */ /* It's a data frame */
fc = host2ieee16( WLAN_SET_FC_FTYPE(WLAN_FTYPE_DATA) | fc = cpu_to_le16( WLAN_SET_FC_FTYPE(WLAN_FTYPE_DATA) |
WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DATAONLY)); WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DATAONLY));
switch ( wlandev->macmode ) { switch ( wlandev->macmode ) {
@ -202,13 +203,13 @@ int skb_ether_to_p80211( wlandevice_t *wlandev, u32 ethconv, struct sk_buff *skb
memcpy(p80211_hdr->a3.a3, wlandev->bssid, ETH_ALEN); memcpy(p80211_hdr->a3.a3, wlandev->bssid, ETH_ALEN);
break; break;
case WLAN_MACMODE_ESS_STA: case WLAN_MACMODE_ESS_STA:
fc |= host2ieee16(WLAN_SET_FC_TODS(1)); fc |= cpu_to_le16(WLAN_SET_FC_TODS(1));
memcpy(p80211_hdr->a3.a1, wlandev->bssid, ETH_ALEN); memcpy(p80211_hdr->a3.a1, wlandev->bssid, ETH_ALEN);
memcpy(p80211_hdr->a3.a2, wlandev->netdev->dev_addr, ETH_ALEN); memcpy(p80211_hdr->a3.a2, wlandev->netdev->dev_addr, ETH_ALEN);
memcpy(p80211_hdr->a3.a3, &e_hdr.daddr, ETH_ALEN); memcpy(p80211_hdr->a3.a3, &e_hdr.daddr, ETH_ALEN);
break; break;
case WLAN_MACMODE_ESS_AP: case WLAN_MACMODE_ESS_AP:
fc |= host2ieee16(WLAN_SET_FC_FROMDS(1)); fc |= cpu_to_le16(WLAN_SET_FC_FROMDS(1));
memcpy(p80211_hdr->a3.a1, &e_hdr.daddr, ETH_ALEN); memcpy(p80211_hdr->a3.a1, &e_hdr.daddr, ETH_ALEN);
memcpy(p80211_hdr->a3.a2, wlandev->bssid, ETH_ALEN); memcpy(p80211_hdr->a3.a2, wlandev->bssid, ETH_ALEN);
memcpy(p80211_hdr->a3.a3, &e_hdr.saddr, ETH_ALEN); memcpy(p80211_hdr->a3.a3, &e_hdr.saddr, ETH_ALEN);
@ -237,7 +238,7 @@ int skb_ether_to_p80211( wlandevice_t *wlandev, u32 ethconv, struct sk_buff *skb
WLAN_LOG_WARNING("Host en-WEP failed, dropping frame (%d).\n", foo); WLAN_LOG_WARNING("Host en-WEP failed, dropping frame (%d).\n", foo);
return 2; return 2;
} }
fc |= host2ieee16(WLAN_SET_FC_ISWEP(1)); fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
} }
@ -312,7 +313,7 @@ int skb_p80211_to_ether( wlandevice_t *wlandev, u32 ethconv, struct sk_buff *skb
w_hdr = (p80211_hdr_t *) skb->data; w_hdr = (p80211_hdr_t *) skb->data;
/* setup some vars for convenience */ /* setup some vars for convenience */
fc = ieee2host16(w_hdr->a3.fc); fc = le16_to_cpu(w_hdr->a3.fc);
if ( (WLAN_GET_FC_TODS(fc) == 0) && (WLAN_GET_FC_FROMDS(fc) == 0) ) { if ( (WLAN_GET_FC_TODS(fc) == 0) && (WLAN_GET_FC_FROMDS(fc) == 0) ) {
memcpy(daddr, w_hdr->a3.a1, WLAN_ETHADDR_LEN); memcpy(daddr, w_hdr->a3.a1, WLAN_ETHADDR_LEN);
memcpy(saddr, w_hdr->a3.a2, WLAN_ETHADDR_LEN); memcpy(saddr, w_hdr->a3.a2, WLAN_ETHADDR_LEN);
@ -392,7 +393,7 @@ int skb_p80211_to_ether( wlandevice_t *wlandev, u32 ethconv, struct sk_buff *skb
(e_llc->ctl == 0x03) && (e_llc->ctl == 0x03) &&
(((memcmp( e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN)==0) && (((memcmp( e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN)==0) &&
(ethconv == WLAN_ETHCONV_8021h) && (ethconv == WLAN_ETHCONV_8021h) &&
(p80211_stt_findproto(ieee2host16(e_snap->type)))) || (p80211_stt_findproto(le16_to_cpu(e_snap->type)))) ||
(memcmp( e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN)!=0))) (memcmp( e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN)!=0)))
{ {
WLAN_LOG_DEBUG(3, "SNAP+RFC1042 len: %d\n", payload_length); WLAN_LOG_DEBUG(3, "SNAP+RFC1042 len: %d\n", payload_length);

View File

@ -71,6 +71,7 @@
#include <linux/sockios.h> #include <linux/sockios.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/byteorder/generic.h>
#include <asm/bitops.h> #include <asm/bitops.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
@ -324,7 +325,7 @@ static void p80211netdev_rx_bh(unsigned long arg)
continue; continue;
} else { } else {
hdr = (p80211_hdr_a3_t *)skb->data; hdr = (p80211_hdr_a3_t *)skb->data;
fc = ieee2host16(hdr->fc); fc = le16_to_cpu(hdr->fc);
if (p80211_rx_typedrop(wlandev, fc)) { if (p80211_rx_typedrop(wlandev, fc)) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
continue; continue;

View File

@ -65,6 +65,7 @@
#include <linux/wireless.h> #include <linux/wireless.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/byteorder/generic.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -316,7 +317,7 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
/* If necessary, set the 802.11 WEP bit */ /* If necessary, set the 802.11 WEP bit */
if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) { if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1)); p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
} }
result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep); result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep);

View File

@ -124,15 +124,6 @@ typedef struct net_device netdevice_t;
#define URB_ASYNC_UNLINK 0 #define URB_ASYNC_UNLINK 0
#define USB_QUEUE_BULK 0 #define USB_QUEUE_BULK 0
/*=============================================================*/
/*------ Hardware Portability Macros --------------------------*/
/*=============================================================*/
#define ieee2host16(n) __le16_to_cpu(n)
#define ieee2host32(n) __le32_to_cpu(n)
#define host2ieee16(n) __cpu_to_le16(n)
#define host2ieee32(n) __cpu_to_le32(n)
/*=============================================================*/ /*=============================================================*/
/*--- General Macros ------------------------------------------*/ /*--- General Macros ------------------------------------------*/
/*=============================================================*/ /*=============================================================*/