From f317154929f87d2fe799179761d1b639af33de74 Mon Sep 17 00:00:00 2001 From: Stanislav Fomichev Date: Mon, 21 Feb 2011 10:35:26 +0300 Subject: [PATCH] staging: brcm80211: remove the rest of broadcom specific byte swapping routines - 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 1 - .../staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 1 - drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 1 - .../staging/brcm80211/brcmfmac/dhd_common.c | 1 - .../staging/brcm80211/brcmfmac/dhd_linux.c | 1 - drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 1 - .../staging/brcm80211/brcmfmac/wl_cfg80211.c | 1 - drivers/staging/brcm80211/brcmfmac/wl_iw.c | 1 - .../brcm80211/brcmsmac/phy/wlc_phy_cmn.c | 1 - .../brcm80211/brcmsmac/phy/wlc_phy_n.c | 1 - .../staging/brcm80211/brcmsmac/wlc_ampdu.c | 1 - drivers/staging/brcm80211/brcmsmac/wlc_bmac.c | 1 - .../staging/brcm80211/brcmsmac/wlc_mac80211.c | 13 +++- .../staging/brcm80211/brcmsmac/wlc_phy_shim.c | 1 - drivers/staging/brcm80211/brcmsmac/wlc_rate.c | 1 - drivers/staging/brcm80211/brcmsmac/wlc_stf.c | 1 - drivers/staging/brcm80211/include/bcmendian.h | 75 ------------------- drivers/staging/brcm80211/util/bcmotp.c | 1 - drivers/staging/brcm80211/util/bcmsrom.c | 13 +++- drivers/staging/brcm80211/util/bcmutils.c | 1 - drivers/staging/brcm80211/util/hnddma.c | 1 - drivers/staging/brcm80211/util/linux_osl.c | 1 - .../staging/brcm80211/util/nvram/nvram_ro.c | 1 - 23 files changed, 23 insertions(+), 98 deletions(-) delete mode 100644 drivers/staging/brcm80211/include/bcmendian.h diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c index df9a139213a5..77e65e4297a1 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 8bf731f693ff..4409443c69de 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include /* SDIO Device and Protocol Specs */ diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c index 0083f0c3775b..6c0620c9742f 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c @@ -21,7 +21,6 @@ #include #include -#include #include #include diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c index 44dabd186eae..784333c42014 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c index b6e3c0a87006..3efc17a0a4e0 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c index 41b76afe7c39..097844f8569a 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c @@ -26,7 +26,6 @@ #include #include -#include #include #include diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c index fe3379a93798..86c18be7d64e 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c @@ -19,7 +19,6 @@ #include #include -#include #include diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c index 0e4b13281611..91d848807537 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c index d869efa781d4..2f80da7f0d0f 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c index 55ce0b8c4fdd..23b6086aa74d 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c index a5a4868ff3fa..4f9d4dec768c 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c index 9419f27e7425..12bfb06b3013 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c index e7628fa6fcd5..05bcda3b3791 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -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) { diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.c b/drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.c index 8bd4ede4c92a..f8f2a5d81103 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_rate.c b/drivers/staging/brcm80211/brcmsmac/wlc_rate.c index 6904f8b19092..d48dd47ef846 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_rate.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_rate.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_stf.c b/drivers/staging/brcm80211/brcmsmac/wlc_stf.c index 8b7620f2b880..5ac120e8d4fe 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_stf.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_stf.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/include/bcmendian.h b/drivers/staging/brcm80211/include/bcmendian.h deleted file mode 100644 index 61c4edb98046..000000000000 --- a/drivers/staging/brcm80211/include/bcmendian.h +++ /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_ */ diff --git a/drivers/staging/brcm80211/util/bcmotp.c b/drivers/staging/brcm80211/util/bcmotp.c index 6fa04ed93501..5c1ea4c1fbfd 100644 --- a/drivers/staging/brcm80211/util/bcmotp.c +++ b/drivers/staging/brcm80211/util/bcmotp.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/util/bcmsrom.c b/drivers/staging/brcm80211/util/bcmsrom.c index b26877c46023..3ef5a50f48af 100644 --- a/drivers/staging/brcm80211/util/bcmsrom.c +++ b/drivers/staging/brcm80211/util/bcmsrom.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -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. diff --git a/drivers/staging/brcm80211/util/bcmutils.c b/drivers/staging/brcm80211/util/bcmutils.c index 707fd0da3d36..674caf6243df 100644 --- a/drivers/staging/brcm80211/util/bcmutils.c +++ b/drivers/staging/brcm80211/util/bcmutils.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/util/hnddma.c b/drivers/staging/brcm80211/util/hnddma.c index 5d6489121b0a..66ebdfdf6cd4 100644 --- a/drivers/staging/brcm80211/util/hnddma.c +++ b/drivers/staging/brcm80211/util/hnddma.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/brcm80211/util/linux_osl.c b/drivers/staging/brcm80211/util/linux_osl.c index e6716e823baa..d7c3c3f9dd81 100644 --- a/drivers/staging/brcm80211/util/linux_osl.c +++ b/drivers/staging/brcm80211/util/linux_osl.c @@ -19,7 +19,6 @@ #ifdef mips #include #endif /* mips */ -#include #include #include #include diff --git a/drivers/staging/brcm80211/util/nvram/nvram_ro.c b/drivers/staging/brcm80211/util/nvram/nvram_ro.c index b2e6c0df137e..ec4077945140 100644 --- a/drivers/staging/brcm80211/util/nvram/nvram_ro.c +++ b/drivers/staging/brcm80211/util/nvram/nvram_ro.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include -- 2.20.1