staging: brcm80211: remove the rest of broadcom specific byte swapping routines
authorStanislav Fomichev <kernel@fomichev.me>
Mon, 21 Feb 2011 07:35:26 +0000 (10:35 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Feb 2011 22:07:00 +0000 (14:07 -0800)
- move ltoh16_buf/htol16_buf util/bcmsrom.c
- replace ltoh16_buf in brcmsmac/wlc_mac80211.c with several
  le16_to_cpu's

Signed-off-by: Stanislav Fomichev <kernel@fomichev.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
23 files changed:
drivers/staging/brcm80211/brcmfmac/bcmsdh.c
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
drivers/staging/brcm80211/brcmfmac/dhd_common.c
drivers/staging/brcm80211/brcmfmac/dhd_linux.c
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
drivers/staging/brcm80211/brcmfmac/wl_iw.c
drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.c
drivers/staging/brcm80211/brcmsmac/wlc_rate.c
drivers/staging/brcm80211/brcmsmac/wlc_stf.c
drivers/staging/brcm80211/include/bcmendian.h [deleted file]
drivers/staging/brcm80211/util/bcmotp.c
drivers/staging/brcm80211/util/bcmsrom.c
drivers/staging/brcm80211/util/bcmutils.c
drivers/staging/brcm80211/util/hnddma.c
drivers/staging/brcm80211/util/linux_osl.c
drivers/staging/brcm80211/util/nvram/nvram_ro.c

index df9a139213a5219e836f3ec96f1b7e99205797c2..77e65e4297a19c7a80b48839e0a9c3b053fb4241 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/netdevice.h>
 #include <bcmdefs.h>
 #include <bcmdevs.h>
-#include <bcmendian.h>
 #include <osl.h>
 #include <bcmutils.h>
 #include <hndsoc.h>
index 8bf731f693ff0a4495a5fcf7d6b7b6ba9ae79409..4409443c69de8b5188a13bd0c189158e25a3b610 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/netdevice.h>
 #include <bcmdefs.h>
 #include <bcmdevs.h>
-#include <bcmendian.h>
 #include <osl.h>
 #include <bcmutils.h>
 #include <sdio.h>              /* SDIO Device and Protocol Specs */
index 0083f0c3775bb8c39877c21ba34f189635cb63b3..6c0620c9742f158b3d2ddd96dafeaa64f8ac258d 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <bcmutils.h>
 #include <bcmcdc.h>
-#include <bcmendian.h>
 
 #include <dngl_stats.h>
 #include <dhd.h>
index 44dabd186eae2ebeedfdd1b78262a6ac04c68280..784333c42014bf41382e373cc119f50082c63ac5 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/netdevice.h>
 #include <osl.h>
 #include <bcmutils.h>
-#include <bcmendian.h>
 #include <dngl_stats.h>
 #include <dhd.h>
 #include <dhd_bus.h>
index b6e3c0a87006956038727331c84cb2a549ac5e21..3efc17a0a4e01421f98ec2864b82e22ed47e5967 100644 (file)
@@ -34,7 +34,6 @@
 #include <bcmdefs.h>
 #include <osl.h>
 #include <bcmutils.h>
-#include <bcmendian.h>
 
 #include <dngl_stats.h>
 #include <dhd.h>
index 41b76afe7c399488d163dc7bba50c01b507fea4d..097844f8569a6c405a8516476e0afb8297921cf1 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <bcmdefs.h>
 #include <bcmutils.h>
-#include <bcmendian.h>
 #include <bcmdevs.h>
 
 #include <siutils.h>
index fe3379a93798a16b13624dbc8c0c6370ef1181ea..86c18be7d64e8152d855aa2662683272f0050cd9 100644 (file)
@@ -19,7 +19,6 @@
 #include <osl.h>
 
 #include <bcmutils.h>
-#include <bcmendian.h>
 
 #include <asm/uaccess.h>
 
index 0e4b13281611cc466dd73839e580c6a390b8b93b..91d8488075371745199253fba4e961940947e8e2 100644 (file)
@@ -22,7 +22,6 @@
 #include <wlioctl.h>
 
 #include <bcmutils.h>
-#include <bcmendian.h>
 
 #include <linux/if_arp.h>
 #include <asm/uaccess.h>
index d869efa781d4d2eb4d589120444e5990b18dd2bc..2f80da7f0d0f2fbb234ca22d67e5ac6cf2ad163b 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/pci.h>
-#include <bcmendian.h>
 #include <bcmnvram.h>
 #include <sbchipc.h>
 #include <bcmdevs.h>
index 55ce0b8c4fdd457367ee54a187b2184d6c2f935d..23b6086aa74d2efde966612196bb76c189e7b2c0 100644 (file)
@@ -24,7 +24,6 @@
 #include <siutils.h>
 #include <sbchipc.h>
 #include <hndpmu.h>
-#include <bcmendian.h>
 
 #include <bcmdevs.h>
 #include <sbhndpio.h>
index a5a4868ff3fac42d9c080b3e7af50297657d645f..4f9d4dec768ca65458453da30853d3d8313249ef 100644 (file)
@@ -19,7 +19,6 @@
 #include <osl.h>
 #include <bcmutils.h>
 #include <siutils.h>
-#include <bcmendian.h>
 #include <wlioctl.h>
 #include <sbhndpio.h>
 #include <sbhnddma.h>
index 9419f27e7425a8b3e22414cdb6511f839cb1268b..12bfb06b3013d74976e858ee6c80c6a1005c56c5 100644 (file)
@@ -27,7 +27,6 @@
 #include <bcmwifi.h>
 #include <bcmutils.h>
 #include <siutils.h>
-#include <bcmendian.h>
 #include <wlioctl.h>
 #include <sbconfig.h>
 #include <sbchipc.h>
index e7628fa6fcd5c9198ebbbac6bec7d17ce55f522c..05bcda3b3791ec559a5f4d17fb8421b7400282e4 100644 (file)
@@ -24,7 +24,6 @@
 #include <bcmutils.h>
 #include <bcmwifi.h>
 #include <siutils.h>
-#include <bcmendian.h>
 #include <pcicfg.h>
 #include <bcmsrom.h>
 #include <wlioctl.h>
@@ -7066,7 +7065,17 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
        skb_pull(p, wlc->hwrxoff);
 
        /* fixup rx header endianness */
-       ltoh16_buf((void *)rxh, sizeof(d11rxhdr_t));
+       rxh->RxFrameSize = le16_to_cpu(rxh->RxFrameSize);
+       rxh->PhyRxStatus_0 = le16_to_cpu(rxh->PhyRxStatus_0);
+       rxh->PhyRxStatus_1 = le16_to_cpu(rxh->PhyRxStatus_1);
+       rxh->PhyRxStatus_2 = le16_to_cpu(rxh->PhyRxStatus_2);
+       rxh->PhyRxStatus_3 = le16_to_cpu(rxh->PhyRxStatus_3);
+       rxh->PhyRxStatus_4 = le16_to_cpu(rxh->PhyRxStatus_4);
+       rxh->PhyRxStatus_5 = le16_to_cpu(rxh->PhyRxStatus_5);
+       rxh->RxStatus1 = le16_to_cpu(rxh->RxStatus1);
+       rxh->RxStatus2 = le16_to_cpu(rxh->RxStatus2);
+       rxh->RxTSFTime = le16_to_cpu(rxh->RxTSFTime);
+       rxh->RxChan = le16_to_cpu(rxh->RxChan);
 
        /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */
        if (rxh->RxStatus1 & RXS_PBPRES) {
index 8bd4ede4c92a8a687b8903ec290f413e58e6343b..f8f2a5d811036ecb3057d1af7d51b368f9efcf8d 100644 (file)
@@ -32,7 +32,6 @@
 #include <proto/802.11.h>
 #include <bcmwifi.h>
 #include <siutils.h>
-#include <bcmendian.h>
 #include <wlioctl.h>
 #include <sbconfig.h>
 #include <sbchipc.h>
index 6904f8b19092cf1fa48046ec2470075a4d5afd7e..d48dd47ef8463d2571c65d7f349dd51ea3e69c94 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/module.h>
 #include <bcmutils.h>
 #include <siutils.h>
-#include <bcmendian.h>
 #include <wlioctl.h>
 
 #include <sbhndpio.h>
index 8b7620f2b8809d6f8859a7509826bc64c46be6fd..5ac120e8d4fe22126d16593da7487107d3fc4368 100644 (file)
@@ -21,7 +21,6 @@
 #include <osl.h>
 #include <bcmutils.h>
 #include <siutils.h>
-#include <bcmendian.h>
 #include <proto/802.11.h>
 #include <wlioctl.h>
 #include <bcmwifi.h>
diff --git a/drivers/staging/brcm80211/include/bcmendian.h b/drivers/staging/brcm80211/include/bcmendian.h
deleted file mode 100644 (file)
index 61c4edb..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2010 Broadcom Corporation
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _BCMENDIAN_H_
-#define _BCMENDIAN_H_
-
-/* Reverse the bytes in a 16-bit value */
-#define BCMSWAP16(val) \
-       ((u16)((((u16)(val) & (u16)0x00ffU) << 8) | \
-                 (((u16)(val) & (u16)0xff00U) >> 8)))
-
-#ifndef IL_BIGENDIAN
-#define ltoh16_buf(buf, i)
-#define htol16_buf(buf, i)
-#else
-#define ltoh16_buf(buf, i) bcmswap16_buf((u16 *)(buf), (i))
-#define htol16_buf(buf, i) bcmswap16_buf((u16 *)(buf), (i))
-#endif                         /* IL_BIGENDIAN */
-
-#ifdef __GNUC__
-
-/* GNU macro versions avoid referencing the argument multiple times, while also
- * avoiding the -fno-inline used in ROM builds.
- */
-
-#define bcmswap16(val) ({ \
-       u16 _val = (val); \
-       BCMSWAP16(_val); \
-})
-
-#define bcmswap16_buf(buf, len) ({ \
-       u16 *_buf = (u16 *)(buf); \
-       uint _wds = (len) / 2; \
-       while (_wds--) { \
-               *_buf = bcmswap16(*_buf); \
-               _buf++; \
-       } \
-})
-
-#else                          /* !__GNUC__ */
-
-/* Inline versions avoid referencing the argument multiple times */
-static inline u16 bcmswap16(u16 val)
-{
-       return BCMSWAP16(val);
-}
-
-/* Reverse pairs of bytes in a buffer (not for high-performance use) */
-/* buf - start of buffer of shorts to swap */
-/* len  - byte length of buffer */
-static inline void bcmswap16_buf(u16 *buf, uint len)
-{
-       len = len / 2;
-
-       while (len--) {
-               *buf = bcmswap16(*buf);
-               buf++;
-       }
-}
-
-#endif                         /* !__GNUC__ */
-#endif                         /* !_BCMENDIAN_H_ */
index 6fa04ed9350198908b9aee1de3a611836ee231a1..5c1ea4c1fbfdc7f974877fa27c2b6c643906858d 100644 (file)
@@ -24,7 +24,6 @@
 #include <bcmdevs.h>
 #include <bcmutils.h>
 #include <siutils.h>
