提交 f3171549 编写于 作者: S Stanislav Fomichev 提交者: Greg Kroah-Hartman

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: NStanislav Fomichev <kernel@fomichev.me>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 29750b90
......@@ -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>
......
......@@ -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 */
......
......@@ -21,7 +21,6 @@
#include <bcmutils.h>
#include <bcmcdc.h>
#include <bcmendian.h>
#include <dngl_stats.h>
#include <dhd.h>
......
......@@ -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>
......
......@@ -34,7 +34,6 @@
#include <bcmdefs.h>
#include <osl.h>
#include <bcmutils.h>
#include <bcmendian.h>
#include <dngl_stats.h>
#include <dhd.h>
......
......@@ -26,7 +26,6 @@
#include <bcmdefs.h>
#include <bcmutils.h>
#include <bcmendian.h>
#include <bcmdevs.h>
#include <siutils.h>
......
......@@ -19,7 +19,6 @@
#include <osl.h>
#include <bcmutils.h>
#include <bcmendian.h>
#include <asm/uaccess.h>
......
......@@ -22,7 +22,6 @@
#include <wlioctl.h>
#include <bcmutils.h>
#include <bcmendian.h>
#include <linux/if_arp.h>
#include <asm/uaccess.h>
......
......@@ -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>
......
......@@ -24,7 +24,6 @@
#include <siutils.h>
#include <sbchipc.h>
#include <hndpmu.h>
#include <bcmendian.h>
#include <bcmdevs.h>
#include <sbhndpio.h>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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) {
......
......@@ -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>
......
......@@ -20,7 +20,6 @@
#include <linux/module.h>
#include <bcmutils.h>
#include <siutils.h>
#include <bcmendian.h>
#include <wlioctl.h>
#include <sbhndpio.h>
......
......@@ -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>
......
/*
* 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_ */
......@@ -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>
......
......@@ -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.
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册