From ae26230bf93d37de73febdd1990090dcbd489b38 Mon Sep 17 00:00:00 2001 From: Moritz Muehlenhoff Date: Wed, 21 Jan 2009 22:00:45 +0100 Subject: [PATCH] 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 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(-) diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index a2dddae66c9..cea033411e4 100644 --- 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_t *wlandev, struct sk_buff *skb) 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( wlandevice_t *wlandev, hfa384x_usb_rxfrm_t *r /* 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); diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 53b17c3b1ed..c3719249f01 100644 --- 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 *wlandev, u32 ethconv, struct sk_buff *skb /* 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 *wlandev, u32 ethconv, struct sk_buff *skb 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 *wlandev, u32 ethconv, struct sk_buff *skb 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 *wlandev, u32 ethconv, struct sk_buff *skb 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 *wlandev, u32 ethconv, struct sk_buff *skb (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); diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c index 1ebba6a06aa..7be8efaf7c6 100644 --- 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 long arg) 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; diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 7a0b960f2c5..45d4455f11d 100644 --- 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_t *wlandev, struct sk_buff *skb, /* 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); diff --git a/drivers/staging/wlan-ng/wlan_compat.h b/drivers/staging/wlan-ng/wlan_compat.h index 0c852359b0c..cd7bcae689d 100644 --- a/drivers/staging/wlan-ng/wlan_compat.h +++ b/drivers/staging/wlan-ng/wlan_compat.h @@ -124,15 +124,6 @@ typedef struct net_device netdevice_t; #define URB_ASYNC_UNLINK 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 ------------------------------------------*/ /*=============================================================*/ -- 2.32.0.93.g670b81a890