-#include <bcmendian.h>
 #include <hndsoc.h>
 #include <sbchipc.h>
 #include <bcmotp.h>
index b26877c460234632479b1c467ec5bf73c2e6d7f8..3ef5a50f48afb831d28d033edfeeb9099938208e 100644 (file)
@@ -25,7 +25,6 @@
 #include <hndsoc.h>
 #include <sbchipc.h>
 #include <bcmdevs.h>
-#include <bcmendian.h>
 #include <pcicfg.h>
 #include <siutils.h>
 #include <bcmsrom.h>
@@ -1438,6 +1437,18 @@ srom_cc_cmd(si_t *sih, struct osl_info *osh, void *ccregs, u32 cmd,
                return 0xffff;
 }
 
+static inline void ltoh16_buf(u16 *buf, unsigned int size)
+{
+       for (size /= 2; size; size--)
+               *(buf + size) = le16_to_cpu(*(buf + size));
+}
+
+static inline void htol16_buf(u16 *buf, unsigned int size)
+{
+       for (size /= 2; size; size--)
+               *(buf + size) = cpu_to_le16(*(buf + size));
+}
+
 /*
  * Read in and validate sprom.
  * Return 0 on success, nonzero on error.
index 707fd0da3d36f6e519f446be1ceaf086a0fc72a1..674caf6243dfaf5810d1449e39eda656f0aa604d 100644 (file)
@@ -26,7 +26,6 @@
 #include <bcmutils.h>
 #include <siutils.h>
 #include <bcmnvram.h>
-#include <bcmendian.h>
 #include <bcmdevs.h>
 #include <proto/802.1d.h>
 #include <proto/802.11.h>
index 5d6489121b0a1b893ff22f379aa06c2bf560bdd6..66ebdfdf6cd4dc4262448e1435a06d55a194d055 100644 (file)
@@ -21,7 +21,6 @@
 #include <bcmdefs.h>
 #include <bcmdevs.h>
 #include <osl.h>
-#include <bcmendian.h>
 #include <hndsoc.h>
 #include <bcmutils.h>
 #include <siutils.h>
index e6716e823baa3eeca534d17b927d7c3a293d58ac..d7c3c3f9dd8198990359fbddb08a7a93fd0d62f6 100644 (file)
@@ -19,7 +19,6 @@
 #ifdef mips
 #include <asm/paccess.h>
 #endif                         /* mips */
-#include <bcmendian.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/netdevice.h>
index b2e6c0df137ea28aac0d347b0ad08ffbac490035..ec40779451402948d96e60e62679bda473ee1e41 100644 (file)
@@ -20,7 +20,6 @@
 #include <osl.h>
 #include <bcmutils.h>
 #include <siutils.h>
-#include <bcmendian.h>
 #include <bcmnvram.h>
 #include <sbchipc.h>
 #include <bcmsrom.h>