From jmm@debian.org Wed Jan 21 16:33:10 2009 From: Moritz Muehlenhoff Date: Wed, 21 Jan 2009 22:00:45 +0100 Subject: Staging: wlan-ng: Use generic byteorder macros To: greg@kroah.com Cc: Moritz Muehlenhoff Message-ID: <1232571646-32579-6-git-send-email-jmm@debian.org> This patch removes the ieee2host16(), ieee2host32(), host2ieee16() and host2ieee32() macros and replaces them with the generic ones. Signed-off-by: Moritz Muehlenhoff Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x_usb.c | 5 +++-- drivers/staging/wlan-ng/p80211conv.c | 13 +++++++------ drivers/staging/wlan-ng/p80211netdev.c | 3 ++- drivers/staging/wlan-ng/prism2sta.c | 3 ++- drivers/staging/wlan-ng/wlan_compat.h | 9 --------- 5 files changed, 14 insertions(+), 19 deletions(-) --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -130,6 +130,7 @@ #include #include #include +#include #include "wlan_compat.h" @@ -3817,7 +3818,7 @@ static void hfa384x_usbin_rx(wlandevice_ switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) ) { 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 ( (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) && @@ -3918,7 +3919,7 @@ static void hfa384x_int_rxmonitor( wland /* Don't forget the status, time, and data_len fields are in host order */ /* Figure out how big the frame is */ - fc = ieee2host16(rxdesc->frame_control); + fc = le16_to_cpu(rxdesc->frame_control); hdrlen = p80211_headerlen(fc); datalen = hfa384x2host_16(rxdesc->data_len); --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -63,6 +63,7 @@ #include #include #include +#include #include @@ -192,7 +193,7 @@ int skb_ether_to_p80211( wlandevice_t *w /* Set up the 802.11 header */ /* 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)); switch ( wlandev->macmode ) { @@ -202,13 +203,13 @@ int skb_ether_to_p80211( wlandevice_t *w memcpy(p80211_hdr->a3.a3, wlandev->bssid, ETH_ALEN); break; 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.a2, wlandev->netdev->dev_addr, ETH_ALEN); memcpy(p80211_hdr->a3.a3, &e_hdr.daddr, ETH_ALEN); break; 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.a2, wlandev->bssid, ETH_ALEN); memcpy(p80211_hdr->a3.a3, &e_hdr.saddr, ETH_ALEN); @@ -237,7 +238,7 @@ int skb_ether_to_p80211( wlandevice_t *w WLAN_LOG_WARNING("Host en-WEP failed, dropping frame (%d).\n", foo); 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 *w w_hdr = (p80211_hdr_t *) skb->data; /* 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) ) { memcpy(daddr, w_hdr->a3.a1, WLAN_ETHADDR_LEN); memcpy(saddr, w_hdr->a3.a2, WLAN_ETHADDR_LEN); @@ -392,7 +393,7 @@ int skb_p80211_to_ether( wlandevice_t *w (e_llc->ctl == 0x03) && (((memcmp( e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN)==0) && (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))) { WLAN_LOG_DEBUG(3, "SNAP+RFC1042 len: %d\n", payload_length); --- a/drivers/staging/wlan-ng/p80211netdev.c +++ b/drivers/staging/wlan-ng/p80211netdev.c @@ -71,6 +71,7 @@ #include #include #include +#include #include #include @@ -324,7 +325,7 @@ static void p80211netdev_rx_bh(unsigned continue; } else { hdr = (p80211_hdr_a3_t *)skb->data; - fc = ieee2host16(hdr->fc); + fc = le16_to_cpu(hdr->fc); if (p80211_rx_typedrop(wlandev, fc)) { dev_kfree_skb(skb); continue; --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -65,6 +65,7 @@ #include #include #include +#include #include #include @@ -316,7 +317,7 @@ static int prism2sta_txframe(wlandevice_ /* If necessary, set the 802.11 WEP bit */ 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); --- a/drivers/staging/wlan-ng/wlan_compat.h +++ b/drivers/staging/wlan-ng/wlan_compat.h @@ -125,15 +125,6 @@ typedef struct net_device netdevice_t; #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 ------------------------------------------*/ /*=============================================================*/