summaryrefslogtreecommitdiffstats
path: root/drivers/staging/brcm80211/brcmfmac
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/brcm80211/brcmfmac')
-rw-r--r--drivers/staging/brcm80211/brcmfmac/Kconfig15
-rw-r--r--drivers/staging/brcm80211/brcmfmac/Makefile34
-rw-r--r--drivers/staging/brcm80211/brcmfmac/aiutils.c1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmcdc.h98
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdbus.h113
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh.c17
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c32
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c57
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.h134
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmutils.c1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmwifi.c1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd.h81
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_bus.h2
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_cdc.c59
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_common.c250
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c6
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_dbg.h28
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_linux.c144
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_proto.h3
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_sdio.c415
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhdioctl.h100
-rw-r--r--drivers/staging/brcm80211/brcmfmac/hndpmu.c1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/hndrte_armtrap.h75
-rw-r--r--drivers/staging/brcm80211/brcmfmac/hndrte_cons.h62
-rw-r--r--drivers/staging/brcm80211/brcmfmac/msgtrace.h61
-rw-r--r--drivers/staging/brcm80211/brcmfmac/sbutils.c1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/sdioh.h63
-rw-r--r--drivers/staging/brcm80211/brcmfmac/sdiovar.h38
-rw-r--r--drivers/staging/brcm80211/brcmfmac/siutils.c1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c203
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h23
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_iw.c469
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_iw.h9
34 files changed, 1511 insertions, 1087 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/Kconfig b/drivers/staging/brcm80211/brcmfmac/Kconfig
deleted file mode 100644
index e9f3037b0876..000000000000
--- a/drivers/staging/brcm80211/brcmfmac/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@
-menuconfig BRCMFMAC
- tristate "Broadcom fullmac wireless cards support"
- depends on MMC
- depends on CFG80211
- select FW_LOADER
- select WIRELESS_EXT
- select WEXT_PRIV
- ---help---
- This module adds support for wireless adapters based on
- Broadcom fullmac chipsets.
- This driver uses the kernel's wireless extensions subsystem.
- If you choose to build a module, it'll be called brcmfmac.ko. Say M if
- unsure.
-
-
diff --git a/drivers/staging/brcm80211/brcmfmac/Makefile b/drivers/staging/brcm80211/brcmfmac/Makefile
index 76f2d8b37e45..ac5a7d4ba806 100644
--- a/drivers/staging/brcm80211/brcmfmac/Makefile
+++ b/drivers/staging/brcm80211/brcmfmac/Makefile
@@ -17,13 +17,11 @@
ccflags-y := \
-DARP_OFFLOAD_SUPPORT \
- -DBCMDBG \
-DBCMLXSDMMC \
-DBCMPLATFORM_BUS \
-DBCMSDIO \
-DBDC \
-DBRCM_FULLMAC \
- -DDHD_DEBUG \
-DDHD_FIRSTREAD=64 \
-DDHD_SCHED \
-DDHD_SDALIGN=64 \
@@ -32,16 +30,34 @@ ccflags-y := \
-DMMC_SDIO_ABORT \
-DPKT_FILTER_SUPPORT \
-DSHOW_EVENTS \
- -DTOE \
- -Idrivers/staging/brcm80211/brcmfmac \
+ -DTOE
+
+ccflags-$(CONFIG_BRCMDBG) += -DDHD_DEBUG
+
+ccflags-y += \
+ -Idrivers/staging/brcm80211/brcmfmac \
-Idrivers/staging/brcm80211/include \
-Idrivers/staging/brcm80211/util
-DHDOFILES = dhd_linux.o ../util/linux_osl.o ../util/bcmutils.o dhd_common.o dhd_custom_gpio.o \
- wl_iw.o wl_cfg80211.o ../util/siutils.o ../util/sbutils.o ../util/aiutils.o ../util/hndpmu.o ../util/bcmwifi.o dhd_sdio.o \
- dhd_linux_sched.o dhd_cdc.o bcmsdh_sdmmc.o bcmsdh.o bcmsdh_linux.o \
- bcmsdh_sdmmc_linux.o
+DHDOFILES = \
+ wl_cfg80211.o \
+ wl_iw.o \
+ dhd_cdc.o \
+ dhd_common.o \
+ dhd_custom_gpio.o \
+ dhd_sdio.o \
+ dhd_linux.o \
+ dhd_linux_sched.o \
+ bcmsdh.o \
+ bcmsdh_linux.o \
+ bcmsdh_sdmmc.o \
+ bcmsdh_sdmmc_linux.o \
+ aiutils.o \
+ siutils.o \
+ sbutils.o \
+ bcmutils.o \
+ bcmwifi.o \
+ hndpmu.o
obj-m += brcmfmac.o
brcmfmac-objs += $(DHDOFILES)
-
diff --git a/drivers/staging/brcm80211/brcmfmac/aiutils.c b/drivers/staging/brcm80211/brcmfmac/aiutils.c
new file mode 100644
index 000000000000..e64808648ce3
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/aiutils.c
@@ -0,0 +1 @@
+#include "../util/aiutils.c"
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmcdc.h b/drivers/staging/brcm80211/brcmfmac/bcmcdc.h
new file mode 100644
index 000000000000..ed4c4a517eca
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/bcmcdc.h
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+#include <linux/if_ether.h>
+
+typedef struct cdc_ioctl {
+ u32 cmd; /* ioctl command value */
+ u32 len; /* lower 16: output buflen; upper 16:
+ input buflen (excludes header) */
+ u32 flags; /* flag defns given below */
+ u32 status; /* status code returned from the device */
+} cdc_ioctl_t;
+
+/* Max valid buffer size that can be sent to the dongle */
+#define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN)
+
+/* len field is divided into input and output buffer lengths */
+#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF /* maximum or expected
+ response length, */
+ /* excluding IOCTL header */
+#define CDCL_IOC_OUTLEN_SHIFT 0
+#define CDCL_IOC_INLEN_MASK 0xFFFF0000 /* input buffer length,
+ excluding IOCTL header */
+#define CDCL_IOC_INLEN_SHIFT 16
+
+/* CDC flag definitions */
+#define CDCF_IOC_ERROR 0x01 /* 0=success, 1=ioctl cmd failed */
+#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */
+#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */
+#define CDCF_IOC_IF_SHIFT 12
+#define CDCF_IOC_ID_MASK 0xFFFF0000 /* used to uniquely id an ioctl
+ req/resp pairing */
+#define CDCF_IOC_ID_SHIFT 16 /* # of bits of shift for ID Mask */
+
+#define CDC_IOC_IF_IDX(flags) \
+ (((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)
+#define CDC_IOC_ID(flags) \
+ (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT)
+
+#define CDC_GET_IF_IDX(hdr) \
+ ((int)((((hdr)->flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT))
+#define CDC_SET_IF_IDX(hdr, idx) \
+ ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | \
+ ((idx) << CDCF_IOC_IF_SHIFT)))
+
+/*
+ * BDC header
+ *
+ * The BDC header is used on data packets to convey priority across USB.
+ */
+
+#define BDC_HEADER_LEN 4
+
+#define BDC_PROTO_VER 1 /* Protocol version */
+
+#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */
+#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */
+
+#define BDC_FLAG__UNUSED 0x03 /* Unassigned */
+#define BDC_FLAG_SUM_GOOD 0x04 /* Dongle has verified good
+ RX checksums */
+#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */
+
+#define BDC_PRIORITY_MASK 0x7
+
+#define BDC_FLAG2_FC_FLAG 0x10 /* flag to indicate if pkt contains */
+ /* FLOW CONTROL info only */
+#define BDC_PRIORITY_FC_SHIFT 4 /* flow control info shift */
+
+#define BDC_FLAG2_IF_MASK 0x0f /* APSTA: interface on which the
+ packet was received */
+#define BDC_FLAG2_IF_SHIFT 0
+
+#define BDC_GET_IF_IDX(hdr) \
+ ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT))
+#define BDC_SET_IF_IDX(hdr, idx) \
+ ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | \
+ ((idx) << BDC_FLAG2_IF_SHIFT)))
+
+struct bdc_header {
+ u8 flags; /* Flags */
+ u8 priority; /* 802.1d Priority 0:2 bits, 4:7 flow
+ control info for usb */
+ u8 flags2;
+ u8 rssi;
+};
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdbus.h b/drivers/staging/brcm80211/brcmfmac/bcmsdbus.h
new file mode 100644
index 000000000000..53c32915acc9
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdbus.h
@@ -0,0 +1,113 @@
+/*
+ * 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 _sdio_api_h_
+#define _sdio_api_h_
+
+#define SDIOH_API_RC_SUCCESS (0x00)
+#define SDIOH_API_RC_FAIL (0x01)
+#define SDIOH_API_SUCCESS(status) (status == 0)
+
+#define SDIOH_READ 0 /* Read request */
+#define SDIOH_WRITE 1 /* Write request */
+
+#define SDIOH_DATA_FIX 0 /* Fixed addressing */
+#define SDIOH_DATA_INC 1 /* Incremental addressing */
+
+#define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */
+#define SDIOH_CMD_TYPE_APPEND 1 /* Append command */
+#define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */
+
+#define SDIOH_DATA_PIO 0 /* PIO mode */
+#define SDIOH_DATA_DMA 1 /* DMA mode */
+
+typedef int SDIOH_API_RC;
+
+/* SDio Host structure */
+typedef struct sdioh_info sdioh_info_t;
+
+/* callback function, taking one arg */
+typedef void (*sdioh_cb_fn_t) (void *);
+
+/* attach, return handler on success, NULL if failed.
+ * The handler shall be provided by all subsequent calls. No local cache
+ * cfghdl points to the starting address of pci device mapped memory
+ */
+extern sdioh_info_t *sdioh_attach(void *cfghdl, uint irq);
+extern SDIOH_API_RC sdioh_detach(sdioh_info_t *si);
+extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si,
+ sdioh_cb_fn_t fn, void *argh);
+extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si);
+
+/* query whether SD interrupt is enabled or not */
+extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff);
+
+/* enable or disable SD interrupt */
+extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable);
+
+#if defined(DHD_DEBUG)
+extern bool sdioh_interrupt_pending(sdioh_info_t *si);
+#endif
+
+extern int sdioh_claim_host_and_lock(sdioh_info_t *si);
+extern int sdioh_release_host_and_unlock(sdioh_info_t *si);
+
+/* read or write one byte using cmd52 */
+extern SDIOH_API_RC sdioh_request_byte(sdioh_info_t *si, uint rw, uint fnc,
+ uint addr, u8 *byte);
+
+/* read or write 2/4 bytes using cmd53 */
+extern SDIOH_API_RC sdioh_request_word(sdioh_info_t *si, uint cmd_type,
+ uint rw, uint fnc, uint addr,
+ u32 *word, uint nbyte);
+
+/* read or write any buffer using cmd53 */
+extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma,
+ uint fix_inc, uint rw, uint fnc_num,
+ u32 addr, uint regwidth,
+ u32 buflen, u8 *buffer,
+ struct sk_buff *pkt);
+
+/* get cis data */
+extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, u8 *cis,
+ u32 length);
+
+extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, u32 addr,
+ u8 *data);
+extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, u32 addr,
+ u8 *data);
+
+/* query number of io functions */
+extern uint sdioh_query_iofnum(sdioh_info_t *si);
+
+/* handle iovars */
+extern int sdioh_iovar_op(sdioh_info_t *si, const char *name,
+ void *params, int plen, void *arg, int len, bool set);
+
+/* Issue abort to the specified function and clear controller as needed */
+extern int sdioh_abort(sdioh_info_t *si, uint fnc);
+
+/* Start and Stop SDIO without re-enumerating the SD card. */
+extern int sdioh_start(sdioh_info_t *si, int stage);
+extern int sdioh_stop(sdioh_info_t *si);
+
+/* Reset and re-initialize the device */
+extern int sdioh_sdio_reset(sdioh_info_t *si);
+
+/* Helper function */
+void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh);
+
+#endif /* _sdio_api_h_ */
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index acf43a365081..473f57d9f00b 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -19,8 +19,6 @@
#include <linux/netdevice.h>
#include <bcmdefs.h>
#include <bcmdevs.h>
-#include <bcmendian.h>
-#include <osl.h>
#include <bcmutils.h>
#include <hndsoc.h>
#include <siutils.h>
@@ -39,7 +37,6 @@ struct bcmsdh_info {
bool init_success; /* underlying driver successfully attached */
void *sdioh; /* handler for sdioh */
u32 vendevid; /* Target Vendor and Device ID on SD bus */
- struct osl_info *osh;
bool regfail; /* Save status of last
reg_read/reg_write call */
u32 sbwad; /* Save backplane window address */
@@ -56,8 +53,7 @@ void bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable)
}
#endif
-bcmsdh_info_t *bcmsdh_attach(struct osl_info *osh, void *cfghdl,
- void **regsva, uint irq)
+bcmsdh_info_t *bcmsdh_attach(void *cfghdl, void **regsva, uint irq)
{
bcmsdh_info_t *bcmsdh;
@@ -70,13 +66,12 @@ bcmsdh_info_t *bcmsdh_attach(struct osl_info *osh, void *cfghdl,
/* save the handler locally */
l_bcmsdh = bcmsdh;
- bcmsdh->sdioh = sdioh_attach(osh, cfghdl, irq);
+ bcmsdh->sdioh = sdioh_attach(cfghdl, irq);
if (!bcmsdh->sdioh) {
- bcmsdh_detach(osh, bcmsdh);
+ bcmsdh_detach(bcmsdh);
return NULL;
}
- bcmsdh->osh = osh;
bcmsdh->init_success = true;
*regsva = (u32 *) SI_ENUM_BASE;
@@ -86,13 +81,13 @@ bcmsdh_info_t *bcmsdh_attach(struct osl_info *osh, void *cfghdl,
return bcmsdh;
}
-int bcmsdh_detach(struct osl_info *osh, void *sdh)
+int bcmsdh_detach(void *sdh)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
if (bcmsdh != NULL) {
if (bcmsdh->sdioh) {
- sdioh_detach(osh, bcmsdh->sdioh);
+ sdioh_detach(bcmsdh->sdioh);
bcmsdh->sdioh = NULL;
}
kfree(bcmsdh);
@@ -324,7 +319,7 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length)
BCMSDH_ERROR(("%s: out of memory\n", __func__));
return BCME_NOMEM;
}
- bcopy(cis, tmp_buf, length);
+ memcpy(tmp_buf, cis, length);
for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length - 4);
tmp_ptr++) {
ptr += sprintf((char *)ptr, "%.2x ", *tmp_ptr & 0xff);
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
index d24b5e7d753c..e3556ff43bb9 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
@@ -24,15 +24,14 @@
#include <linux/pci.h>
#include <linux/completion.h>
-#include <osl.h>
#include <pcicfg.h>
#include <bcmdefs.h>
#include <bcmdevs.h>
+#include <bcmutils.h>
#if defined(OOB_INTR_ONLY)
#include <linux/irq.h>
extern void dhdsdio_isr(void *args);
-#include <bcmutils.h>
#include <dngl_stats.h>
#include <dhd.h>
#endif /* defined(OOB_INTR_ONLY) */
@@ -56,7 +55,6 @@ struct bcmsdh_hc {
#else
struct pci_dev *dev; /* pci device handle */
#endif /* BCMPLATFORM_BUS */
- struct osl_info *osh;
void *regs; /* SDIO Host Controller address */
bcmsdh_info_t *sdh; /* SDIO Host Controller handle */
void *ch;
@@ -114,7 +112,7 @@ bool bcmsdh_chipmatch(u16 vendor, u16 device)
#ifdef BCMSDIOH_SPI
/* This is the PciSpiHost. */
if (device == SPIH_FPGA_ID && vendor == VENDOR_BROADCOM) {
- printf("Found PCI SPI Host Controller\n");
+ WL_NONE("Found PCI SPI Host Controller\n");
return true;
}
#endif /* BCMSDIOH_SPI */
@@ -142,7 +140,6 @@ static
#endif /* BCMLXSDMMC */
int bcmsdh_probe(struct device *dev)
{
- struct osl_info *osh = NULL;
bcmsdh_hc_t *sdhc = NULL;
unsigned long regs = 0;
bcmsdh_info_t *sdh = NULL;
@@ -177,28 +174,21 @@ int bcmsdh_probe(struct device *dev)
}
#endif /* defined(OOB_INTR_ONLY) */
/* allocate SDIO Host Controller state info */
- osh = osl_attach(dev, PCI_BUS);
- if (!osh) {
- SDLX_MSG(("%s: osl_attach failed\n", __func__));
- goto err;
- }
sdhc = kzalloc(sizeof(bcmsdh_hc_t), GFP_ATOMIC);
if (!sdhc) {
SDLX_MSG(("%s: out of memory\n", __func__));
goto err;
}
- sdhc->osh = osh;
-
sdhc->dev = (void *)dev;
#ifdef BCMLXSDMMC
- sdh = bcmsdh_attach(osh, (void *)0, (void **)&regs, irq);
+ sdh = bcmsdh_attach((void *)0, (void **)&regs, irq);
if (!sdh) {
SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
goto err;
}
#else
- sdh = bcmsdh_attach(osh, (void *)r->start, (void **)&regs, irq);
+ sdh = bcmsdh_attach((void *)r->start, (void **)&regs, irq);
if (!sdh) {
SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
goto err;
@@ -220,7 +210,7 @@ int bcmsdh_probe(struct device *dev)
/* try to attach to the target device */
sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF),
- 0, 0, 0, 0, (void *)regs, NULL, sdh);
+ 0, 0, 0, 0, (void *)regs, sdh);
if (!sdhc->ch) {
SDLX_MSG(("%s: device attach failed\n", __func__));
goto err;
@@ -232,11 +222,10 @@ int bcmsdh_probe(struct device *dev)
err:
if (sdhc) {
if (sdhc->sdh)
- bcmsdh_detach(sdhc->osh, sdhc->sdh);
+ bcmsdh_detach(sdhc->sdh);
kfree(sdhc);
}
- if (osh)
- osl_detach(osh);
+
return -ENODEV;
}
@@ -246,11 +235,10 @@ static
int bcmsdh_remove(struct device *dev)
{
bcmsdh_hc_t *sdhc, *prev;
- struct osl_info *osh;
sdhc = sdhcinfo;
drvinfo.detach(sdhc->ch);
- bcmsdh_detach(sdhc->osh, sdhc->sdh);
+ bcmsdh_detach(sdhc->sdh);
/* find the SDIO Host Controller state for this pdev
and take it out from the list */
for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) {
@@ -269,9 +257,7 @@ int bcmsdh_remove(struct device *dev)
}
/* release SDIO Host Controller info */
- osh = sdhc->osh;
kfree(sdhc);
- osl_detach(osh);
#if !defined(BCMLXSDMMC)
dev_set_drvdata(dev, NULL);
@@ -328,8 +314,6 @@ static irqreturn_t wlan_oob_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
- WAKE_LOCK_TIMEOUT(dhdp, WAKE_LOCK_TMOUT, 25);
-
dhdsdio_isr((void *)dhdp->bus);
return IRQ_HANDLED;
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index d399b5c76f94..65313fa0cf4a 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -17,8 +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 */
#include <sdioh.h> /* SDIO Host Controller Specification */
@@ -112,7 +110,7 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd)
/*
* Public entry points & extern's
*/
-extern sdioh_info_t *sdioh_attach(struct osl_info *osh, void *bar0, uint irq)
+sdioh_info_t *sdioh_attach(void *bar0, uint irq)
{
sdioh_info_t *sd;
int err_ret;
@@ -129,7 +127,6 @@ extern sdioh_info_t *sdioh_attach(struct osl_info *osh, void *bar0, uint irq)
sd_err(("sdioh_attach: out of memory\n"));
return NULL;
}
- sd->osh = osh;
if (sdioh_sdmmc_osinit(sd) != 0) {
sd_err(("%s:sdioh_sdmmc_osinit() failed\n", __func__));
kfree(sd);
@@ -175,7 +172,7 @@ extern sdioh_info_t *sdioh_attach(struct osl_info *osh, void *bar0, uint irq)
return sd;
}
-extern SDIOH_API_RC sdioh_detach(struct osl_info *osh, sdioh_info_t *sd)
+extern SDIOH_API_RC sdioh_detach(sdioh_info_t *sd)
{
sd_trace(("%s\n", __func__));
@@ -441,7 +438,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
val_size = sizeof(int);
if (plen >= (int)sizeof(int_val))
- bcopy(params, &int_val, sizeof(int_val));
+ memcpy(&int_val, params, sizeof(int_val));
bool_val = (int_val != 0) ? true : false;
@@ -449,7 +446,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
switch (actionid) {
case IOV_GVAL(IOV_MSGLEVEL):
int_val = (s32) sd_msglevel;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_MSGLEVEL):
@@ -458,7 +455,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_BLOCKMODE):
int_val = (s32) si->sd_blockmode;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_BLOCKMODE):
@@ -472,7 +469,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
break;
}
int_val = (s32) si->client_block_size[int_val];
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_BLOCKSIZE):
@@ -514,12 +511,12 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_RXCHAIN):
int_val = false;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_GVAL(IOV_DMA):
int_val = (s32) si->sd_use_dma;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_DMA):
@@ -528,7 +525,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_USEINTS):
int_val = (s32) si->use_client_ints;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_USEINTS):
@@ -542,7 +539,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_DIVISOR):
int_val = (u32) sd_divisor;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_DIVISOR):
@@ -551,7 +548,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_POWER):
int_val = (u32) sd_power;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_POWER):
@@ -560,7 +557,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_CLOCK):
int_val = (u32) sd_clock;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_CLOCK):
@@ -569,7 +566,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_SDMODE):
int_val = (u32) sd_sdmode;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_SDMODE):
@@ -578,7 +575,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_HISPEED):
int_val = (u32) sd_hiok;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_HISPEED):
@@ -587,12 +584,12 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_NUMINTS):
int_val = (s32) si->intrcount;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_GVAL(IOV_NUMLOCALINTS):
int_val = (s32) 0;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_GVAL(IOV_HOSTREG):
@@ -621,7 +618,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
int_val = 32; /* sdioh_sdmmc_rreg(si,
sd_ptr->offset); */
- bcopy(&int_val, arg, sizeof(int_val));
+ memcpy(arg, &int_val, sizeof(int_val));
break;
}
@@ -657,7 +654,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
}
int_val = (int)data;
- bcopy(&int_val, arg, sizeof(int_val));
+ memcpy(arg, &int_val, sizeof(int_val));
break;
}
@@ -735,7 +732,7 @@ static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr)
}
/* Only the lower 17-bits are valid */
- scratch = ltoh32(scratch);
+ scratch = le32_to_cpu(scratch);
scratch &= 0x0001FFFF;
return scratch;
}
@@ -1039,7 +1036,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
if (pkt == NULL) {
sd_data(("%s: Creating new %s Packet, len=%d\n",
__func__, write ? "TX" : "RX", buflen_u));
- mypkt = pkt_buf_get_skb(sd->osh, buflen_u);
+ mypkt = pkt_buf_get_skb(buflen_u);
if (!mypkt) {
sd_err(("%s: pkt_buf_get_skb failed: len %d\n",
__func__, buflen_u));
@@ -1048,16 +1045,16 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
/* For a write, copy the buffer data into the packet. */
if (write)
- bcopy(buffer, mypkt->data, buflen_u);
+ memcpy(mypkt->data, buffer, buflen_u);
Status =
sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
/* For a read, copy the packet data back to the buffer. */
if (!write)
- bcopy(mypkt->data, buffer, buflen_u);
+ memcpy(buffer, mypkt->data, buflen_u);
- pkt_buf_free_skb(sd->osh, mypkt, write ? true : false);
+ pkt_buf_free_skb(mypkt);
} else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) {
/* Case 2: We have a packet, but it is unaligned. */
@@ -1066,7 +1063,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
sd_data(("%s: Creating aligned %s Packet, len=%d\n",
__func__, write ? "TX" : "RX", pkt->len));
- mypkt = pkt_buf_get_skb(sd->osh, pkt->len);
+ mypkt = pkt_buf_get_skb(pkt->len);
if (!mypkt) {
sd_err(("%s: pkt_buf_get_skb failed: len %d\n",
__func__, pkt->len));
@@ -1075,16 +1072,16 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
/* For a write, copy the buffer data into the packet. */
if (write)
- bcopy(pkt->data, mypkt->data, pkt->len);
+ memcpy(mypkt->data, pkt->data, pkt->len);
Status =
sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
/* For a read, copy the packet data back to the buffer. */
if (!write)
- bcopy(mypkt->data, pkt->data, mypkt->len);
+ memcpy(pkt->data, mypkt->data, mypkt->len);
- pkt_buf_free_skb(sd->osh, mypkt, write ? true : false);
+ pkt_buf_free_skb(mypkt);
} else { /* case 3: We have a packet and
it is aligned. */
sd_data(("%s: Aligned %s Packet, direct DMA\n",
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.h b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.h
new file mode 100644
index 000000000000..3ef42b318493
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.h
@@ -0,0 +1,134 @@
+/*
+ * 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 __BCMSDH_SDMMC_H__
+#define __BCMSDH_SDMMC_H__
+
+#ifdef BCMDBG
+#define sd_err(x) \
+ do { \
+ if ((sd_msglevel & SDH_ERROR_VAL) && net_ratelimit()) \
+ printk x; \
+ } while (0)
+#define sd_trace(x) \
+ do { \
+ if ((sd_msglevel & SDH_TRACE_VAL) && net_ratelimit()) \
+ printk x; \
+ } while (0)
+#define sd_info(x) \
+ do { \
+ if ((sd_msglevel & SDH_INFO_VAL) && net_ratelimit()) \
+ printk x; \
+ } while (0)
+#define sd_debug(x) \
+ do { \
+ if ((sd_msglevel & SDH_DEBUG_VAL) && net_ratelimit()) \
+ printk x; \
+ } while (0)
+#define sd_data(x) \
+ do { \
+ if ((sd_msglevel & SDH_DATA_VAL) && net_ratelimit()) \
+ printk x; \
+ } while (0)
+#define sd_ctrl(x) \
+ do { \
+ if ((sd_msglevel & SDH_CTRL_VAL) && net_ratelimit()) \
+ printk x; \
+ } while (0)
+#else
+#define sd_err(x)
+#define sd_trace(x)
+#define sd_info(x)
+#define sd_debug(x)
+#define sd_data(x)
+#define sd_ctrl(x)
+#endif
+
+/* Allocate/init/free per-OS private data */
+extern int sdioh_sdmmc_osinit(sdioh_info_t *sd);
+extern void sdioh_sdmmc_osfree(sdioh_info_t *sd);
+
+#define BLOCK_SIZE_64 64
+#define BLOCK_SIZE_512 512
+#define BLOCK_SIZE_4318 64
+#define BLOCK_SIZE_4328 512
+
+/* internal return code */
+#define SUCCESS 0
+#define ERROR 1
+
+/* private bus modes */
+#define SDIOH_MODE_SD4 2
+#define CLIENT_INTR 0x100 /* Get rid of this! */
+
+struct sdioh_info {
+ struct osl_info *osh; /* osh handler */
+ bool client_intr_enabled; /* interrupt connnected flag */
+ bool intr_handler_valid; /* client driver interrupt handler valid */
+ sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
+ void *intr_handler_arg; /* argument to call interrupt handler */
+ u16 intmask; /* Current active interrupts */
+ void *sdos_info; /* Pointer to per-OS private data */
+
+ uint irq; /* Client irq */
+ int intrcount; /* Client interrupts */
+ bool sd_use_dma; /* DMA on CMD53 */
+ bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */
+ /* Must be on for sd_multiblock to be effective */
+ bool use_client_ints; /* If this is false, make sure to restore */
+ int sd_mode; /* SD1/SD4/SPI */
+ int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
+ u8 num_funcs; /* Supported funcs on client */
+ u32 com_cis_ptr;
+ u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
+ uint max_dma_len;
+ uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */
+ /* SDDMA_DESCRIPTOR SGList[32]; *//* Scatter/Gather DMA List */
+};
+
+/************************************************************
+ * Internal interfaces: per-port references into bcmsdh_sdmmc.c
+ */
+
+/* Global message bits */
+extern uint sd_msglevel;
+
+/* OS-independent interrupt handler */
+extern bool check_client_intr(sdioh_info_t *sd);
+
+/* Core interrupt enable/disable of device interrupts */
+extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
+extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
+
+/**************************************************************
+ * Internal interfaces: bcmsdh_sdmmc.c references to per-port code
+ */
+
+/* Register mapping routines */
+extern u32 *sdioh_sdmmc_reg_map(s32 addr, int size);
+extern void sdioh_sdmmc_reg_unmap(s32 addr, int size);
+
+/* Interrupt (de)registration routines */
+extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq);
+extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd);
+
+typedef struct _BCMSDH_SDMMC_INSTANCE {
+ sdioh_info_t *sd;
+ struct sdio_func *func[SDIOD_MAX_IOFUNCS];
+ u32 host_claimed;
+} BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE;
+
+#endif /* __BCMSDH_SDMMC_H__ */
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
index ceaa47490680..d738d4da5443 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
@@ -17,7 +17,6 @@
#include <linux/sched.h> /* request_irq() */
#include <linux/netdevice.h>
#include <bcmdefs.h>
-#include <osl.h>
#include <bcmutils.h>
#include <sdio.h> /* SDIO Specs */
#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmutils.c b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
new file mode 100644
index 000000000000..8e1296a0009e
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
@@ -0,0 +1 @@
+#include "../util/bcmutils.c"
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmwifi.c b/drivers/staging/brcm80211/brcmfmac/bcmwifi.c
new file mode 100644
index 000000000000..9fe988c1b940
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/bcmwifi.c
@@ -0,0 +1 @@
+#include "../util/bcmwifi.c"
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 69c6a0272812..60cf78213a07 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -33,9 +33,6 @@
#include <linux/ethtool.h>
#include <asm/uaccess.h>
#include <asm/unaligned.h>
-#if defined(CONFIG_HAS_WAKELOCK)
-#include <linux/wakelock.h>
-#endif /* defined (CONFIG_HAS_WAKELOCK) */
/* The kernel threading is sdio-specific */
#include <wlioctl.h>
@@ -52,32 +49,9 @@ enum dhd_bus_state {
DHD_BUS_DATA /* Ready for frame transfers */
};
-enum dhd_bus_wake_state {
- WAKE_LOCK_OFF,
- WAKE_LOCK_PRIV,
- WAKE_LOCK_DPC,
- WAKE_LOCK_IOCTL,
- WAKE_LOCK_DOWNLOAD,
- WAKE_LOCK_TMOUT,
- WAKE_LOCK_WATCHDOG,
- WAKE_LOCK_LINK_DOWN_TMOUT,
- WAKE_LOCK_PNO_FIND_TMOUT,
- WAKE_LOCK_SOFTAP_SET,
- WAKE_LOCK_SOFTAP_STOP,
- WAKE_LOCK_SOFTAP_START,
- WAKE_LOCK_MAX
-};
-enum dhd_prealloc_index {
- DHD_PREALLOC_PROT = 0,
- DHD_PREALLOC_RXBUF,
- DHD_PREALLOC_DATABUF,
- DHD_PREALLOC_OSL_BUF
-};
-
/* Common structure for module and instance linkage */
typedef struct dhd_pub {
/* Linkage ponters */
- struct osl_info *osh; /* OSL handle */
struct dhd_bus *bus; /* Bus module handle */
struct dhd_prot *prot; /* Protocol module handle */
struct dhd_info *info; /* Info module handle */
@@ -95,8 +69,8 @@ typedef struct dhd_pub {
/* Dongle media info */
bool iswl; /* Dongle-resident driver is wl */
unsigned long drv_version; /* Version of dongle-resident driver */
- struct ether_addr mac; /* MAC address obtained from dongle */
- dngl_stats_t dstats; /* Stats for dongle-based data */
+ u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */
+ dngl_stats_t dstats; /* Stats for dongle-based data */
/* Additional stats for the bus level */
unsigned long tx_packets; /* Data packets sent to dongle */
@@ -145,9 +119,6 @@ typedef struct dhd_pub {
u8 country_code[WLC_CNTRY_BUF_SZ];
char eventmask[WL_EVENTING_MASK_LEN];
-#if defined(CONFIG_HAS_WAKELOCK)
- struct wake_lock wakelock[WAKE_LOCK_MAX];
-#endif /* defined (CONFIG_HAS_WAKELOCK) */
} dhd_pub_t;
#if defined(CONFIG_PM_SLEEP)
@@ -230,41 +201,6 @@ static inline void MUTEX_UNLOCK_WL_SCAN_SET(void)
{
}
-static inline void WAKE_LOCK_INIT(dhd_pub_t *dhdp, int index, char *y)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
- wake_lock_init(&dhdp->wakelock[index], WAKE_LOCK_SUSPEND, y);
-#endif /* defined (CONFIG_HAS_WAKELOCK) */
-}
-
-static inline void WAKE_LOCK(dhd_pub_t *dhdp, int index)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
- wake_lock(&dhdp->wakelock[index]);
-#endif /* defined (CONFIG_HAS_WAKELOCK) */
-}
-
-static inline void WAKE_UNLOCK(dhd_pub_t *dhdp, int index)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
- wake_unlock(&dhdp->wakelock[index]);
-#endif /* defined (CONFIG_HAS_WAKELOCK) */
-}
-
-static inline void WAKE_LOCK_TIMEOUT(dhd_pub_t *dhdp, int index, long time)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
- wake_lock_timeout(&dhdp->wakelock[index], time);
-#endif /* defined (CONFIG_HAS_WAKELOCK) */
-}
-
-static inline void WAKE_LOCK_DESTROY(dhd_pub_t *dhdp, int index)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
- wake_lock_destroy(&dhdp->wakelock[index]);
-#endif /* defined (CONFIG_HAS_WAKELOCK) */
-}
-
typedef struct dhd_if_event {
u8 ifidx;
u8 action;
@@ -276,16 +212,12 @@ typedef struct dhd_if_event {
* Exported from dhd OS modules (dhd_linux/dhd_ndis)
*/
-/* To allow osl_attach/detach calls from os-independent modules */
-struct osl_info *dhd_osl_attach(void *pdev, uint bustype);
-void dhd_osl_detach(struct osl_info *osh);
-
/* Indication from bus module regarding presence/insertion of dongle.
* Return dhd_pub_t pointer, used as handle to OS module in later calls.
* Returned structure should have bus and prot pointers filled in.
* bus_hdrlen specifies required headroom for bus module header.
*/
-extern dhd_pub_t *dhd_attach(struct osl_info *osh, struct dhd_bus *bus,
+extern dhd_pub_t *dhd_attach(struct dhd_bus *bus,
uint bus_hdrlen);
extern int dhd_net_attach(dhd_pub_t *dhdp, int idx);
@@ -364,7 +296,6 @@ extern int dhd_ifname2idx(struct dhd_info *dhd, char *name);
extern u8 *dhd_bssidx2bssid(dhd_pub_t *dhd, int idx);
extern int wl_host_event(struct dhd_info *dhd, int *idx, void *pktdata,
wl_event_msg_t *, void **data_ptr);
-extern void wl_event_to_host_order(wl_event_msg_t *evt);
extern void dhd_common_init(void);
@@ -389,14 +320,12 @@ extern int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag);
extern uint dhd_bus_status(dhd_pub_t *dhdp);
extern int dhd_bus_start(dhd_pub_t *dhdp);
-extern void print_buf(void *pbuf, int len, int bytes_per_line);
-
-typedef enum cust_gpio_modes {
+enum cust_gpio_modes {
WLAN_RESET_ON,
WLAN_RESET_OFF,
WLAN_POWER_ON,
WLAN_POWER_OFF
-} cust_gpio_modes_t;
+};
/*
* Insmod parameters for debug/test
*/
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
index cd0d5400bf07..065f1aeb6ca9 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
@@ -27,7 +27,7 @@ extern void dhd_bus_unregister(void);
/* Download firmware image and nvram image */
extern bool dhd_bus_download_firmware(struct dhd_bus *bus,
- struct osl_info *osh, char *fw_path, char *nv_path);
+ char *fw_path, char *nv_path);
/* Stop bus module: clear pending frames, disable data flow */
extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
index b7b527f5024c..39a4d001fbd0 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
@@ -17,11 +17,9 @@
#include <linux/types.h>
#include <linux/netdevice.h>
#include <bcmdefs.h>
-#include <osl.h>
#include <bcmutils.h>
#include <bcmcdc.h>
-#include <bcmendian.h>
#include <dngl_stats.h>
#include <dhd.h>
@@ -65,7 +63,7 @@ typedef struct dhd_prot {
static int dhdcdc_msg(dhd_pub_t *dhd)
{
dhd_prot_t *prot = dhd->prot;
- int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
+ int len = le32_to_cpu(prot->msg.len) + sizeof(cdc_ioctl_t);
DHD_TRACE(("%s: Enter\n", __func__));
@@ -93,7 +91,7 @@ static int dhdcdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len)
len + sizeof(cdc_ioctl_t));
if (ret < 0)
break;
- } while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id);
+ } while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id);
return ret;
}
@@ -124,11 +122,11 @@ dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
memset(msg, 0, sizeof(cdc_ioctl_t));
- msg->cmd = htol32(cmd);
- msg->len = htol32(len);
+ msg->cmd = cpu_to_le32(cmd);
+ msg->len = cpu_to_le32(len);
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
CDC_SET_IF_IDX(msg, ifidx);
- msg->flags = htol32(msg->flags);
+ msg->flags = cpu_to_le32(msg->flags);
if (buf)
memcpy(prot->buf, buf, len);
@@ -146,7 +144,7 @@ retry:
if (ret < 0)
goto done;
- flags = ltoh32(msg->flags);
+ flags = le32_to_cpu(msg->flags);
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
if ((id < prot->reqid) && (++retries < RETRIES))
@@ -170,7 +168,7 @@ retry:
/* Check the ERROR flag */
if (flags & CDCF_IOC_ERROR) {
- ret = ltoh32(msg->status);
+ ret = le32_to_cpu(msg->status);
/* Cache error from dongle */
dhd->dongle_error = ret;
}
@@ -191,11 +189,11 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
memset(msg, 0, sizeof(cdc_ioctl_t));
- msg->cmd = htol32(cmd);
- msg->len = htol32(len);
+ msg->cmd = cpu_to_le32(cmd);
+ msg->len = cpu_to_le32(len);
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET;
CDC_SET_IF_IDX(msg, ifidx);
- msg->flags = htol32(msg->flags);
+ msg->flags = cpu_to_le32(msg->flags);
if (buf)
memcpy(prot->buf, buf, len);
@@ -208,7 +206,7 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
if (ret < 0)
goto done;
- flags = ltoh32(msg->flags);
+ flags = le32_to_cpu(msg->flags);
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
if (id != prot->reqid) {
@@ -220,7 +218,7 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
/* Check the ERROR flag */
if (flags & CDCF_IOC_ERROR) {
- ret = ltoh32(msg->status);
+ ret = le32_to_cpu(msg->status);
/* Cache error from dongle */
dhd->dongle_error = ret;
}
@@ -276,8 +274,8 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
ret = 0;
else {
cdc_ioctl_t *msg = &prot->msg;
- ioc->needed = ltoh32(msg->len); /* len == needed when set/query
- fails from dongle */
+ /* len == needed when set/query fails from dongle */
+ ioc->needed = le32_to_cpu(msg->len);
}
/* Intercept the wme_dp ioctl here */
@@ -286,8 +284,8 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
slen = strlen("wme_dp") + 1;
if (len >= (int)(slen + sizeof(int)))
- bcopy(((char *)buf + slen), &val, sizeof(int));
- dhd->wme_dp = (u8) ltoh32(val);
+ memcpy(&val, (char *)buf + slen, sizeof(int));
+ dhd->wme_dp = (u8) le32_to_cpu(val);
}
prot->pending = false;
@@ -345,26 +343,6 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf)
BDC_SET_IF_IDX(h, ifidx);
}
-bool dhd_proto_fcinfo(dhd_pub_t *dhd, struct sk_buff *pktbuf, u8 * fcbits)
-{
-#ifdef BDC
- struct bdc_header *h;
-
- if (pktbuf->len < BDC_HEADER_LEN) {
- DHD_ERROR(("%s: rx data too short (%d < %d)\n",
- __func__, pktbuf->len, BDC_HEADER_LEN));
- return BCME_ERROR;
- }
-
- h = (struct bdc_header *)(pktbuf->data);
-
- *fcbits = h->priority >> BDC_PRIORITY_FC_SHIFT;
- if ((h->flags2 & BDC_FLAG2_FC_FLAG) == BDC_FLAG2_FC_FLAG)
- return true;
-#endif
- return false;
-}
-
int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
{
#ifdef BDC
@@ -437,8 +415,7 @@ int dhd_prot_attach(dhd_pub_t *dhd)
return 0;
fail:
- if (cdc != NULL)
- kfree(cdc);
+ kfree(cdc);
return BCME_NOMEM;
}
@@ -477,7 +454,7 @@ int dhd_prot_init(dhd_pub_t *dhd)
dhd_os_proto_unblock(dhd);
return ret;
}
- memcpy(dhd->mac.octet, buf, ETH_ALEN);
+ memcpy(dhd->mac, buf, ETH_ALEN);
dhd_os_proto_unblock(dhd);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index 3dbf72eebd4a..aa171f6181e9 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -17,9 +17,7 @@
#include <linux/string.h>
#include <bcmdefs.h>
#include <linux/netdevice.h>
-#include <osl.h>
#include <bcmutils.h>
-#include <bcmendian.h>
#include <dngl_stats.h>
#include <dhd.h>
#include <dhd_bus.h>
@@ -37,11 +35,6 @@ u32 dhd_conn_event;
u32 dhd_conn_status;
u32 dhd_conn_reason;
-#define htod32(i) i
-#define htod16(i) i
-#define dtoh32(i) i
-#define dtoh16(i) i
-
extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
uint len);
extern void dhd_ind_scan_confirm(void *h, bool status);
@@ -57,8 +50,8 @@ void dhd_iscan_unlock(void);
#error DHD_SDALIGN is not a power of 2!
#endif
-#ifdef DHD_DEBUG
#define EPI_VERSION_STR "4.218.248.5"
+#ifdef DHD_DEBUG
const char dhd_version[] =
"Dongle Host Driver, version " EPI_VERSION_STR "\nCompiled on " __DATE__
" at " __TIME__;
@@ -214,7 +207,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
goto exit;
if (plen >= (int)sizeof(int_val))
- bcopy(params, &int_val, sizeof(int_val));
+ memcpy(&int_val, params, sizeof(int_val));
switch (actionid) {
case IOV_GVAL(IOV_VERSION):
@@ -224,7 +217,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_MSGLEVEL):
int_val = (s32) dhd_msg_level;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_MSGLEVEL):
@@ -239,12 +232,12 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_BCMERROR):
int_val = (s32) dhd_pub->bcmerror;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_GVAL(IOV_WDTICK):
int_val = (s32) dhd_watchdog_ms;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_WDTICK):
@@ -262,7 +255,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
#ifdef DHD_DEBUG
case IOV_GVAL(IOV_DCONSOLE_POLL):
int_val = (s32) dhd_console_ms;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_DCONSOLE_POLL):
@@ -290,7 +283,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_IOCTLTIMEOUT):{
int_val = (s32) dhd_os_get_ioctl_resp_timeout();
- bcopy(&int_val, arg, sizeof(int_val));
+ memcpy(arg, &int_val, sizeof(int_val));
break;
}
@@ -312,21 +305,6 @@ exit:
return bcmerror;
}
-/* Store the status of a connection attempt for later retrieval by an iovar */
-void dhd_store_conn_status(u32 event, u32 status, u32 reason)
-{
- /* Do not overwrite a WLC_E_PRUNE with a WLC_E_SET_SSID
- * because an encryption/rsn mismatch results in both events, and
- * the important information is in the WLC_E_PRUNE.
- */
- if (!(event == WLC_E_SET_SSID && status == WLC_E_STATUS_FAIL &&
- dhd_conn_event == WLC_E_PRUNE)) {
- dhd_conn_event = event;
- dhd_conn_status = status;
- dhd_conn_reason = reason;
- }
-}
-
bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,
int prec)
{
@@ -368,7 +346,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,
ASSERT(p);
}
- pkt_buf_free_skb(dhdp->osh, p, true);
+ pkt_buf_free_skb(p);
}
/* Enqueue */
@@ -592,14 +570,14 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
};
uint event_type, flags, auth_type, datalen;
- event_type = ntoh32(event->event_type);
- flags = ntoh16(event->flags);
- status = ntoh32(event->status);
- reason = ntoh32(event->reason);
- auth_type = ntoh32(event->auth_type);
- datalen = ntoh32(event->datalen);
+ event_type = be32_to_cpu(event->event_type);
+ flags = be16_to_cpu(event->flags);
+ status = be32_to_cpu(event->status);
+ reason = be32_to_cpu(event->reason);
+ auth_type = be32_to_cpu(event->auth_type);
+ datalen = be32_to_cpu(event->datalen);
/* debug dump of event messages */
- sprintf(eabuf, "%pM", event->addr.octet);
+ sprintf(eabuf, "%pM", event->addr);
event_name = "UNKNOWN";
for (i = 0; i < ARRAY_SIZE(event_names); i++) {
@@ -653,9 +631,9 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
case WLC_E_AUTH:
case WLC_E_AUTH_IND:
- if (auth_type == DOT11_OPEN_SYSTEM)
+ if (auth_type == WLAN_AUTH_OPEN)
auth_str = "Open System";
- else if (auth_type == DOT11_SHARED_KEY)
+ else if (auth_type == WLAN_AUTH_SHARED_KEY)
auth_str = "Shared Key";
else {
sprintf(err_msg, "AUTH unknown: %d", (int)auth_type);
@@ -754,34 +732,35 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
memcpy(&hdr, buf, MSGTRACE_HDRLEN);
if (hdr.version != MSGTRACE_VERSION) {
- printf
+ DHD_ERROR(
("\nMACEVENT: %s [unsupported version --> "
"dhd version:%d dongle version:%d]\n",
- event_name, MSGTRACE_VERSION, hdr.version);
+ event_name, MSGTRACE_VERSION, hdr.version)
+ );
/* Reset datalen to avoid display below */
datalen = 0;
break;
}
/* There are 2 bytes available at the end of data */
- buf[MSGTRACE_HDRLEN + ntoh16(hdr.len)] = '\0';
+ buf[MSGTRACE_HDRLEN + be16_to_cpu(hdr.len)] = '\0';
- if (ntoh32(hdr.discarded_bytes)
- || ntoh32(hdr.discarded_printf)) {
- printf
+ if (be32_to_cpu(hdr.discarded_bytes)
+ || be32_to_cpu(hdr.discarded_printf)) {
+ DHD_ERROR(
("\nWLC_E_TRACE: [Discarded traces in dongle -->"
"discarded_bytes %d discarded_printf %d]\n",
- ntoh32(hdr.discarded_bytes),
- ntoh32(hdr.discarded_printf));
+ be32_to_cpu(hdr.discarded_bytes),
+ be32_to_cpu(hdr.discarded_printf)));
}
- nblost = ntoh32(hdr.seqnum) - seqnum_prev - 1;
+ nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
if (nblost > 0) {
- printf
+ DHD_ERROR(
("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
- ntoh32(hdr.seqnum), nblost);
+ be32_to_cpu(hdr.seqnum), nblost));
}
- seqnum_prev = ntoh32(hdr.seqnum);
+ seqnum_prev = be32_to_cpu(hdr.seqnum);
/* Display the trace buffer. Advance from \n to \n to
* avoid display big
@@ -790,10 +769,10 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
p = (char *)&buf[MSGTRACE_HDRLEN];
while ((s = strstr(p, "\n")) != NULL) {
*s = '\0';
- printf("%s\n", p);
+ printk(KERN_DEBUG"%s\n", p);
p = s + 1;
}
- printf("%s\n", p);
+ printk(KERN_DEBUG "%s\n", p);
/* Reset datalen to avoid display below */
datalen = 0;
@@ -802,7 +781,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
case WLC_E_RSSI:
DHD_EVENT(("MACEVENT: %s %d\n", event_name,
- ntoh32(*((int *)event_data))));
+ be32_to_cpu(*((int *)event_data))));
break;
default:
@@ -840,7 +819,7 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
}
/* BRCM event pkt may be unaligned - use xxx_ua to load user_subtype. */
- if (ntoh16_ua((void *)&pvt_data->bcm_hdr.usr_subtype) !=
+ if (get_unaligned_be16(&pvt_data->bcm_hdr.usr_subtype) !=
BCMILCP_BCM_SUBTYPE_EVENT) {
DHD_ERROR(("%s: mismatched subtype, bailing\n", __func__));
return BCME_ERROR;
@@ -852,10 +831,10 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
/* memcpy since BRCM event pkt may be unaligned. */
memcpy(event, &pvt_data->event, sizeof(wl_event_msg_t));
- type = ntoh32_ua((void *)&event->event_type);
- flags = ntoh16_ua((void *)&event->flags);
- status = ntoh32_ua((void *)&event->status);
- evlen = ntoh32_ua((void *)&event->datalen) + sizeof(bcm_event_t);
+ type = get_unaligned_be32(&event->event_type);
+ flags = get_unaligned_be16(&event->flags);
+ status = get_unaligned_be32(&event->status);
+ evlen = get_unaligned_be32(&event->datalen) + sizeof(bcm_event_t);
switch (type) {
case WLC_E_IF:
@@ -868,7 +847,7 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
if (ifevent->action == WLC_E_IF_ADD)
dhd_add_if(dhd, ifevent->ifidx,
NULL, event->ifname,
- pvt_data->eth.ether_dhost,
+ pvt_data->eth.h_dest,
ifevent->flags,
ifevent->bssidx);
else
@@ -909,10 +888,10 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
if (type == WLC_E_NDIS_LINK) {
u32 temp;
- temp = ntoh32_ua((void *)&event->event_type);
+ temp = get_unaligned_be32(&event->event_type);
DHD_TRACE(("Converted to WLC_E_LINK type %d\n", temp));
- temp = ntoh32(WLC_E_NDIS_LINK);
+ temp = be32_to_cpu(WLC_E_NDIS_LINK);
memcpy((void *)(&pvt_data->event.event_type), &temp,
sizeof(pvt_data->event.event_type));
}
@@ -926,42 +905,6 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
return BCME_OK;
}
-void wl_event_to_host_order(wl_event_msg_t *evt)
-{
- /* Event struct members passed from dongle to host are stored
- * in network
- * byte order. Convert all members to host-order.
- */
- evt->event_type = ntoh32(evt->event_type);
- evt->flags = ntoh16(evt->flags);
- evt->status = ntoh32(evt->status);
- evt->reason = ntoh32(evt->reason);
- evt->auth_type = ntoh32(evt->auth_type);
- evt->datalen = ntoh32(evt->datalen);
- evt->version = ntoh16(evt->version);
-}
-
-void print_buf(void *pbuf, int len, int bytes_per_line)
-{
- int i, j = 0;
- unsigned char *buf = pbuf;
-
- if (bytes_per_line == 0)
- bytes_per_line = len;
-
- for (i = 0; i < len; i++) {
- printf("%2.2x", *buf++);
- j++;
- if (j == bytes_per_line) {
- printf("\n");
- j = 0;
- } else {
- printf(":");
- }
- }
- printf("\n");
-}
-
/* Convert user's input in hex pattern to byte-size mask */
static int wl_pattern_atoh(char *src, char *dst)
{
@@ -1025,10 +968,10 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
pkt_filterp = (wl_pkt_filter_enable_t *) (buf + str_len + 1);
/* Parse packet filter id. */
- enable_parm.id = htod32(simple_strtoul(argv[i], NULL, 0));
+ enable_parm.id = simple_strtoul(argv[i], NULL, 0);
/* Parse enable/disable value. */
- enable_parm.enable = htod32(enable);
+ enable_parm.enable = enable;
buf_len += sizeof(enable_parm);
memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm));
@@ -1053,8 +996,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
__func__, arg, rc));
fail:
- if (arg_org)
- kfree(arg_org);
+ kfree(arg_org);
}
void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
@@ -1113,7 +1055,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1);
/* Parse packet filter id. */
- pkt_filter.id = htod32(simple_strtoul(argv[i], NULL, 0));
+ pkt_filter.id = simple_strtoul(argv[i], NULL, 0);
if (NULL == argv[++i]) {
DHD_ERROR(("Polarity not provided\n"));
@@ -1121,7 +1063,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
}
/* Parse filter polarity. */
- pkt_filter.negate_match = htod32(simple_strtoul(argv[i], NULL, 0));
+ pkt_filter.negate_match = simple_strtoul(argv[i], NULL, 0);
if (NULL == argv[++i]) {
DHD_ERROR(("Filter type not provided\n"));
@@ -1129,7 +1071,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
}
/* Parse filter type. */
- pkt_filter.type = htod32(simple_strtoul(argv[i], NULL, 0));
+ pkt_filter.type = simple_strtoul(argv[i], NULL, 0);
if (NULL == argv[++i]) {
DHD_ERROR(("Offset not provided\n"));
@@ -1137,7 +1079,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
}
/* Parse pattern filter offset. */
- pkt_filter.u.pattern.offset = htod32(simple_strtoul(argv[i], NULL, 0));
+ pkt_filter.u.pattern.offset = simple_strtoul(argv[i], NULL, 0);
if (NULL == argv[++i]) {
DHD_ERROR(("Bitmask not provided\n"));
@@ -1146,8 +1088,8 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
/* Parse pattern filter mask. */
mask_size =
- htod32(wl_pattern_atoh
- (argv[i], (char *)pkt_filterp->u.pattern.mask_and_pattern));
+ wl_pattern_atoh
+ (argv[i], (char *)pkt_filterp->u.pattern.mask_and_pattern);
if (NULL == argv[++i]) {
DHD_ERROR(("Pattern not provided\n"));
@@ -1156,9 +1098,9 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
/* Parse pattern filter pattern. */
pattern_size =
- htod32(wl_pattern_atoh(argv[i],
+ wl_pattern_atoh(argv[i],
(char *)&pkt_filterp->u.pattern.
- mask_and_pattern[mask_size]));
+ mask_and_pattern[mask_size]);
if (mask_size != pattern_size) {
DHD_ERROR(("Mask and pattern not the same size\n"));
@@ -1189,11 +1131,9 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
__func__, arg));
fail:
- if (arg_org)
- kfree(arg_org);
+ kfree(arg_org);
- if (buf)
- kfree(buf);
+ kfree(buf);
}
void dhd_arp_offload_set(dhd_pub_t *dhd, int arp_mode)
@@ -1242,7 +1182,7 @@ int dhd_preinit_ioctls(dhd_pub_t *dhd)
int scan_unassoc_time = 40;
#ifdef GET_CUSTOM_MAC_ENABLE
int ret = 0;
- struct ether_addr ea_addr;
+ u8 ea_addr[ETH_ALEN];
#endif /* GET_CUSTOM_MAC_ENABLE */
dhd_os_proto_block(dhd);
@@ -1254,9 +1194,9 @@ int dhd_preinit_ioctls(dhd_pub_t *dhd)
** firmware but unique per board mac address maybe provided by
** customer code
*/
- ret = dhd_custom_get_mac_address(ea_addr.octet);
+ ret = dhd_custom_get_mac_address(ea_addr);
if (!ret) {
- bcm_mkiovar("cur_etheraddr", (void *)&ea_addr, ETH_ALEN,
+ bcm_mkiovar("cur_etheraddr", (void *)ea_addr, ETH_ALEN,
buf, sizeof(buf));
ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf));
if (ret < 0) {
@@ -1478,8 +1418,7 @@ int dhd_iscan_print_cache(iscan_buf_t *iscan_skip)
bi->BSSID.octet[2], bi->BSSID.octet[3],
bi->BSSID.octet[4], bi->BSSID.octet[5]));
- bi = (wl_bss_info_t *)((unsigned long)bi +
- dtoh32(bi->length));
+ bi = (wl_bss_info_t *)((unsigned long)bi + bi->length);
}
iscan_cur = iscan_cur->next;
l++;
@@ -1543,18 +1482,16 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip)
bi->BSSID.octet[5]));
bi_new = bi;
- bi = (wl_bss_info_t *)((unsigned long)bi +
- dtoh32
- (bi->length));
+ bi = (wl_bss_info_t *)((unsigned long)
+ bi + bi->length);
/*
if(bi && bi_new) {
- bcopy(bi, bi_new, results->buflen -
- dtoh32(bi_new->length));
- results->buflen -= dtoh32(bi_new->length);
+ memcpy(bi_new, bi, results->buflen -
+ bi_new->length);
+ results->buflen -= bi_new->length;
}
*/
- results->buflen -=
- dtoh32(bi_new->length);
+ results->buflen -= bi_new->length;
results->count--;
for (j = i; j < results->count; j++) {
@@ -1570,16 +1507,13 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip)
bi_next =
(wl_bss_info_t *)((unsigned long)bi +
- dtoh32
- (bi->length));
- bcopy(bi, bi_new,
- dtoh32
- (bi->length));
+ bi->length);
+ memcpy(bi_new, bi,
+ bi->length);
bi_new =
(wl_bss_info_t *)((unsigned long)bi_new +
- dtoh32
- (bi_new->
- length));
+ bi_new->
+ length);
bi = bi_next;
}
}
@@ -1594,7 +1528,7 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip)
break;
}
bi = (wl_bss_info_t *)((unsigned long)bi +
- dtoh32(bi->length));
+ bi->length);
}
}
iscan_cur = iscan_cur->next;
@@ -1648,7 +1582,7 @@ int dhd_iscan_remove_duplicates(void *dhdp, iscan_buf_t *iscan_cur)
dhd_iscan_delete_bss(dhdp, bi->BSSID.octet, iscan_cur);
- bi = (wl_bss_info_t *)((unsigned long)bi + dtoh32(bi->length));
+ bi = (wl_bss_info_t *)((unsigned long)bi + bi->length);
}
done:
@@ -1677,15 +1611,15 @@ int dhd_iscan_request(void *dhdp, u16 action)
params.params.bss_type = DOT11_BSSTYPE_ANY;
params.params.scan_type = DOT11_SCANTYPE_ACTIVE;
- params.params.nprobes = htod32(-1);
- params.params.active_time = htod32(-1);
- params.params.passive_time = htod32(-1);
- params.params.home_time = htod32(-1);
- params.params.channel_num = htod32(0);
+ params.params.nprobes = -1;
+ params.params.active_time = -1;
+ params.params.passive_time = -1;
+ params.params.home_time = -1;
+ params.params.channel_num = 0;
- params.version = htod32(ISCAN_REQ_VERSION);
- params.action = htod16(action);
- params.scan_duration = htod16(0);
+ params.version = ISCAN_REQ_VERSION;
+ params.action = action;
+ params.scan_duration = 0;
bcm_mkiovar("iscan", (char *)&params, sizeof(wl_iscan_params_t), buf,
WLC_IOCTL_SMLEN);
@@ -1722,16 +1656,16 @@ static int dhd_iscan_get_partial_result(void *dhdp, uint *scan_count)
results->count = 0;
memset(&list, 0, sizeof(list));
- list.results.buflen = htod32(WLC_IW_ISCAN_MAXLEN);
+ list.results.buflen = WLC_IW_ISCAN_MAXLEN;
bcm_mkiovar("iscanresults", (char *)&list, WL_ISCAN_RESULTS_FIXED_SIZE,
iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN);
rc = dhd_wl_ioctl(dhdp, WLC_GET_VAR, iscan_cur->iscan_buf,
WLC_IW_ISCAN_MAXLEN);
- results->buflen = dtoh32(results->buflen);
- results->version = dtoh32(results->version);
- *scan_count = results->count = dtoh32(results->count);
- status = dtoh32(list_buf->status);
+ results->buflen = results->buflen;
+ results->version = results->version;
+ *scan_count = results->count = results->count;
+ status = list_buf->status;
dhd_iscan_unlock();
@@ -1854,12 +1788,12 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc
memset(&pfn_element, 0, sizeof(pfn_element));
/* set pfn parameters */
- pfn_param.version = htod32(PFN_VERSION);
- pfn_param.flags = htod16((PFN_LIST_ORDER << SORT_CRITERIA_BIT));
+ pfn_param.version = PFN_VERSION;
+ pfn_param.flags = (PFN_LIST_ORDER << SORT_CRITERIA_BIT);
/* set up pno scan fr */
if (scan_fr != 0)
- pfn_param.scan_freq = htod32(scan_fr);
+ pfn_param.scan_freq = scan_fr;
bcm_mkiovar("pfn_set", (char *)&pfn_param, sizeof(pfn_param), iovbuf,
sizeof(iovbuf));
@@ -1868,11 +1802,11 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc
/* set all pfn ssid */
for (i = 0; i < nssid; i++) {
- pfn_element.bss_type = htod32(DOT11_BSSTYPE_INFRASTRUCTURE);
- pfn_element.auth = (DOT11_OPEN_SYSTEM);
- pfn_element.wpa_auth = htod32(WPA_AUTH_PFN_ANY);
- pfn_element.wsec = htod32(0);
- pfn_element.infra = htod32(1);
+ pfn_element.bss_type = DOT11_BSSTYPE_INFRASTRUCTURE;
+ pfn_element.auth = WLAN_AUTH_OPEN;
+ pfn_element.wpa_auth = WPA_AUTH_PFN_ANY;
+ pfn_element.wsec = 0;
+ pfn_element.infra = 1;
memcpy((char *)pfn_element.ssid.SSID, ssids_local[i].SSID,
ssids_local[i].SSID_len);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c b/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c
index c3f18bb3b27c..cbfa1c1b7059 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c
@@ -15,7 +15,6 @@
*/
#include <linux/netdevice.h>
-#include <osl.h>
#include <bcmutils.h>
#include <dngl_stats.h>
@@ -149,9 +148,8 @@ int dhd_custom_get_mac_address(unsigned char *buf)
#ifdef EXAMPLE_GET_MAC
/* EXAMPLE code */
{
- struct ether_addr ea_example = {
- {0x00, 0x11, 0x22, 0x33, 0x44, 0xFF} };
- bcopy((char *)&ea_example, buf, sizeof(struct ether_addr));
+ u8 ea_example[ETH_ALEN] = {0x00, 0x11, 0x22, 0x33, 0x44, 0xFF};
+ memcpy(buf, ea_example, ETH_ALEN);
}
#endif /* EXAMPLE_GET_MAC */
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_dbg.h b/drivers/staging/brcm80211/brcmfmac/dhd_dbg.h
index cd2578ad3552..0817f1348e09 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_dbg.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_dbg.h
@@ -21,31 +21,31 @@
#define DHD_ERROR(args) \
do {if ((dhd_msg_level & DHD_ERROR_VAL) && (net_ratelimit())) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_CTL(args) do {if (dhd_msg_level & DHD_CTL_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_TIMER(args) do {if (dhd_msg_level & DHD_TIMER_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_HDRS(args) do {if (dhd_msg_level & DHD_HDRS_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_BYTES(args) do {if (dhd_msg_level & DHD_BYTES_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_INTR(args) do {if (dhd_msg_level & DHD_INTR_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_GLOM(args) do {if (dhd_msg_level & DHD_GLOM_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_EVENT(args) do {if (dhd_msg_level & DHD_EVENT_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_BTA(args) do {if (dhd_msg_level & DHD_BTA_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_ISCAN(args) do {if (dhd_msg_level & DHD_ISCAN_VAL) \
- printf args; } while (0)
+ printk args; } while (0)
#define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL)
#define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL)
@@ -63,7 +63,7 @@
#else /* (defined BCMDBG) || (defined DHD_DEBUG) */
-#define DHD_ERROR(args) do {if (net_ratelimit()) printf args; } while (0)
+#define DHD_ERROR(args) do {if (net_ratelimit()) printk args; } while (0)
#define DHD_TRACE(args)
#define DHD_INFO(args)
#define DHD_DATA(args)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index db4508378775..02c6d446934c 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -32,11 +32,8 @@
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <bcmdefs.h>
-#include <osl.h>
#include <bcmutils.h>
-#include <bcmendian.h>
-#include <proto/ethernet.h>
#include <dngl_stats.h>
#include <dhd.h>
#include <dhd_bus.h>
@@ -45,7 +42,8 @@
#include <wl_cfg80211.h>
-#define EPI_VERSION_STR "4.218.248.5"
+#define EPI_VERSION_STR "4.218.248.5"
+#define ETH_P_BRCM 0x886c
#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
#include <linux/wifi_tiwlan.h>
@@ -149,7 +147,7 @@ static struct platform_driver wifi_device = {
.suspend = wifi_suspend,
.resume = wifi_resume,
.driver = {
- .name = "bcm4329_wlan",
+ .name = KBUILD_MODNAME,
}
};
@@ -247,7 +245,7 @@ typedef struct dhd_info {
struct semaphore sysioc_sem;
bool set_multicast;
bool set_macaddress;
- struct ether_addr macvalue;
+ u8 macvalue[ETH_ALEN];
wait_queue_head_t ctrl_wait;
atomic_t pend_8021x_cnt;
@@ -387,12 +385,6 @@ module_param(dhd_pktgen_len, uint, 0);
#define DHD_COMPILED
#endif
-static char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR
-#ifdef DHD_DEBUG
-"\nCompiled in " " on " __DATE__ " at " __TIME__
-#endif
-;
-
#if defined(CONFIG_WIRELESS_EXT)
struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev);
#endif /* defined(CONFIG_WIRELESS_EXT) */
@@ -719,7 +711,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
strcpy(bufp, "mcast_list");
bufp += strlen("mcast_list") + 1;
- cnt = htol32(cnt);
+ cnt = cpu_to_le32(cnt);
memcpy(bufp, &cnt, sizeof(cnt));
bufp += sizeof(cnt);
@@ -758,7 +750,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
dhd_ifname(&dhd->pub, ifidx)));
return;
}
- allmulti = htol32(allmulti);
+ allmulti = cpu_to_le32(allmulti);
if (!bcm_mkiovar
("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {
@@ -778,7 +770,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
DHD_ERROR(("%s: set allmulti %d failed\n",
- dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti)));
+ dhd_ifname(&dhd->pub, ifidx),
+ le32_to_cpu(allmulti)));
}
kfree(buf);
@@ -787,7 +780,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
driver does */
allmulti = (dev->flags & IFF_PROMISC) ? true : false;
- allmulti = htol32(allmulti);
+ allmulti = cpu_to_le32(allmulti);
memset(&ioc, 0, sizeof(ioc));
ioc.cmd = WLC_SET_PROMISC;
@@ -798,12 +791,13 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
DHD_ERROR(("%s: set promisc %d failed\n",
- dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti)));
+ dhd_ifname(&dhd->pub, ifidx),
+ le32_to_cpu(allmulti)));
}
}
static int
-_dhd_set_mac_address(dhd_info_t *dhd, int ifidx, struct ether_addr *addr)
+_dhd_set_mac_address(dhd_info_t *dhd, int ifidx, u8 *addr)
{
char buf[32];
wl_ioctl_t ioc;
@@ -976,7 +970,7 @@ static int _dhd_sysioc_thread(void *data)
if (dhd->set_macaddress) {
dhd->set_macaddress = false;
_dhd_set_mac_address(dhd, i,
- &dhd->macvalue);
+ dhd->macvalue);
}
}
}
@@ -1030,11 +1024,11 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
/* Update multicast statistic */
if (pktbuf->len >= ETH_ALEN) {
u8 *pktdata = (u8 *) (pktbuf->data);
- struct ether_header *eh = (struct ether_header *)pktdata;
+ struct ethhdr *eh = (struct ethhdr *)pktdata;
- if (is_multicast_ether_addr(eh->ether_dhost))
+ if (is_multicast_ether_addr(eh->h_dest))
dhdp->tx_multicast++;
- if (ntoh16(eh->ether_type) == ETH_P_PAE)
+ if (ntohs(eh->h_proto) == ETH_P_PAE)
atomic_inc(&dhd->pend_8021x_cnt);
}
@@ -1045,7 +1039,6 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
#ifdef BCMDBUS
ret = dbus_send_pkt(dhdp->dbus, pktbuf, NULL /* pktinfo */);
#else
- WAKE_LOCK_TIMEOUT(dhdp, WAKE_LOCK_TMOUT, 25);
ret = dhd_bus_txdata(dhdp->bus, pktbuf);
#endif /* BCMDBUS */
@@ -1053,30 +1046,20 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
}
static inline void *
-osl_pkt_frmnative(struct osl_info *osh, struct sk_buff *skb)
+osl_pkt_frmnative(struct sk_buff *skb)
{
- struct sk_buff *nskb;
-
- for (nskb = skb; nskb; nskb = nskb->next)
- osh->pktalloced++;
-
return (void *)skb;
}
#define PKTFRMNATIVE(osh, skb) \
- osl_pkt_frmnative((osh), (struct sk_buff *)(skb))
+ osl_pkt_frmnative((struct sk_buff *)(skb))
static inline struct sk_buff *
-osl_pkt_tonative(struct osl_info *osh, void *pkt)
+osl_pkt_tonative(void *pkt)
{
- struct sk_buff *nskb;
-
- for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next)
- osh->pktalloced--;
-
return (struct sk_buff *)pkt;
}
#define PKTTONATIVE(osh, pkt) \
- osl_pkt_tonative((osh), (pkt))
+ osl_pkt_tonative((pkt))
static int dhd_start_xmit(struct sk_buff *skb, struct net_device *net)
{
@@ -1215,7 +1198,7 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf,
skb_pull(skb, ETH_HLEN);
/* Process special event packets and then discard them */
- if (ntoh16(skb->protocol) == ETHER_TYPE_BRCM)
+ if (ntohs(skb->protocol) == ETH_P_BRCM)
dhd_wl_host_event(dhd, &ifidx,
skb_mac_header(skb),
&event, &data);
@@ -1254,13 +1237,13 @@ void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success)
{
uint ifidx;
dhd_info_t *dhd = (dhd_info_t *) (dhdp->info);
- struct ether_header *eh;
+ struct ethhdr *eh;
u16 type;
dhd_prot_hdrpull(dhdp, &ifidx, txp);
- eh = (struct ether_header *)(txp->data);
- type = ntoh16(eh->ether_type);
+ eh = (struct ethhdr *)(txp->data);
+ type = ntohs(eh->h_proto);
if (type == ETH_P_PAE)
atomic_dec(&dhd->pend_8021x_cnt);
@@ -1304,7 +1287,6 @@ static struct net_device_stats *dhd_get_stats(struct net_device *net)
static int dhd_watchdog_thread(void *data)
{
dhd_info_t *dhd = (dhd_info_t *) data;
- WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_WATCHDOG, "dhd_watchdog_thread");
/* This thread doesn't need any user-level access,
* so get rid of all our resources
@@ -1325,18 +1307,14 @@ static int dhd_watchdog_thread(void *data)
break;
if (down_interruptible(&dhd->watchdog_sem) == 0) {
if (dhd->pub.dongle_reset == false) {
- WAKE_LOCK(&dhd->pub, WAKE_LOCK_WATCHDOG);
/* Call the bus module watchdog */
dhd_bus_watchdog(&dhd->pub);
- WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_WATCHDOG);
}
/* Count the tick for reference */
dhd->pub.tickcnt++;
} else
break;
}
-
- WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_WATCHDOG);
return 0;
}
@@ -1370,7 +1348,6 @@ static int dhd_dpc_thread(void *data)
{
dhd_info_t *dhd = (dhd_info_t *) data;
- WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_DPC, "dhd_dpc_thread");
/* This thread doesn't need any user-level access,
* so get rid of all our resources
*/
@@ -1393,21 +1370,15 @@ static int dhd_dpc_thread(void *data)
/* Call bus dpc unless it indicated down
(then clean stop) */
if (dhd->pub.busstate != DHD_BUS_DOWN) {
- WAKE_LOCK(&dhd->pub, WAKE_LOCK_DPC);
if (dhd_bus_dpc(dhd->pub.bus)) {
up(&dhd->dpc_sem);
- WAKE_LOCK_TIMEOUT(&dhd->pub,
- WAKE_LOCK_TMOUT, 25);
}
- WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_DPC);
} else {
dhd_bus_stop(dhd->pub.bus, true);
}
} else
break;
}
-
- WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_DPC);
return 0;
}
@@ -1797,22 +1768,16 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
if (is_set_key_cmd)
dhd_wait_pend8021x(net);
- WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_IOCTL, "dhd_ioctl_entry");
- WAKE_LOCK(&dhd->pub, WAKE_LOCK_IOCTL);
-
bcmerror =
dhd_prot_ioctl(&dhd->pub, ifidx, (wl_ioctl_t *)&ioc, buf, buflen);
- WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_IOCTL);
- WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_IOCTL);
done:
if (!bcmerror && buf && ioc.buf) {
if (copy_to_user(ioc.buf, buf, buflen))
bcmerror = -EFAULT;
}
- if (buf)
- kfree(buf);
+ kfree(buf);
if (bcmerror > 0)
bcmerror = 0;
@@ -1866,7 +1831,7 @@ static int dhd_open(struct net_device *net)
}
atomic_set(&dhd->pend_8021x_cnt, 0);
- memcpy(net->dev_addr, dhd->pub.mac.octet, ETH_ALEN);
+ memcpy(net->dev_addr, dhd->pub.mac, ETH_ALEN);
#ifdef TOE
/* Get current TOE mode from dongle */
@@ -1891,16 +1856,6 @@ static int dhd_open(struct net_device *net)
return ret;
}
-struct osl_info *dhd_osl_attach(void *pdev, uint bustype)
-{
- return osl_attach(pdev, bustype);
-}
-
-void dhd_osl_detach(struct osl_info *osh)
-{
- osl_detach(osh);
-}
-
int
dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name,
u8 *mac_addr, u32 flags, u8 bssidx)
@@ -1954,8 +1909,7 @@ void dhd_del_if(dhd_info_t *dhd, int ifidx)
up(&dhd->sysioc_sem);
}
-dhd_pub_t *dhd_attach(struct osl_info *osh, struct dhd_bus *bus,
- uint bus_hdrlen)
+dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen)
{
dhd_info_t *dhd = NULL;
struct net_device *net;
@@ -1976,19 +1930,16 @@ dhd_pub_t *dhd_attach(struct osl_info *osh, struct dhd_bus *bus,
}
/* Allocate primary dhd_info */
- dhd = kmalloc(sizeof(dhd_info_t), GFP_ATOMIC);
+ dhd = kzalloc(sizeof(dhd_info_t), GFP_ATOMIC);
if (!dhd) {
DHD_ERROR(("%s: OOM - alloc dhd_info\n", __func__));
goto fail;
}
- memset(dhd, 0, sizeof(dhd_info_t));
-
/*
* Save the dhd_info into the priv
*/
memcpy(netdev_priv(net), &dhd, sizeof(dhd));
- dhd->pub.osh = osh;
/* Set network interface name if it was provided as module parameter */
if (iface_name[0]) {
@@ -2115,11 +2066,6 @@ dhd_pub_t *dhd_attach(struct osl_info *osh, struct dhd_bus *bus,
#endif /* defined(CONFIG_PM_SLEEP) */
/* && defined(DHD_GPL) */
/* Init lock suspend to prevent kernel going to suspend */
- WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_TMOUT, "dhd_wake_lock");
- WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_LINK_DOWN_TMOUT,
- "dhd_wake_lock_link_dw_event");
- WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_PNO_FIND_TMOUT,
- "dhd_wake_lock_link_pno_find_event");
#ifdef CONFIG_HAS_EARLYSUSPEND
dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20;
dhd->early_suspend.suspend = dhd_early_suspend;
@@ -2153,20 +2099,13 @@ int dhd_bus_start(dhd_pub_t *dhdp)
/* try to download image and nvram to the dongle */
if (dhd->pub.busstate == DHD_BUS_DOWN) {
- WAKE_LOCK_INIT(dhdp, WAKE_LOCK_DOWNLOAD, "dhd_bus_start");
- WAKE_LOCK(dhdp, WAKE_LOCK_DOWNLOAD);
- if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh,
+ if (!(dhd_bus_download_firmware(dhd->pub.bus,
fw_path, nv_path))) {
DHD_ERROR(("%s: dhdsdio_probe_download failed. "
"firmware = %s nvram = %s\n",
__func__, fw_path, nv_path));
- WAKE_UNLOCK(dhdp, WAKE_LOCK_DOWNLOAD);
- WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_DOWNLOAD);
return -1;
}
-
- WAKE_UNLOCK(dhdp, WAKE_LOCK_DOWNLOAD);
- WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_DOWNLOAD);
}
/* Start the watchdog timer */
@@ -2203,7 +2142,7 @@ int dhd_bus_start(dhd_pub_t *dhdp)
bcm_mkiovar("event_msgs", dhdp->eventmask, WL_EVENTING_MASK_LEN, iovbuf,
sizeof(iovbuf));
dhdcdc_query_ioctl(dhdp, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf));
- bcopy(iovbuf, dhdp->eventmask, WL_EVENTING_MASK_LEN);
+ memcpy(dhdp->eventmask, iovbuf, WL_EVENTING_MASK_LEN);
setbit(dhdp->eventmask, WLC_E_SET_SSID);
setbit(dhdp->eventmask, WLC_E_PRUNE);
@@ -2299,7 +2238,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
*/
if (ifidx != 0) {
/* for virtual interfaces use the primary MAC */
- memcpy(temp_addr, dhd->pub.mac.octet, ETH_ALEN);
+ memcpy(temp_addr, dhd->pub.mac, ETH_ALEN);
}
@@ -2335,7 +2274,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
goto fail;
}
- printf("%s: Broadcom Dongle Host Driver\n", net->name);
+ DHD_INFO(("%s: Broadcom Dongle Host Driver\n", net->name));
return 0;
@@ -2432,9 +2371,6 @@ void dhd_detach(dhd_pub_t *dhdp)
unregister_pm_notifier(&dhd_sleep_pm_notifier);
#endif /* defined(CONFIG_PM_SLEEP) */
/* && defined(DHD_GPL) */
- WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_TMOUT);
- WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_LINK_DOWN_TMOUT);
- WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_PNO_FIND_TMOUT);
free_netdev(ifp->net);
kfree(ifp);
kfree(dhd);
@@ -2483,7 +2419,7 @@ static int __init dhd_module_init(void)
error = wifi_add_dev();
if (error) {
DHD_ERROR(("%s: platform_driver_register failed\n", __func__));
- goto faild;
+ goto failed;
}
/* Waiting callback after platform_driver_register is done or
@@ -2493,21 +2429,19 @@ static int __init dhd_module_init(void)
__func__);
/* remove device */
wifi_del_dev();
- goto faild;
+ goto failed;
}
#endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
error = dhd_bus_register();
- if (!error)
- printf("\n%s\n", dhd_version);
- else {
+ if (error) {
DHD_ERROR(("%s: sdio_register_driver failed\n", __func__));
- goto faild;
+ goto failed;
}
return error;
-faild:
+failed:
/* turn off power and exit */
dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
return -EINVAL;
@@ -2790,7 +2724,7 @@ dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
/* send up locally generated event */
void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data)
{
- switch (ntoh32(event->event_type)) {
+ switch (be32_to_cpu(event->event_type)) {
default:
break;
}
@@ -2975,7 +2909,7 @@ int write_to_file(dhd_pub_t *dhd, u8 *buf, int size)
/* open file to write */
fp = filp_open("/tmp/mem_dump", O_WRONLY | O_CREAT, 0640);
if (!fp) {
- printf("%s: open file error\n", __func__);
+ DHD_ERROR(("%s: open file error\n", __func__));
ret = -1;
goto exit;
}
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_proto.h b/drivers/staging/brcm80211/brcmfmac/dhd_proto.h
index a5309e27b65b..030d5ffb0e83 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_proto.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_proto.h
@@ -46,9 +46,6 @@ extern int dhd_prot_init(dhd_pub_t *dhdp);
/* Stop protocol: sync w/dongle state. */
extern void dhd_prot_stop(dhd_pub_t *dhdp);
-extern bool dhd_proto_fcinfo(dhd_pub_t *dhd, struct sk_buff *pktbuf,
- u8 *fcbits);
-
/* Add any protocol-specific data header.
* Caller must reserve prot_hdrlen prepend space.
*/
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 3edce44978a1..106627040db0 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -17,7 +17,6 @@
#include <linux/types.h>
#include <bcmdefs.h>
#include <linux/netdevice.h>
-#include <osl.h>
#include <bcmsdh.h>
#ifdef BCMEMBEDIMAGE
@@ -26,7 +25,6 @@
#include <bcmdefs.h>
#include <bcmutils.h>
-#include <bcmendian.h>
#include <bcmdevs.h>
#include <siutils.h>
@@ -44,8 +42,6 @@
#include <sbsdpcmdev.h>
#include <bcmsdpcm.h>
-#include <proto/ethernet.h>
-#include <proto/802.1d.h>
#include <proto/802.11.h>
#include <dngl_stats.h>
@@ -61,9 +57,9 @@
#define DHDSDIO_MEM_DUMP_FNAME "mem_dump"
#endif
-#define QLEN 256 /* bulk rx and tx queue lengths */
-#define FCHI (QLEN - 10)
-#define FCLOW (FCHI / 2)
+#define TXQLEN 2048 /* bulk tx queue length */
+#define TXHI (TXQLEN - 256) /* turn on flow control above TXHI */
+#define TXLOW (TXHI - 256) /* turn off flow control below TXLOW */
#define PRIOMASK 7
#define TXRETRIES 2 /* # of retries for tx frames */
@@ -144,7 +140,15 @@
* bufpool was present for gspi bus.
*/
#define PKTFREE2() if ((bus->bus != SPI_BUS) || bus->usebufpool) \
- pkt_buf_free_skb(bus->dhd->osh, pkt, false);
+ pkt_buf_free_skb(pkt);
+
+/*
+ * Conversion of 802.1D priority to precedence level
+ */
+#define PRIO2PREC(prio) \
+ (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? \
+ ((prio^2)) : (prio))
+
DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep);
extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
uint len);
@@ -329,7 +333,6 @@ uint dhd_txminmax;
#define DONGLE_MIN_MEMSIZE (128 * 1024)
int dhd_dongle_memsize;
-static bool dhd_doflow;
static bool dhd_alignctl;
static bool sd1idle;
@@ -357,7 +360,7 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable);
#if defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD)
#error OOB_INTR_ONLY is NOT working with SDIO_ISR_THREAD
#endif /* defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) */
-#define PKTALIGN(_osh, _p, _len, _align) \
+#define PKTALIGN(_p, _len, _align) \
do { \
uint datalign; \
datalign = (unsigned long)((_p)->data); \
@@ -386,7 +389,7 @@ static bool dhd_readahead;
do { \
retryvar = 0; \
do { \
- regvar = R_REG(bus->dhd->osh, regaddr); \
+ regvar = R_REG(regaddr); \
} while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \
if (retryvar) { \
bus->regfails += (retryvar-1); \
@@ -402,7 +405,7 @@ do { \
do { \
retryvar = 0; \
do { \
- W_REG(bus->dhd->osh, regaddr, regval); \
+ W_REG(regaddr, regval); \
} while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \
if (retryvar) { \
bus->regfails += (retryvar-1); \
@@ -431,16 +434,15 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus);
#endif /* DHD_DEBUG */
static int dhdsdio_download_state(dhd_bus_t *bus, bool enter);
-static void dhdsdio_release(dhd_bus_t *bus, struct osl_info *osh);
-static void dhdsdio_release_malloc(dhd_bus_t *bus, struct osl_info *osh);
+static void dhdsdio_release(dhd_bus_t *bus);
+static void dhdsdio_release_malloc(dhd_bus_t *bus);
static void dhdsdio_disconnect(void *ptr);
static bool dhdsdio_chipmatch(u16 chipid);
-static bool dhdsdio_probe_attach(dhd_bus_t *bus, struct osl_info *osh,
- void *sdh, void *regsva, u16 devid);
-static bool dhdsdio_probe_malloc(dhd_bus_t *bus, struct osl_info *osh,
- void *sdh);
-static bool dhdsdio_probe_init(dhd_bus_t *bus, struct osl_info *osh, void *sdh);
-static void dhdsdio_release_dongle(dhd_bus_t *bus, struct osl_info * osh);
+static bool dhdsdio_probe_attach(dhd_bus_t *bus, void *sdh,
+ void *regsva, u16 devid);
+static bool dhdsdio_probe_malloc(dhd_bus_t *bus, void *sdh);
+static bool dhdsdio_probe_init(dhd_bus_t *bus, void *sdh);
+static void dhdsdio_release_dongle(dhd_bus_t *bus);
static uint process_nvram_vars(char *varbuf, uint len);
@@ -454,8 +456,7 @@ static int dhd_bcmsdh_send_buf(dhd_bus_t *bus, u32 addr, uint fn,
struct sk_buff *pkt, bcmsdh_cmplt_fn_t complete,
void *handle);
-static bool dhdsdio_download_firmware(struct dhd_bus *bus, struct osl_info *osh,
- void *sdh);
+static bool dhdsdio_download_firmware(struct dhd_bus *bus, void *sdh);
static int _dhdsdio_download_firmware(struct dhd_bus *bus);
static int dhdsdio_download_code_file(struct dhd_bus *bus, char *image_path);
@@ -908,7 +909,6 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
bool free_pkt)
{
int ret;
- struct osl_info *osh;
u8 *frame;
u16 len, pad = 0;
u32 swheader;
@@ -920,7 +920,6 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
DHD_TRACE(("%s: Enter\n", __func__));
sdh = bus->sdh;
- osh = bus->dhd->osh;
if (bus->dhd->dongle_reset) {
ret = BCME_NOTREADY;
@@ -936,7 +935,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
DHD_INFO(("%s: insufficient headroom %d for %d pad\n",
__func__, skb_headroom(pkt), pad));
bus->dhd->tx_realloc++;
- new = pkt_buf_get_skb(osh, (pkt->len + DHD_SDALIGN));
+ new = pkt_buf_get_skb(pkt->len + DHD_SDALIGN);
if (!new) {
DHD_ERROR(("%s: couldn't allocate new %d-byte "
"packet\n",
@@ -945,10 +944,10 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
goto done;
}
- PKTALIGN(osh, new, pkt->len, DHD_SDALIGN);
- bcopy(pkt->data, new->data, pkt->len);
+ PKTALIGN(new, pkt->len, DHD_SDALIGN);
+ memcpy(new->data, pkt->data, pkt->len);
if (free_pkt)
- pkt_buf_free_skb(osh, pkt, true);
+ pkt_buf_free_skb(pkt);
/* free the pkt if canned one is not used */
free_pkt = true;
pkt = new;
@@ -967,16 +966,17 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
len = (u16) (pkt->len);
- *(u16 *) frame = htol16(len);
- *(((u16 *) frame) + 1) = htol16(~len);
+ *(u16 *) frame = cpu_to_le16(len);
+ *(((u16 *) frame) + 1) = cpu_to_le16(~len);
/* Software tag: channel, sequence number, data offset */
swheader =
((chan << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK) | bus->tx_seq |
(((pad +
SDPCM_HDRLEN) << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK);
- htol32_ua_store(swheader, frame + SDPCM_FRAMETAG_LEN);
- htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
+
+ put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN);
+ put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
#ifdef DHD_DEBUG
tx_packets[pkt->priority]++;
@@ -1061,7 +1061,7 @@ done:
dhd_os_sdlock(bus->dhd);
if (free_pkt)
- pkt_buf_free_skb(osh, pkt, true);
+ pkt_buf_free_skb(pkt);
return ret;
}
@@ -1069,12 +1069,10 @@ done:
int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
{
int ret = BCME_ERROR;
- struct osl_info *osh;
uint datalen, prec;
DHD_TRACE(("%s: Enter\n", __func__));
- osh = bus->dhd->osh;
datalen = pkt->len;
#ifdef SDTEST
@@ -1112,7 +1110,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) {
skb_pull(pkt, SDPCM_HDRLEN);
dhd_txcomplete(bus->dhd, pkt, false);
- pkt_buf_free_skb(osh, pkt, true);
+ pkt_buf_free_skb(pkt);
DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));
ret = BCME_NORESOURCE;
} else {
@@ -1120,7 +1118,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
}
dhd_os_sdunlock_txq(bus->dhd);
- if ((pktq_len(&bus->txq) >= FCHI) && dhd_doflow)
+ if (pktq_len(&bus->txq) >= TXHI)
dhd_txflowcontrol(bus->dhd, 0, ON);
#ifdef DHD_DEBUG
@@ -1218,8 +1216,8 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes)
}
/* Deflow-control stack if needed */
- if (dhd_doflow && dhd->up && (dhd->busstate == DHD_BUS_DATA) &&
- dhd->txoff && (pktq_len(&bus->txq) < FCLOW))
+ if (dhd->up && (dhd->busstate == DHD_BUS_DATA) &&
+ dhd->txoff && (pktq_len(&bus->txq) < TXLOW))
dhd_txflowcontrol(dhd, 0, OFF);
return cnt;
@@ -1282,8 +1280,8 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
dhdsdio_clkctl(bus, CLK_AVAIL, false);
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
- *(u16 *) frame = htol16((u16) msglen);
- *(((u16 *) frame) + 1) = htol16(~msglen);
+ *(u16 *) frame = cpu_to_le16((u16) msglen);
+ *(((u16 *) frame) + 1) = cpu_to_le16(~msglen);
/* Software tag: channel, sequence number, data offset */
swheader =
@@ -1291,8 +1289,8 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
SDPCM_CHANNEL_MASK)
| bus->tx_seq | ((doff << SDPCM_DOFFSET_SHIFT) &
SDPCM_DOFFSET_MASK);
- htol32_ua_store(swheader, frame + SDPCM_FRAMETAG_LEN);
- htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
+ put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN);
+ put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
if (!DATAOK(bus)) {
DHD_INFO(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d\n",
@@ -1396,7 +1394,7 @@ int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
dhd_os_sdlock(bus->dhd);
rxlen = bus->rxlen;
- bcopy(bus->rxctl, msg, min(msglen, rxlen));
+ memcpy(msg, bus->rxctl, min(msglen, rxlen));
bus->rxlen = 0;
dhd_os_sdunlock(bus->dhd);
@@ -1659,7 +1657,7 @@ static int dhdsdio_pktgen_get(dhd_bus_t *bus, u8 *arg)
pktgen.mode = bus->pktgen_mode;
pktgen.stop = bus->pktgen_stop;
- bcopy(&pktgen, arg, sizeof(pktgen));
+ memcpy(arg, &pktgen, sizeof(pktgen));
return 0;
}
@@ -1669,7 +1667,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg)
dhd_pktgen_t pktgen;
uint oldcnt, oldmode;
- bcopy(arg, &pktgen, sizeof(pktgen));
+ memcpy(&pktgen, arg, sizeof(pktgen));
if (pktgen.version != DHD_PKTGEN_VERSION)
return BCME_BADARG;
@@ -1769,7 +1767,7 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
if (rv < 0)
return rv;
- addr = ltoh32(addr);
+ addr = le32_to_cpu(addr);
DHD_INFO(("sdpcm_shared address 0x%08X\n", addr));
@@ -1790,13 +1788,13 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
return rv;
/* Endianness */
- sh->flags = ltoh32(sh->flags);
- sh->trap_addr = ltoh32(sh->trap_addr);
- sh->assert_exp_addr = ltoh32(sh->assert_exp_addr);
- sh->assert_file_addr = ltoh32(sh->assert_file_addr);
- sh->assert_line = ltoh32(sh->assert_line);
- sh->console_addr = ltoh32(sh->console_addr);
- sh->msgtrace_addr = ltoh32(sh->msgtrace_addr);
+ sh->flags = le32_to_cpu(sh->flags);
+ sh->trap_addr = le32_to_cpu(sh->trap_addr);
+ sh->assert_exp_addr = le32_to_cpu(sh->assert_exp_addr);
+ sh->assert_file_addr = le32_to_cpu(sh->assert_file_addr);
+ sh->assert_line = le32_to_cpu(sh->assert_line);
+ sh->console_addr = le32_to_cpu(sh->console_addr);
+ sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr);
if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
DHD_ERROR(("%s: sdpcm_shared version %d in dhd "
@@ -1932,10 +1930,8 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size)
#endif /* DHD_DEBUG */
done:
- if (mbuffer)
- kfree(mbuffer);
- if (str)
- kfree(str);
+ kfree(mbuffer);
+ kfree(str);
return bcmerror;
}
@@ -1952,34 +1948,33 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus)
size = bus->ramsize;
buf = kmalloc(size, GFP_ATOMIC);
if (!buf) {
- printf("%s: Out of memory (%d bytes)\n", __func__, size);
+ DHD_ERROR(("%s: Out of memory (%d bytes)\n", __func__, size));
return -1;
}
/* Read mem content */
- printf("Dump dongle memory");
+ printk(KERN_DEBUG "Dump dongle memory");
databuf = buf;
while (size) {
read_size = min(MEMBLOCK, size);
ret = dhdsdio_membytes(bus, false, start, databuf, read_size);
if (ret) {
- printf("%s: Error membytes %d\n", __func__, ret);
- if (buf)
- kfree(buf);
+ DHD_ERROR(("%s: Error membytes %d\n", __func__, ret));
+ kfree(buf);
return -1;
}
- printf(".");
+ printk(".");
/* Decrement size and increment start address */
size -= read_size;
start += read_size;
databuf += read_size;
}
- printf("Done\n");
+ printk(KERN_DEBUG "Done\n");
/* free buf before return !!! */
if (write_to_file(bus->dhd, buf, bus->ramsize)) {
- printf("%s: Error writing to files\n", __func__);
+ DHD_ERROR(("%s: Error writing to files\n", __func__));
return -1;
}
@@ -2009,13 +2004,13 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
/* Allocate console buffer (one time only) */
if (c->buf == NULL) {
- c->bufsize = ltoh32(c->log.buf_size);
+ c->bufsize = le32_to_cpu(c->log.buf_size);
c->buf = kmalloc(c->bufsize, GFP_ATOMIC);
if (c->buf == NULL)
return BCME_NOMEM;
}
- idx = ltoh32(c->log.idx);
+ idx = le32_to_cpu(c->log.idx);
/* Protect against corrupt value */
if (idx > c->bufsize)
@@ -2027,7 +2022,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
return BCME_OK;
/* Read the console buffer */
- addr = ltoh32(c->log.buf);
+ addr = le32_to_cpu(c->log.buf);
rv = dhdsdio_membytes(bus, false, addr, c->buf, c->bufsize);
if (rv < 0)
return rv;
@@ -2057,7 +2052,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
if (line[n - 1] == '\r')
n--;
line[n] = 0;
- printf("CONSOLE: %s\n", line);
+ printk(KERN_DEBUG "CONSOLE: %s\n", line);
}
}
break2:
@@ -2083,8 +2078,7 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len)
}
/* Free the old ones and replace with passed variables */
- if (bus->vars)
- kfree(bus->vars);
+ kfree(bus->vars);
bus->vars = kmalloc(len, GFP_ATOMIC);
bus->varsz = bus->vars ? len : 0;
@@ -2095,7 +2089,7 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len)
/* Copy the passed variables, which should include the
terminating double-null */
- bcopy(arg, bus->vars, bus->varsz);
+ memcpy(bus->vars, arg, bus->varsz);
err:
return bcmerror;
}
@@ -2118,7 +2112,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
goto exit;
if (plen >= (int)sizeof(int_val))
- bcopy(params, &int_val, sizeof(int_val));
+ memcpy(&int_val, params, sizeof(int_val));
bool_val = (int_val != 0) ? true : false;
@@ -2138,7 +2132,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
bcmerror = dhdsdio_bussleep(bus, bool_val);
} else {
int_val = (s32) bus->sleeping;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
}
goto exit;
}
@@ -2152,7 +2146,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
switch (actionid) {
case IOV_GVAL(IOV_INTR):
int_val = (s32) bus->intr;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_INTR):
@@ -2173,7 +2167,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_POLLRATE):
int_val = (s32) bus->pollrate;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_POLLRATE):
@@ -2183,7 +2177,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_IDLETIME):
int_val = bus->idletime;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_IDLETIME):
@@ -2195,7 +2189,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_IDLECLOCK):
int_val = (s32) bus->idleclock;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_IDLECLOCK):
@@ -2204,7 +2198,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_SD1IDLE):
int_val = (s32) sd1idle;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_SD1IDLE):
@@ -2223,8 +2217,8 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
ASSERT(plen >= 2 * sizeof(int));
address = (u32) int_val;
- bcopy((char *)params + sizeof(int_val), &int_val,
- sizeof(int_val));
+ memcpy(&int_val, (char *)params + sizeof(int_val),
+ sizeof(int_val));
size = (uint) int_val;
/* Do some validation */
@@ -2267,17 +2261,17 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_MEMSIZE):
int_val = (s32) bus->ramsize;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_GVAL(IOV_SDIOD_DRIVE):
int_val = (s32) dhd_sdiod_drive_strength;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_SDIOD_DRIVE):
dhd_sdiod_drive_strength = int_val;
- si_sdiod_drive_strength_init(bus->sih, bus->dhd->osh,
+ si_sdiod_drive_strength_init(bus->sih,
dhd_sdiod_drive_strength);
break;
@@ -2291,7 +2285,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_READAHEAD):
int_val = (s32) dhd_readahead;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_READAHEAD):
@@ -2302,7 +2296,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_SDRXCHAIN):
int_val = (s32) bus->use_rxchain;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_SDRXCHAIN):
@@ -2313,7 +2307,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
break;
case IOV_GVAL(IOV_ALIGNCTL):
int_val = (s32) dhd_alignctl;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_ALIGNCTL):
@@ -2322,13 +2316,13 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_SDALIGN):
int_val = DHD_SDALIGN;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
#ifdef DHD_DEBUG
case IOV_GVAL(IOV_VARS):
if (bus->varsz < (uint) len)
- bcopy(bus->vars, arg, bus->varsz);
+ memcpy(arg, bus->vars, bus->varsz);
else
bcmerror = BCME_BUFTOOSHORT;
break;
@@ -2347,7 +2341,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);
if (bcmsdh_regfail(bus->sdh))
bcmerror = BCME_SDIO_ERROR;
- bcopy(&int_val, arg, sizeof(s32));
+ memcpy(arg, &int_val, sizeof(s32));
break;
}
@@ -2373,14 +2367,14 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
sdreg_t sdreg;
u32 addr, size;
- bcopy(params, &sdreg, sizeof(sdreg));
+ memcpy(&sdreg, params, sizeof(sdreg));
addr = SI_ENUM_BASE + sdreg.offset;
size = sdreg.func;
int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);
if (bcmsdh_regfail(bus->sdh))
bcmerror = BCME_SDIO_ERROR;
- bcopy(&int_val, arg, sizeof(s32));
+ memcpy(arg, &int_val, sizeof(s32));
break;
}
@@ -2389,7 +2383,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
sdreg_t sdreg;
u32 addr, size;
- bcopy(params, &sdreg, sizeof(sdreg));
+ memcpy(&sdreg, params, sizeof(sdreg));
addr = SI_ENUM_BASE + sdreg.offset;
size = sdreg.func;
@@ -2420,7 +2414,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_FORCEEVEN):
int_val = (s32) forcealign;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_FORCEEVEN):
@@ -2429,7 +2423,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_TXBOUND):
int_val = (s32) dhd_txbound;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_TXBOUND):
@@ -2438,7 +2432,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_RXBOUND):
int_val = (s32) dhd_rxbound;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_RXBOUND):
@@ -2447,7 +2441,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_GVAL(IOV_TXMINMAX):
int_val = (s32) dhd_txminmax;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_TXMINMAX):
@@ -2458,7 +2452,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
#ifdef SDTEST
case IOV_GVAL(IOV_EXTLOOP):
int_val = (s32) bus->ext_loop;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_EXTLOOP):
@@ -2480,9 +2474,6 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
__func__, bool_val, bus->dhd->dongle_reset,
bus->dhd->busstate));
- ASSERT(bus->dhd->osh);
- /* ASSERT(bus->cl_devid); */
-
dhd_bus_devreset(bus->dhd, (u8) bool_val);
break;
@@ -2492,7 +2483,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
/* Get its status */
int_val = (bool) bus->dhd->dongle_reset;
- bcopy(&int_val, arg, val_size);
+ memcpy(arg, &int_val, val_size);
break;
@@ -2532,12 +2523,11 @@ static int dhdsdio_write_vars(dhd_bus_t *bus)
varaddr = (bus->ramsize - 4) - varsize;
if (bus->vars) {
- vbuffer = kmalloc(varsize, GFP_ATOMIC);
+ vbuffer = kzalloc(varsize, GFP_ATOMIC);
if (!vbuffer)
return BCME_NOMEM;
- memset(vbuffer, 0, varsize);
- bcopy(bus->vars, vbuffer, bus->varsz);
+ memcpy(vbuffer, bus->vars, bus->varsz);
/* Write the vars list */
bcmerror =
@@ -2590,7 +2580,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus)
} else {
varsizew = varsize / 4;
varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF);
- varsizew = htol32(varsizew);
+ varsizew = cpu_to_le32(varsizew);
}
DHD_INFO(("New varsize is %d, length token=0x%08x\n", varsize,
@@ -2828,7 +2818,6 @@ exit:
void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
{
- struct osl_info *osh = bus->dhd->osh;
u32 local_hostintmask;
u8 saveclk;
uint retries;
@@ -2878,14 +2867,14 @@ void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
dhdsdio_clkctl(bus, CLK_SDONLY, false);
/* Clear the data packet queues */
- pktq_flush(osh, &bus->txq, true);
+ pktq_flush(&bus->txq, true);
/* Clear any held glomming stuff */
if (bus->glomd)
- pkt_buf_free_skb(osh, bus->glomd, false);
+ pkt_buf_free_skb(bus->glomd);
if (bus->glom)
- pkt_buf_free_skb(osh, bus->glom, false);
+ pkt_buf_free_skb(bus->glom);
bus->glom = bus->glomd = NULL;
@@ -3100,13 +3089,13 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
ASSERT(bus->rxctl >= bus->rxbuf);
/* Copy the already-read portion over */
- bcopy(hdr, bus->rxctl, firstread);
+ memcpy(bus->rxctl, hdr, firstread);
if (len <= firstread)
goto gotpkt;
/* Copy the full data pkt in gSPI case and process ioctl. */
if (bus->bus == SPI_BUS) {
- bcopy(hdr, bus->rxctl, len);
+ memcpy(bus->rxctl, hdr, len);
goto gotpkt;
}
@@ -3184,7 +3173,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
u16 sublen, check;
struct sk_buff *pfirst, *plast, *pnext, *save_pfirst;
- struct osl_info *osh = bus->dhd->osh;
int errcode;
u8 chan, seq, doff, sfdoff;
@@ -3214,7 +3202,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
for (totlen = num = 0; dlen; num++) {
/* Get (and move past) next length */
- sublen = ltoh16_ua(dptr);
+ sublen = get_unaligned_le16(dptr);
dlen -= sizeof(u16);
dptr += sizeof(u16);
if ((sublen < SDPCM_HDRLEN) ||
@@ -3240,7 +3228,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
}
/* Allocate/chain packet for next subframe */
- pnext = pkt_buf_get_skb(osh, sublen + DHD_SDALIGN);
+ pnext = pkt_buf_get_skb(sublen + DHD_SDALIGN);
if (pnext == NULL) {
DHD_ERROR(("%s: pkt_buf_get_skb failed, num %d len %d\n",
__func__, num, sublen));
@@ -3257,7 +3245,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
}
/* Adhere to start alignment requirements */
- PKTALIGN(osh, pnext, sublen, DHD_SDALIGN);
+ PKTALIGN(pnext, sublen, DHD_SDALIGN);
}
/* If all allocations succeeded, save packet chain
@@ -3276,13 +3264,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
pfirst = pnext = NULL;
} else {
if (pfirst)
- pkt_buf_free_skb(osh, pfirst, false);
+ pkt_buf_free_skb(pfirst);
bus->glom = NULL;
num = 0;
}
/* Done with descriptor packet */
- pkt_buf_free_skb(osh, bus->glomd, false);
+ pkt_buf_free_skb(bus->glomd);
bus->glomd = NULL;
bus->nextlen = 0;
@@ -3303,7 +3291,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
}
pfirst = bus->glom;
- dlen = (u16) pkttotlen(osh, pfirst);
+ dlen = (u16) pkttotlen(pfirst);
/* Do an SDIO read for the superframe. Configurable iovar to
* read directly into the chained packet, or allocate a large
@@ -3323,7 +3311,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
F2SYNC, bus->dataptr,
dlen, NULL, NULL, NULL);
sublen =
- (u16) pktfrombuf(osh, pfirst, 0, dlen,
+ (u16) pktfrombuf(pfirst, 0, dlen,
bus->dataptr);
if (sublen != dlen) {
DHD_ERROR(("%s: FAILED TO COPY, dlen %d sublen %d\n",
@@ -3351,7 +3339,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
bus->glomerr = 0;
dhdsdio_rxfail(bus, true, false);
dhd_os_sdlock_rxq(bus->dhd);
- pkt_buf_free_skb(osh, bus->glom, false);
+ pkt_buf_free_skb(bus->glom);
dhd_os_sdunlock_rxq(bus->dhd);
bus->rxglomfail++;
bus->glom = NULL;
@@ -3367,8 +3355,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
/* Validate the superframe header */
dptr = (u8 *) (pfirst->data);
- sublen = ltoh16_ua(dptr);
- check = ltoh16_ua(dptr + sizeof(u16));
+ sublen = get_unaligned_le16(dptr);
+ check = get_unaligned_le16(dptr + sizeof(u16));
chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
@@ -3437,8 +3425,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
num++, pnext = pnext->next) {
dptr = (u8 *) (pnext->data);
dlen = (u16) (pnext->len);
- sublen = ltoh16_ua(dptr);
- check = ltoh16_ua(dptr + sizeof(u16));
+ sublen = get_unaligned_le16(dptr);
+ check = get_unaligned_le16(dptr + sizeof(u16));
chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
#ifdef DHD_DEBUG
@@ -3480,7 +3468,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
bus->glomerr = 0;
dhdsdio_rxfail(bus, true, false);
dhd_os_sdlock_rxq(bus->dhd);
- pkt_buf_free_skb(osh, bus->glom, false);
+ pkt_buf_free_skb(bus->glom);
dhd_os_sdunlock_rxq(bus->dhd);
bus->rxglomfail++;
bus->glom = NULL;
@@ -3500,7 +3488,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
pfirst->next = NULL;
dptr = (u8 *) (pfirst->data);
- sublen = ltoh16_ua(dptr);
+ sublen = get_unaligned_le16(dptr);
chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
@@ -3528,7 +3516,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
skb_pull(pfirst, doff);
if (pfirst->len == 0) {
- pkt_buf_free_skb(bus->dhd->osh, pfirst, false);
+ pkt_buf_free_skb(pfirst);
if (plast) {
plast->next = pnext;
} else {
@@ -3541,7 +3529,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
DHD_ERROR(("%s: rx protocol error\n",
__func__));
bus->dhd->rx_errors++;
- pkt_buf_free_skb(osh, pfirst, false);
+ pkt_buf_free_skb(pfirst);
if (plast) {
plast->next = pnext;
} else {
@@ -3585,7 +3573,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
/* Return true if there may be more frames to read */
static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
{
- struct osl_info *osh = bus->dhd->osh;
bcmsdh_info_t *sdh = bus->sdh;
u16 len, check; /* Extracted hardware header fields */
@@ -3680,7 +3667,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
*/
/* Allocate a packet buffer */
dhd_os_sdlock_rxq(bus->dhd);
- pkt = pkt_buf_get_skb(osh, rdlen + DHD_SDALIGN);
+ pkt = pkt_buf_get_skb(rdlen + DHD_SDALIGN);
if (!pkt) {
if (bus->bus == SPI_BUS) {
bus->usebufpool = false;
@@ -3738,7 +3725,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
bus->usebufpool = true;
ASSERT(!(pkt->prev));
- PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN);
+ PKTALIGN(pkt, rdlen, DHD_SDALIGN);
rxbuf = (u8 *) (pkt->data);
/* Read the entire frame */
sdret =
@@ -3753,7 +3740,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
if (sdret < 0) {
DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n",
__func__, rdlen, sdret));
- pkt_buf_free_skb(bus->dhd->osh, pkt, false);
+ pkt_buf_free_skb(pkt);
bus->dhd->rx_errors++;
dhd_os_sdunlock_rxq(bus->dhd);
/* Force retry w/normal header read.
@@ -3770,11 +3757,11 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
dhd_os_sdunlock_rxq(bus->dhd);
/* Now check the header */
- bcopy(rxbuf, bus->rxhdr, SDPCM_HDRLEN);
+ memcpy(bus->rxhdr, rxbuf, SDPCM_HDRLEN);
/* Extract hardware header fields */
- len = ltoh16_ua(bus->rxhdr);
- check = ltoh16_ua(bus->rxhdr + sizeof(u16));
+ len = get_unaligned_le16(bus->rxhdr);
+ check = get_unaligned_le16(bus->rxhdr + sizeof(u16));
/* All zeros means readahead info was bad */
if (!(len | check)) {
@@ -3901,8 +3888,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
doff);
if (bus->usebufpool) {
dhd_os_sdlock_rxq(bus->dhd);
- pkt_buf_free_skb(bus->dhd->osh, pkt,
- false);
+ pkt_buf_free_skb(pkt);
dhd_os_sdunlock_rxq(bus->dhd);
}
continue;
@@ -3965,8 +3951,8 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
#endif
/* Extract hardware header fields */
- len = ltoh16_ua(bus->rxhdr);
- check = ltoh16_ua(bus->rxhdr + sizeof(u16));
+ len = get_unaligned_le16(bus->rxhdr);
+ check = get_unaligned_le16(bus->rxhdr + sizeof(u16));
/* All zeros means no more frames */
if (!(len | check)) {
@@ -4091,7 +4077,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
}
dhd_os_sdlock_rxq(bus->dhd);
- pkt = pkt_buf_get_skb(osh, (rdlen + firstread + DHD_SDALIGN));
+ pkt = pkt_buf_get_skb(rdlen + firstread + DHD_SDALIGN);
if (!pkt) {
/* Give up on data, request rtx of events */
DHD_ERROR(("%s: pkt_buf_get_skb failed: rdlen %d chan %d\n",
@@ -4108,7 +4094,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Leave room for what we already read, and align remainder */
ASSERT(firstread < pkt->len);
skb_pull(pkt, firstread);
- PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN);
+ PKTALIGN(pkt, rdlen, DHD_SDALIGN);
/* Read the remaining frame data */
sdret =
@@ -4127,7 +4113,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
? "data" : "test")),
sdret));
dhd_os_sdlock_rxq(bus->dhd);
- pkt_buf_free_skb(bus->dhd->osh, pkt, false);
+ pkt_buf_free_skb(pkt);
dhd_os_sdunlock_rxq(bus->dhd);
bus->dhd->rx_errors++;
dhdsdio_rxfail(bus, true, RETRYCHAN(chan));
@@ -4136,7 +4122,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Copy the already-read portion */
skb_push(pkt, firstread);
- bcopy(bus->rxhdr, pkt->data, firstread);
+ memcpy(pkt->data, bus->rxhdr, firstread);
#ifdef DHD_DEBUG
if (DHD_BYTES_ON() && DHD_DATA_ON())
@@ -4180,13 +4166,13 @@ deliver:
if (pkt->len == 0) {
dhd_os_sdlock_rxq(bus->dhd);
- pkt_buf_free_skb(bus->dhd->osh, pkt, false);
+ pkt_buf_free_skb(pkt);
dhd_os_sdunlock_rxq(bus->dhd);
continue;
} else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pkt) != 0) {
DHD_ERROR(("%s: rx protocol error\n", __func__));
dhd_os_sdlock_rxq(bus->dhd);
- pkt_buf_free_skb(bus->dhd->osh, pkt, false);
+ pkt_buf_free_skb(pkt);
dhd_os_sdunlock_rxq(bus->dhd);
bus->dhd->rx_errors++;
continue;
@@ -4501,7 +4487,7 @@ clkwait:
if (ret == 0)
bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
- printf("Return_dpc value is : %d\n", ret);
+ DHD_INFO(("Return_dpc value is : %d\n", ret));
bus->ctrl_frame_stat = false;
dhd_wait_event_wakeup(bus->dhd);
}
@@ -4635,13 +4621,12 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
u8 *data;
uint pktcount;
uint fillbyte;
- struct osl_info *osh = bus->dhd->osh;
u16 len;
/* Display current count if appropriate */
if (bus->pktgen_print && (++bus->pktgen_ptick >= bus->pktgen_print)) {
bus->pktgen_ptick = 0;
- printf("%s: send attempts %d rcvd %d\n",
+ printk(KERN_DEBUG "%s: send attempts %d rcvd %d\n",
__func__, bus->pktgen_sent, bus->pktgen_rcvd);
}
@@ -4663,14 +4648,14 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
/* Allocate an appropriate-sized packet */
len = bus->pktgen_len;
- pkt = pkt_buf_get_skb(osh,
+ pkt = pkt_buf_get_skb(
(len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN),
true);
if (!pkt) {
DHD_ERROR(("%s: pkt_buf_get_skb failed!\n", __func__));
break;
}
- PKTALIGN(osh, pkt, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN),
+ PKTALIGN(pkt, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN),
DHD_SDALIGN);
data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
@@ -4694,7 +4679,7 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
default:
DHD_ERROR(("Unrecognized pktgen mode %d\n",
bus->pktgen_mode));
- pkt_buf_free_skb(osh, pkt, true);
+ pkt_buf_free_skb(pkt, true);
bus->pktgen_count = 0;
return;
}
@@ -4740,16 +4725,15 @@ static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start)
{
struct sk_buff *pkt;
u8 *data;
- struct osl_info *osh = bus->dhd->osh;
/* Allocate the packet */
- pkt = pkt_buf_get_skb(osh, SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN,
+ pkt = pkt_buf_get_skb(SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN,
true);
if (!pkt) {
DHD_ERROR(("%s: pkt_buf_get_skb failed!\n", __func__));
return;
}
- PKTALIGN(osh, pkt, (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), DHD_SDALIGN);
+ PKTALIGN(pkt, (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), DHD_SDALIGN);
data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
/* Fill in the test header */
@@ -4765,7 +4749,6 @@ static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start)
static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
{
- struct osl_info *osh = bus->dhd->osh;
u8 *data;
uint pktlen;
@@ -4779,7 +4762,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
if (pktlen < SDPCM_TEST_HDRLEN) {
DHD_ERROR(("dhdsdio_restrcv: toss runt frame, pktlen %d\n",
pktlen));
- pkt_buf_free_skb(osh, pkt, false);
+ pkt_buf_free_skb(pkt, false);
return;
}
@@ -4797,7 +4780,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
DHD_ERROR(("dhdsdio_testrcv: frame length mismatch, "
"pktlen %d seq %d" " cmd %d extra %d len %d\n",
pktlen, seq, cmd, extra, len));
- pkt_buf_free_skb(osh, pkt, false);
+ pkt_buf_free_skb(pkt, false);
return;
}
}
@@ -4812,14 +4795,14 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
bus->pktgen_sent++;
} else {
bus->pktgen_fail++;
- pkt_buf_free_skb(osh, pkt, false);
+ pkt_buf_free_skb(pkt, false);
}
bus->pktgen_rcvd++;
break;
case SDPCM_TEST_ECHORSP:
if (bus->ext_loop) {
- pkt_buf_free_skb(osh, pkt, false);
+ pkt_buf_free_skb(pkt, false);
bus->pktgen_rcvd++;
break;
}
@@ -4832,12 +4815,12 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
break;
}
}
- pkt_buf_free_skb(osh, pkt, false);
+ pkt_buf_free_skb(pkt, false);
bus->pktgen_rcvd++;
break;
case SDPCM_TEST_DISCARD:
- pkt_buf_free_skb(osh, pkt, false);
+ pkt_buf_free_skb(pkt, false);
bus->pktgen_rcvd++;
break;
@@ -4847,7 +4830,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
DHD_INFO(("dhdsdio_testrcv: unsupported or unknown command, "
"pktlen %d seq %d" " cmd %d extra %d len %d\n",
pktlen, seq, cmd, extra, len));
- pkt_buf_free_skb(osh, pkt, false);
+ pkt_buf_free_skb(pkt, false);
break;
}
@@ -4987,7 +4970,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
/* Zero cbuf_index */
addr = bus->console_addr + offsetof(hndrte_cons_t, cbuf_idx);
- val = htol32(0);
+ val = cpu_to_le32(0);
rv = dhdsdio_membytes(bus, true, addr, (u8 *)&val, sizeof(val));
if (rv < 0)
goto done;
@@ -5000,7 +4983,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
/* Write length into vcons_in */
addr = bus->console_addr + offsetof(hndrte_cons_t, vcons_in);
- val = htol32(msglen);
+ val = cpu_to_le32(msglen);
rv = dhdsdio_membytes(bus, true, addr, (u8 *)&val, sizeof(val));
if (rv < 0)
goto done;
@@ -5008,7 +4991,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
/* Bump dongle by sending an empty event pkt.
* sdpcm_sendup (RX) checks for virtual console input.
*/
- pkt = pkt_buf_get_skb(bus->dhd->osh, 4 + SDPCM_RESERVE);
+ pkt = pkt_buf_get_skb(4 + SDPCM_RESERVE);
if ((pkt != NULL) && bus->clkstate == CLK_AVAIL)
dhdsdio_txpkt(bus, pkt, SDPCM_EVENT_CHANNEL, true);
@@ -5066,7 +5049,7 @@ static bool dhdsdio_chipmatch(u16 chipid)
static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no,
u16 slot, u16 func, uint bustype, void *regsva,
- struct osl_info *osh, void *sdh)
+ void *sdh)
{
int ret;
dhd_bus_t *bus;
@@ -5085,7 +5068,6 @@ static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no,
sd1idle = true;
dhd_readahead = true;
retrydata = false;
- dhd_doflow = false;
dhd_dongle_memsize = 0;
dhd_txminmax = DHD_TXMINMAX;
@@ -5143,15 +5125,6 @@ static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no,
return NULL;
}
- if (osh == NULL) {
- /* Ask the OS interface part for an OSL handle */
- osh = dhd_osl_attach(sdh, DHD_BUS);
- if (!osh) {
- DHD_ERROR(("%s: osl_attach failed!\n", __func__));
- return NULL;
- }
- }
-
/* Allocate private bus interface state */
bus = kzalloc(sizeof(dhd_bus_t), GFP_ATOMIC);
if (!bus) {
@@ -5166,25 +5139,25 @@ static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no,
else use locally malloced rxbuf */
/* attempt to attach to the dongle */
- if (!(dhdsdio_probe_attach(bus, osh, sdh, regsva, devid))) {
+ if (!(dhdsdio_probe_attach(bus, sdh, regsva, devid))) {
DHD_ERROR(("%s: dhdsdio_probe_attach failed\n", __func__));
goto fail;
}
/* Attach to the dhd/OS/network interface */
- bus->dhd = dhd_attach(osh, bus, SDPCM_RESERVE);
+ bus->dhd = dhd_attach(bus, SDPCM_RESERVE);
if (!bus->dhd) {
DHD_ERROR(("%s: dhd_attach failed\n", __func__));
goto fail;
}
/* Allocate buffers */
- if (!(dhdsdio_probe_malloc(bus, osh, sdh))) {
+ if (!(dhdsdio_probe_malloc(bus, sdh))) {
DHD_ERROR(("%s: dhdsdio_probe_malloc failed\n", __func__));
goto fail;
}
- if (!(dhdsdio_probe_init(bus, osh, sdh))) {
+ if (!(dhdsdio_probe_init(bus, sdh))) {
DHD_ERROR(("%s: dhdsdio_probe_init failed\n", __func__));
goto fail;
}
@@ -5220,13 +5193,12 @@ static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no,
return bus;
fail:
- dhdsdio_release(bus, osh);
+ dhdsdio_release(bus);
return NULL;
}
static bool
-dhdsdio_probe_attach(struct dhd_bus *bus, struct osl_info *osh, void *sdh,
- void *regsva, u16 devid)
+dhdsdio_probe_attach(struct dhd_bus *bus, void *sdh, void *regsva, u16 devid)
{
u8 clkctl = 0;
int err = 0;
@@ -5238,7 +5210,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, struct osl_info *osh, void *sdh,
DHD_ERROR(("%s: FAILED to return to SI_ENUM_BASE\n", __func__));
#ifdef DHD_DEBUG
- printf("F1 signature read @0x18000000=0x%4x\n",
+ printk(KERN_DEBUG "F1 signature read @0x18000000=0x%4x\n",
bcmsdh_reg_read(bus->sdh, SI_ENUM_BASE, 4));
#endif /* DHD_DEBUG */
@@ -5279,13 +5251,12 @@ dhdsdio_probe_attach(struct dhd_bus *bus, struct osl_info *osh, void *sdh,
udelay(65);
for (fn = 0; fn <= numfn; fn++) {
- cis[fn] = kmalloc(SBSDIO_CIS_SIZE_LIMIT, GFP_ATOMIC);
+ cis[fn] = kzalloc(SBSDIO_CIS_SIZE_LIMIT, GFP_ATOMIC);
if (!cis[fn]) {
DHD_INFO(("dhdsdio_probe: fn %d cis malloc "
"failed\n", fn));
break;
}
- memset(cis[fn], 0, SBSDIO_CIS_SIZE_LIMIT);
err = bcmsdh_cis_read(sdh, fn, cis[fn],
SBSDIO_CIS_SIZE_LIMIT);
@@ -5311,7 +5282,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, struct osl_info *osh, void *sdh,
#endif /* DHD_DEBUG */
/* si_attach() will provide an SI handle and scan the backplane */
- bus->sih = si_attach((uint) devid, osh, regsva, DHD_BUS, sdh,
+ bus->sih = si_attach((uint) devid, regsva, DHD_BUS, sdh,
&bus->vars, &bus->varsz);
if (!(bus->sih)) {
DHD_ERROR(("%s: si_attach failed!\n", __func__));
@@ -5326,7 +5297,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, struct osl_info *osh, void *sdh,
goto fail;
}
- si_sdiod_drive_strength_init(bus->sih, osh, dhd_sdiod_drive_strength);
+ si_sdiod_drive_strength_init(bus->sih, dhd_sdiod_drive_strength);
/* Get info on the ARM and SOCRAM cores... */
if (!DHD_NOPMU(bus)) {
@@ -5364,9 +5335,9 @@ dhdsdio_probe_attach(struct dhd_bus *bus, struct osl_info *osh, void *sdh,
bus->sdpcmrev = si_corerev(bus->sih);
/* Set core control so an SDIO reset does a backplane reset */
- OR_REG(osh, &bus->regs->corecontrol, CC_BPRESEN);
+ OR_REG(&bus->regs->corecontrol, CC_BPRESEN);
- pktq_init(&bus->txq, (PRIOMASK + 1), QLEN);
+ pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN);
/* Locate an appropriately-aligned portion of hdrbuf */
bus->rxhdr = (u8 *) roundup((unsigned long)&bus->hdrbuf[0], DHD_SDALIGN);
@@ -5383,8 +5354,7 @@ fail:
return false;
}
-static bool dhdsdio_probe_malloc(dhd_bus_t *bus, struct osl_info *osh,
- void *sdh)
+static bool dhdsdio_probe_malloc(dhd_bus_t *bus, void *sdh)
{
DHD_TRACE(("%s: Enter\n", __func__));
@@ -5425,7 +5395,7 @@ fail:
return false;
}
-static bool dhdsdio_probe_init(dhd_bus_t *bus, struct osl_info *osh, void *sdh)
+static bool dhdsdio_probe_init(dhd_bus_t *bus, void *sdh)
{
s32 fnum;
@@ -5502,20 +5472,19 @@ static bool dhdsdio_probe_init(dhd_bus_t *bus, struct osl_info *osh, void *sdh)
}
bool
-dhd_bus_download_firmware(struct dhd_bus *bus, struct osl_info *osh,
- char *fw_path, char *nv_path)
+dhd_bus_download_firmware(struct dhd_bus *bus, char *fw_path, char *nv_path)
{
bool ret;
bus->fw_path = fw_path;
bus->nv_path = nv_path;
- ret = dhdsdio_download_firmware(bus, osh, bus->sdh);
+ ret = dhdsdio_download_firmware(bus, bus->sdh);
return ret;
}
static bool
-dhdsdio_download_firmware(struct dhd_bus *bus, struct osl_info *osh, void *sdh)
+dhdsdio_download_firmware(struct dhd_bus *bus, void *sdh)
{
bool ret;
@@ -5530,37 +5499,32 @@ dhdsdio_download_firmware(struct dhd_bus *bus, struct osl_info *osh, void *sdh)
}
/* Detach and free everything */
-static void dhdsdio_release(dhd_bus_t *bus, struct osl_info *osh)
+static void dhdsdio_release(dhd_bus_t *bus)
{
DHD_TRACE(("%s: Enter\n", __func__));
if (bus) {
- ASSERT(osh);
-
/* De-register interrupt handler */
bcmsdh_intr_disable(bus->sdh);
bcmsdh_intr_dereg(bus->sdh);
if (bus->dhd) {
- dhdsdio_release_dongle(bus, osh);
+ dhdsdio_release_dongle(bus);
dhd_detach(bus->dhd);
bus->dhd = NULL;
}
- dhdsdio_release_malloc(bus, osh);
+ dhdsdio_release_malloc(bus);
kfree(bus);
}
- if (osh)
- dhd_osl_detach(osh);
-
DHD_TRACE(("%s: Disconnected\n", __func__));
}
-static void dhdsdio_release_malloc(dhd_bus_t *bus, struct osl_info *osh)
+static void dhdsdio_release_malloc(dhd_bus_t *bus)
{
DHD_TRACE(("%s: Enter\n", __func__));
@@ -5573,13 +5537,11 @@ static void dhdsdio_release_malloc(dhd_bus_t *bus, struct osl_info *osh)
bus->rxlen = 0;
}
- if (bus->databuf) {
- kfree(bus->databuf);
- bus->databuf = NULL;
- }
+ kfree(bus->databuf);
+ bus->databuf = NULL;
}
-static void dhdsdio_release_dongle(dhd_bus_t *bus, struct osl_info *osh)
+static void dhdsdio_release_dongle(dhd_bus_t *bus)
{
DHD_TRACE(("%s: Enter\n", __func__));
@@ -5609,7 +5571,7 @@ static void dhdsdio_disconnect(void *ptr)
if (bus) {
ASSERT(bus->dhd);
- dhdsdio_release(bus, bus->dhd->osh);
+ dhdsdio_release(bus);
}
DHD_TRACE(("%s: Disconnected\n", __func__));
@@ -5679,6 +5641,10 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
unsigned char *ularray;
ularray = kmalloc(bus->ramsize, GFP_ATOMIC);
+ if (!ularray) {
+ bcmerror = BCME_NOMEM;
+ goto err;
+ }
/* Upload image to verify downloaded contents. */
offset = 0;
memset(ularray, 0xaa, bus->ramsize);
@@ -5690,7 +5656,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
DHD_ERROR(("%s: error %d on reading %d membytes"
" at 0x%08x\n",
__func__, bcmerror, MEMBLOCK, offset));
- goto err;
+ goto free;
}
offset += MEMBLOCK;
@@ -5704,7 +5670,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n",
__func__, bcmerror,
sizeof(dlarray) - offset, offset));
- goto err;
+ goto free;
}
}
@@ -5712,11 +5678,11 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
DHD_ERROR(("%s: Downloaded image is corrupted.\n",
__func__));
ASSERT(0);
- goto err;
+ goto free;
} else
DHD_ERROR(("%s: Download/Upload/Compare succeeded.\n",
__func__));
-
+free:
kfree(ularray);
}
#endif /* DHD_DEBUG */
@@ -5764,8 +5730,7 @@ static int dhdsdio_download_code_file(struct dhd_bus *bus, char *fw_path)
}
err:
- if (memblock)
- kfree(memblock);
+ kfree(memblock);
if (image)
dhd_os_close_image(image);
@@ -5904,8 +5869,7 @@ static int dhdsdio_download_nvram(struct dhd_bus *bus)
}
err:
- if (memblock)
- kfree(memblock);
+ kfree(memblock);
if (image)
dhd_os_close_image(image);
@@ -6051,7 +6015,7 @@ int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag)
/* Clean tx/rx buffer pointers,
detach from the dongle */
- dhdsdio_release_dongle(bus, bus->dhd->osh);
+ dhdsdio_release_dongle(bus);
bus->dhd->dongle_reset = true;
bus->dhd->up = false;
@@ -6071,14 +6035,13 @@ int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag)
bcmsdh_reset(bus->sdh);
/* Attempt to re-attach & download */
- if (dhdsdio_probe_attach(bus, bus->dhd->osh, bus->sdh,
+ if (dhdsdio_probe_attach(bus, bus->sdh,
(u32 *) SI_ENUM_BASE,
bus->cl_devid)) {
/* Attempt to download binary to the dongle */
if (dhdsdio_probe_init
- (bus, bus->dhd->osh, bus->sdh)
+ (bus, bus->sdh)
&& dhdsdio_download_firmware(bus,
- bus->dhd->osh,
bus->sdh)) {
/* Re-init bus, enable F2 transfer */
diff --git a/drivers/staging/brcm80211/brcmfmac/dhdioctl.h b/drivers/staging/brcm80211/brcmfmac/dhdioctl.h
new file mode 100644
index 000000000000..f0ba53558ccd
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/dhdioctl.h
@@ -0,0 +1,100 @@
+/*
+ * 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 _dhdioctl_h_
+#define _dhdioctl_h_
+
+/* Linux network driver ioctl encoding */
+typedef struct dhd_ioctl {
+ uint cmd; /* common ioctl definition */
+ void *buf; /* pointer to user buffer */
+ uint len; /* length of user buffer */
+ bool set; /* get or set request (optional) */
+ uint used; /* bytes read or written (optional) */
+ uint needed; /* bytes needed (optional) */
+ uint driver; /* to identify target driver */
+} dhd_ioctl_t;
+
+/* per-driver magic numbers */
+#define DHD_IOCTL_MAGIC 0x00444944
+
+/* bump this number if you change the ioctl interface */
+#define DHD_IOCTL_VERSION 1
+
+#define DHD_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
+#define DHD_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */
+
+/* common ioctl definitions */
+#define DHD_GET_MAGIC 0
+#define DHD_GET_VERSION 1
+#define DHD_GET_VAR 2
+#define DHD_SET_VAR 3
+
+/* message levels */
+#define DHD_ERROR_VAL 0x0001
+#define DHD_TRACE_VAL 0x0002
+#define DHD_INFO_VAL 0x0004
+#define DHD_DATA_VAL 0x0008
+#define DHD_CTL_VAL 0x0010
+#define DHD_TIMER_VAL 0x0020
+#define DHD_HDRS_VAL 0x0040
+#define DHD_BYTES_VAL 0x0080
+#define DHD_INTR_VAL 0x0100
+#define DHD_LOG_VAL 0x0200
+#define DHD_GLOM_VAL 0x0400
+#define DHD_EVENT_VAL 0x0800
+#define DHD_BTA_VAL 0x1000
+#define DHD_ISCAN_VAL 0x2000
+
+#ifdef SDTEST
+/* For pktgen iovar */
+typedef struct dhd_pktgen {
+ uint version; /* To allow structure change tracking */
+ uint freq; /* Max ticks between tx/rx attempts */
+ uint count; /* Test packets to send/rcv each attempt */
+ uint print; /* Print counts every <print> attempts */
+ uint total; /* Total packets (or bursts) */
+ uint minlen; /* Minimum length of packets to send */
+ uint maxlen; /* Maximum length of packets to send */
+ uint numsent; /* Count of test packets sent */
+ uint numrcvd; /* Count of test packets received */
+ uint numfail; /* Count of test send failures */
+ uint mode; /* Test mode (type of test packets) */
+ uint stop; /* Stop after this many tx failures */
+} dhd_pktgen_t;
+
+/* Version in case structure changes */
+#define DHD_PKTGEN_VERSION 2
+
+/* Type of test packets to use */
+#define DHD_PKTGEN_ECHO 1 /* Send echo requests */
+#define DHD_PKTGEN_SEND 2 /* Send discard packets */
+#define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */
+#define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous
+ tx dongle */
+#endif /* SDTEST */
+
+/* Enter idle immediately (no timeout) */
+#define DHD_IDLE_IMMEDIATE (-1)
+
+/* Values for idleclock iovar: other values are the sd_divisor to use
+ when idle */
+#define DHD_IDLE_ACTIVE 0 /* Do not request any SD clock change
+ when idle */
+#define DHD_IDLE_STOP (-1) /* Request SD clock be stopped
+ (and use SD1 mode) */
+
+#endif /* _dhdioctl_h_ */
diff --git a/drivers/staging/brcm80211/brcmfmac/hndpmu.c b/drivers/staging/brcm80211/brcmfmac/hndpmu.c
new file mode 100644
index 000000000000..e841da6fb03d
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/hndpmu.c
@@ -0,0 +1 @@
+#include "../util/hndpmu.c"
diff --git a/drivers/staging/brcm80211/brcmfmac/hndrte_armtrap.h b/drivers/staging/brcm80211/brcmfmac/hndrte_armtrap.h
new file mode 100644
index 000000000000..28f092c9e027
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/hndrte_armtrap.h
@@ -0,0 +1,75 @@
+/*
+ * 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 _hndrte_armtrap_h
+#define _hndrte_armtrap_h
+
+/* ARM trap handling */
+
+/* Trap types defined by ARM (see arminc.h) */
+
+/* Trap locations in lo memory */
+#define TRAP_STRIDE 4
+#define FIRST_TRAP TR_RST
+#define LAST_TRAP (TR_FIQ * TRAP_STRIDE)
+
+#if defined(__ARM_ARCH_4T__)
+#define MAX_TRAP_TYPE (TR_FIQ + 1)
+#elif defined(__ARM_ARCH_7M__)
+#define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS)
+#endif /* __ARM_ARCH_7M__ */
+
+/* The trap structure is defined here as offsets for assembly */
+#define TR_TYPE 0x00
+#define TR_EPC 0x04
+#define TR_CPSR 0x08
+#define TR_SPSR 0x0c
+#define TR_REGS 0x10
+#define TR_REG(n) (TR_REGS + (n) * 4)
+#define TR_SP TR_REG(13)
+#define TR_LR TR_REG(14)
+#define TR_PC TR_REG(15)
+
+#define TRAP_T_SIZE 80
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+typedef struct _trap_struct {
+ u32 type;
+ u32 epc;
+ u32 cpsr;
+ u32 spsr;
+ u32 r0;
+ u32 r1;
+ u32 r2;
+ u32 r3;
+ u32 r4;
+ u32 r5;
+ u32 r6;
+ u32 r7;
+ u32 r8;
+ u32 r9;
+ u32 r10;
+ u32 r11;
+ u32 r12;
+ u32 r13;
+ u32 r14;
+ u32 pc;
+} trap_t;
+
+#endif /* !_LANGUAGE_ASSEMBLY */
+
+#endif /* _hndrte_armtrap_h */
diff --git a/drivers/staging/brcm80211/brcmfmac/hndrte_cons.h b/drivers/staging/brcm80211/brcmfmac/hndrte_cons.h
new file mode 100644
index 000000000000..4df3eecaa83b
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/hndrte_cons.h
@@ -0,0 +1,62 @@
+/*
+ * 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 _hndrte_cons_h
+#define _hndrte_cons_h
+
+#define CBUF_LEN (128)
+
+#define LOG_BUF_LEN 1024
+
+typedef struct {
+ u32 buf; /* Can't be pointer on (64-bit) hosts */
+ uint buf_size;
+ uint idx;
+ char *_buf_compat; /* Redundant pointer for backward compat. */
+} hndrte_log_t;
+
+typedef struct {
+ /* Virtual UART
+ * When there is no UART (e.g. Quickturn),
+ * the host should write a complete
+ * input line directly into cbuf and then write
+ * the length into vcons_in.
+ * This may also be used when there is a real UART
+ * (at risk of conflicting with
+ * the real UART). vcons_out is currently unused.
+ */
+ volatile uint vcons_in;
+ volatile uint vcons_out;
+
+ /* Output (logging) buffer
+ * Console output is written to a ring buffer log_buf at index log_idx.
+ * The host may read the output when it sees log_idx advance.
+ * Output will be lost if the output wraps around faster than the host
+ * polls.
+ */
+ hndrte_log_t log;
+
+ /* Console input line buffer
+ * Characters are read one at a time into cbuf
+ * until <CR> is received, then
+ * the buffer is processed as a command line.
+ * Also used for virtual UART.
+ */
+ uint cbuf_idx;
+ char cbuf[CBUF_LEN];
+} hndrte_cons_t;
+
+#endif /* _hndrte_cons_h */
+
diff --git a/drivers/staging/brcm80211/brcmfmac/msgtrace.h b/drivers/staging/brcm80211/brcmfmac/msgtrace.h
new file mode 100644
index 000000000000..d654671a5a30
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/msgtrace.h
@@ -0,0 +1,61 @@
+/*
+ * 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 _MSGTRACE_H
+#define _MSGTRACE_H
+
+#define MSGTRACE_VERSION 1
+
+/* Message trace header */
+typedef struct msgtrace_hdr {
+ u8 version;
+ u8 spare;
+ u16 len; /* Len of the trace */
+ u32 seqnum; /* Sequence number of message. Useful
+ * if the messsage has been lost
+ * because of DMA error or a bus reset
+ * (ex: SDIO Func2)
+ */
+ u32 discarded_bytes; /* Number of discarded bytes because of
+ trace overflow */
+ u32 discarded_printf; /* Number of discarded printf
+ because of trace overflow */
+} __attribute__((packed)) msgtrace_hdr_t;
+
+#define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t)
+
+/* The hbus driver generates traces when sending a trace message.
+ * This causes endless traces.
+ * This flag must be set to true in any hbus traces.
+ * The flag is reset in the function msgtrace_put.
+ * This prevents endless traces but generates hasardous
+ * lost of traces only in bus device code.
+ * It is recommendat to set this flag in macro SD_TRACE
+ * but not in SD_ERROR for avoiding missing
+ * hbus error traces. hbus error trace should not generates endless traces.
+ */
+extern bool msgtrace_hbus_trace;
+
+typedef void (*msgtrace_func_send_t) (void *hdl1, void *hdl2, u8 *hdr,
+ u16 hdrlen, u8 *buf,
+ u16 buflen);
+
+extern void msgtrace_sent(void);
+extern void msgtrace_put(char *buf, int count);
+extern void msgtrace_init(void *hdl1, void *hdl2,
+ msgtrace_func_send_t func_send);
+
+#endif /* _MSGTRACE_H */
diff --git a/drivers/staging/brcm80211/brcmfmac/sbutils.c b/drivers/staging/brcm80211/brcmfmac/sbutils.c
new file mode 100644
index 000000000000..64496b8ca2cd
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/sbutils.c
@@ -0,0 +1 @@
+#include "../util/sbutils.c"
diff --git a/drivers/staging/brcm80211/brcmfmac/sdioh.h b/drivers/staging/brcm80211/brcmfmac/sdioh.h
new file mode 100644
index 000000000000..f96aaf9cec74
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/sdioh.h
@@ -0,0 +1,63 @@
+/*
+ * 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 _SDIOH_H
+#define _SDIOH_H
+
+#define SD_SysAddr 0x000
+#define SD_BlockSize 0x004
+#define SD_BlockCount 0x006
+#define SD_Arg0 0x008
+#define SD_Arg1 0x00A
+#define SD_TransferMode 0x00C
+#define SD_Command 0x00E
+#define SD_Response0 0x010
+#define SD_Response1 0x012
+#define SD_Response2 0x014
+#define SD_Response3 0x016
+#define SD_Response4 0x018
+#define SD_Response5 0x01A
+#define SD_Response6 0x01C
+#define SD_Response7 0x01E
+#define SD_BufferDataPort0 0x020
+#define SD_BufferDataPort1 0x022
+#define SD_PresentState 0x024
+#define SD_HostCntrl 0x028
+#define SD_PwrCntrl 0x029
+#define SD_BlockGapCntrl 0x02A
+#define SD_WakeupCntrl 0x02B
+#define SD_ClockCntrl 0x02C
+#define SD_TimeoutCntrl 0x02E
+#define SD_SoftwareReset 0x02F
+#define SD_IntrStatus 0x030
+#define SD_ErrorIntrStatus 0x032
+#define SD_IntrStatusEnable 0x034
+#define SD_ErrorIntrStatusEnable 0x036
+#define SD_IntrSignalEnable 0x038
+#define SD_ErrorIntrSignalEnable 0x03A
+#define SD_CMD12ErrorStatus 0x03C
+#define SD_Capabilities 0x040
+#define SD_Capabilities_Reserved 0x044
+#define SD_MaxCurCap 0x048
+#define SD_MaxCurCap_Reserved 0x04C
+#define SD_ADMA_SysAddr 0x58
+#define SD_SlotInterruptStatus 0x0FC
+#define SD_HostControllerVersion 0x0FE
+
+/* SD specific registers in PCI config space */
+#define SD_SlotInfo 0x40
+
+#endif /* _SDIOH_H */
diff --git a/drivers/staging/brcm80211/brcmfmac/sdiovar.h b/drivers/staging/brcm80211/brcmfmac/sdiovar.h
new file mode 100644
index 000000000000..d1cfa5f0a982
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/sdiovar.h
@@ -0,0 +1,38 @@
+/*
+ * 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 _sdiovar_h_
+#define _sdiovar_h_
+
+typedef struct sdreg {
+ int func;
+ int offset;
+ int value;
+} sdreg_t;
+
+/* Common msglevel constants */
+#define SDH_ERROR_VAL 0x0001 /* Error */
+#define SDH_TRACE_VAL 0x0002 /* Trace */
+#define SDH_INFO_VAL 0x0004 /* Info */
+#define SDH_DEBUG_VAL 0x0008 /* Debug */
+#define SDH_DATA_VAL 0x0010 /* Data */
+#define SDH_CTRL_VAL 0x0020 /* Control Regs */
+#define SDH_LOG_VAL 0x0040 /* Enable bcmlog */
+#define SDH_DMA_VAL 0x0080 /* DMA */
+
+#define NUM_PREV_TRANSACTIONS 16
+
+#endif /* _sdiovar_h_ */
diff --git a/drivers/staging/brcm80211/brcmfmac/siutils.c b/drivers/staging/brcm80211/brcmfmac/siutils.c
new file mode 100644
index 000000000000..f428e992a11f
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmfmac/siutils.c
@@ -0,0 +1 @@
+#include "../util/siutils.c"
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 991463f4a7f4..555b056b49b1 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -16,11 +16,8 @@
#include <linux/kernel.h>
#include <linux/if_arp.h>
-#include <osl.h>
#include <bcmutils.h>
-#include <bcmendian.h>
-#include <proto/ethernet.h>
#include <asm/uaccess.h>
@@ -44,6 +41,7 @@
static struct sdio_func *cfg80211_sdio_func;
static struct wl_dev *wl_cfg80211_dev;
+static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};
u32 wl_dbg_level = WL_DBG_ERR | WL_DBG_INFO;
@@ -87,8 +85,8 @@ static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
s32 dbm);
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
- struct net_device *dev,
- u8 key_idx);
+ struct net_device *dev, u8 key_idx,
+ bool unicast, bool multicast);
static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
u8 key_idx, bool pairwise, const u8 *mac_addr,
struct key_params *params);
@@ -555,24 +553,24 @@ static const u32 __wl_cipher_suites[] = {
static void swap_key_from_BE(struct wl_wsec_key *key)
{
- key->index = htod32(key->index);
- key->len = htod32(key->len);
- key->algo = htod32(key->algo);
- key->flags = htod32(key->flags);
- key->rxiv.hi = htod32(key->rxiv.hi);
- key->rxiv.lo = htod16(key->rxiv.lo);
- key->iv_initialized = htod32(key->iv_initialized);
+ key->index = cpu_to_le32(key->index);
+ key->len = cpu_to_le32(key->len);
+ key->algo = cpu_to_le32(key->algo);
+ key->flags = cpu_to_le32(key->flags);
+ key->rxiv.hi = cpu_to_le32(key->rxiv.hi);
+ key->rxiv.lo = cpu_to_le16(key->rxiv.lo);
+ key->iv_initialized = cpu_to_le32(key->iv_initialized);
}
static void swap_key_to_BE(struct wl_wsec_key *key)
{
- key->index = dtoh32(key->index);
- key->len = dtoh32(key->len);
- key->algo = dtoh32(key->algo);
- key->flags = dtoh32(key->flags);
- key->rxiv.hi = dtoh32(key->rxiv.hi);
- key->rxiv.lo = dtoh16(key->rxiv.lo);
- key->iv_initialized = dtoh32(key->iv_initialized);
+ key->index = le32_to_cpu(key->index);
+ key->len = le32_to_cpu(key->len);
+ key->algo = le32_to_cpu(key->algo);
+ key->flags = le32_to_cpu(key->flags);
+ key->rxiv.hi = le32_to_cpu(key->rxiv.hi);
+ key->rxiv.lo = le16_to_cpu(key->rxiv.lo);
+ key->iv_initialized = le32_to_cpu(key->iv_initialized);
}
static s32
@@ -626,8 +624,8 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
default:
return -EINVAL;
}
- infra = htod32(infra);
- ap = htod32(ap);
+ infra = cpu_to_le32(infra);
+ ap = cpu_to_le32(ap);
wdev = ndev->ieee80211_ptr;
wdev->iftype = type;
WL_DBG("%s : ap (%d), infra (%d)\n", ndev->name, ap, infra);
@@ -648,7 +646,7 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid)
{
- memcpy(&params->bssid, &ether_bcast, ETH_ALEN);
+ memcpy(params->bssid, ether_bcast, ETH_ALEN);
params->bss_type = DOT11_BSSTYPE_ANY;
params->scan_type = 0;
params->nprobes = -1;
@@ -657,10 +655,10 @@ static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid)
params->home_time = -1;
params->channel_num = 0;
- params->nprobes = htod32(params->nprobes);
- params->active_time = htod32(params->active_time);
- params->passive_time = htod32(params->passive_time);
- params->home_time = htod32(params->home_time);
+ params->nprobes = cpu_to_le32(params->nprobes);
+ params->active_time = cpu_to_le32(params->active_time);
+ params->passive_time = cpu_to_le32(params->passive_time);
+ params->home_time = cpu_to_le32(params->home_time);
if (ssid && ssid->SSID_len)
memcpy(&params->ssid, ssid, sizeof(wlc_ssid_t));
@@ -673,7 +671,7 @@ wl_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param,
s32 iolen;
iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen);
- BUG_ON(unlikely(!iolen));
+ BUG_ON(!iolen);
return wl_dev_ioctl(dev, WLC_SET_VAR, bufptr, iolen);
}
@@ -685,7 +683,7 @@ wl_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param,
s32 iolen;
iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen);
- BUG_ON(unlikely(!iolen));
+ BUG_ON(!iolen);
return wl_dev_ioctl(dev, WLC_GET_VAR, bufptr, buflen);
}
@@ -703,14 +701,13 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action)
params = kzalloc(params_size, GFP_KERNEL);
if (unlikely(!params))
return -ENOMEM;
- memset(params, 0, params_size);
- BUG_ON(unlikely(params_size >= WLC_IOCTL_SMLEN));
+ BUG_ON(params_size >= WLC_IOCTL_SMLEN);
wl_iscan_prep(&params->params, ssid);
- params->version = htod32(ISCAN_REQ_VERSION);
- params->action = htod16(action);
- params->scan_duration = htod16(0);
+ params->version = cpu_to_le32(ISCAN_REQ_VERSION);
+ params->action = cpu_to_le16(action);
+ params->scan_duration = cpu_to_le16(0);
/* params_size += offsetof(wl_iscan_params_t, params); */
err = wl_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,
@@ -813,7 +810,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
min_t(u8, sizeof(sr->ssid.SSID), ssids->ssid_len);
if (sr->ssid.SSID_len) {
memcpy(sr->ssid.SSID, ssids->ssid, sr->ssid.SSID_len);
- sr->ssid.SSID_len = htod32(sr->ssid.SSID_len);
+ sr->ssid.SSID_len = cpu_to_le32(sr->ssid.SSID_len);
WL_DBG("Specific scan ssid=\"%s\" len=%d\n",
sr->ssid.SSID, sr->ssid.SSID_len);
spec_scan = true;
@@ -873,9 +870,9 @@ static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
u32 len;
s32 err = 0;
- val = htod32(val);
+ val = cpu_to_le32(val);
len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf));
- BUG_ON(unlikely(!len));
+ BUG_ON(!len);
err = wl_dev_ioctl(dev, WLC_SET_VAR, buf, len);
if (unlikely(err)) {
@@ -899,12 +896,12 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
len =
bcm_mkiovar(name, (char *)(&data_null), 0, (char *)(&var),
sizeof(var.buf));
- BUG_ON(unlikely(!len));
+ BUG_ON(!len);
err = wl_dev_ioctl(dev, WLC_GET_VAR, &var, len);
if (unlikely(err)) {
WL_ERR("error (%d)\n", err);
}
- *retval = dtoh32(var.val);
+ *retval = le32_to_cpu(var.val);
return err;
}
@@ -938,7 +935,7 @@ static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l)
s32 err = 0;
u32 cmd = (l ? WLC_SET_LRL : WLC_SET_SRL);
- retry = htod32(retry);
+ retry = cpu_to_le32(retry);
err = wl_dev_ioctl(dev, cmd, &retry, sizeof(retry));
if (unlikely(err)) {
WL_ERR("cmd (%d) , error (%d)\n", cmd, err);
@@ -1041,7 +1038,7 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
memset(&join_params, 0, sizeof(join_params));
memcpy((void *)join_params.ssid.SSID, (void *)params->ssid,
params->ssid_len);
- join_params.ssid.SSID_len = htod32(params->ssid_len);
+ join_params.ssid.SSID_len = cpu_to_le32(params->ssid_len);
if (params->bssid)
memcpy(&join_params.params.bssid, params->bssid,
ETH_ALEN);
@@ -1371,12 +1368,12 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), sme->ssid_len);
memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len);
- join_params.ssid.SSID_len = htod32(join_params.ssid.SSID_len);
+ join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID);
- memcpy(&join_params.params.bssid, &ether_bcast, ETH_ALEN);
+ memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
wl_ch_to_chanspec(wl->channel, &join_params, &join_params_size);
- WL_DBG("join_param_size %d\n", join_params_size);
+ WL_DBG("join_param_size %zu\n", join_params_size);
if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
WL_DBG("ssid \"%s\", len (%d)\n",
@@ -1407,7 +1404,7 @@ wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
if (likely(act)) {
scbval.val = reason_code;
memcpy(&scbval.ea, &wl->bssid, ETH_ALEN);
- scbval.val = htod32(scbval.val);
+ scbval.val = cpu_to_le32(scbval.val);
err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval,
sizeof(scb_val_t));
if (unlikely(err)) {
@@ -1449,7 +1446,7 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy,
}
/* Make sure radio is off or on as far as software is concerned */
disable = WL_RADIO_SW_DISABLE << 16;
- disable = htod32(disable);
+ disable = cpu_to_le32(disable);
err = wl_dev_ioctl(ndev, WLC_SET_RADIO, &disable, sizeof(disable));
if (unlikely(err)) {
WL_ERR("WLC_SET_RADIO error (%d)\n", err);
@@ -1493,7 +1490,7 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
static s32
wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
- u8 key_idx)
+ u8 key_idx, bool unicast, bool multicast)
{
u32 index;
s32 wsec;
@@ -1507,11 +1504,11 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
WL_ERR("WLC_GET_WSEC error (%d)\n", err);
return err;
}
- wsec = dtoh32(wsec);
+ wsec = le32_to_cpu(wsec);
if (wsec & WEP_ENABLED) {
/* Just select a new current key */
index = (u32) key_idx;
- index = htod32(index);
+ index = cpu_to_le32(index);
err = wl_dev_ioctl(dev, WLC_SET_KEY_PRIMARY, &index,
sizeof(index));
if (unlikely(err)) {
@@ -1684,7 +1681,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
}
val = 1; /* assume shared key. otherwise 0 */
- val = htod32(val);
+ val = cpu_to_le32(val);
err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val));
if (unlikely(err)) {
WL_ERR("WLC_SET_AUTH error (%d)\n", err);
@@ -1740,7 +1737,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
}
val = 0; /* assume open key. otherwise 1 */
- val = htod32(val);
+ val = cpu_to_le32(val);
err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val));
if (unlikely(err)) {
WL_ERR("WLC_SET_AUTH error (%d)\n", err);
@@ -1768,7 +1765,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
key.index = key_idx;
swap_key_to_BE(&key);
memset(&params, 0, sizeof(params));
- params.key_len = (u8) min_t(u8, DOT11_MAX_KEY_SIZE, key.len);
+ params.key_len = (u8) min_t(u8, WLAN_MAX_KEY_LEN, key.len);
memcpy(params.key, key.data, params.key_len);
err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec));
@@ -1776,7 +1773,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
WL_ERR("WLC_GET_WSEC error (%d)\n", err);
return err;
}
- wsec = dtoh32(wsec);
+ wsec = le32_to_cpu(wsec);
switch (wsec) {
case WEP_ENABLED:
sec = wl_read_prof(wl, WL_PROF_SEC);
@@ -1836,7 +1833,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
if (err) {
WL_ERR("Could not get rate (%d)\n", err);
} else {
- rate = dtoh32(rate);
+ rate = le32_to_cpu(rate);
sinfo->filled |= STATION_INFO_TX_BITRATE;
sinfo->txrate.legacy = rate * 5;
WL_DBG("Rate %d Mbps\n", rate / 2);
@@ -1850,7 +1847,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
WL_ERR("Could not get rssi (%d)\n", err);
return err;
}
- rssi = dtoh32(scb_val.val);
+ rssi = le32_to_cpu(scb_val.val);
sinfo->filled |= STATION_INFO_SIGNAL;
sinfo->signal = rssi;
WL_DBG("RSSI %d dBm\n", rssi);
@@ -1868,7 +1865,7 @@ wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
CHECK_SYS_UP();
pm = enabled ? PM_FAST : PM_OFF;
- pm = htod32(pm);
+ pm = cpu_to_le32(pm);
WL_DBG("power save %s\n", (pm ? "enabled" : "disabled"));
err = wl_dev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm));
if (unlikely(err)) {
@@ -1931,7 +1928,7 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
return err;
}
- rateset.count = dtoh32(rateset.count);
+ rateset.count = le32_to_cpu(rateset.count);
legacy = wl_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy);
if (!legacy)
@@ -1980,8 +1977,6 @@ static s32 wl_cfg80211_suspend(struct wiphy *wiphy)
struct net_device *ndev = wl_to_ndev(wl);
s32 err = 0;
- CHECK_SYS_UP();
-
set_bit(WL_STATUS_SCAN_ABORTING, &wl->status);
wl_term_iscan(wl);
if (wl->scan_request) {
@@ -2005,8 +2000,8 @@ wl_update_pmklist(struct net_device *dev, struct wl_pmk_list *pmk_list,
WL_DBG("No of elements %d\n", pmk_list->pmkids.npmkid);
for (i = 0; i < pmk_list->pmkids.npmkid; i++) {
WL_DBG("PMKID[%d]: %pM =\n", i,
- &pmk_list->pmkids.pmkid[i].BSSID);
- for (j = 0; j < WPA2_PMKID_LEN; j++) {
+ &pmk_list->pmkids.pmkid[i].BSSID);
+ for (j = 0; j < WLAN_PMKID_LEN; j++) {
WL_DBG("%02x\n", pmk_list->pmkids.pmkid[i].PMKID[j]);
}
}
@@ -2035,7 +2030,7 @@ wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID, pmksa->bssid,
ETH_ALEN);
memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID, pmksa->pmkid,
- WPA2_PMKID_LEN);
+ WLAN_PMKID_LEN);
if (i == wl->pmk_list->pmkids.npmkid)
wl->pmk_list->pmkids.npmkid++;
} else {
@@ -2043,7 +2038,7 @@ wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
}
WL_DBG("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n",
&wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid].BSSID);
- for (i = 0; i < WPA2_PMKID_LEN; i++) {
+ for (i = 0; i < WLAN_PMKID_LEN; i++) {
WL_DBG("%02x\n",
wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid].
PMKID[i]);
@@ -2065,11 +2060,11 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
CHECK_SYS_UP();
memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETH_ALEN);
- memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WPA2_PMKID_LEN);
+ memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WLAN_PMKID_LEN);
WL_DBG("del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n",
&pmkid.pmkid[0].BSSID);
- for (i = 0; i < WPA2_PMKID_LEN; i++) {
+ for (i = 0; i < WLAN_PMKID_LEN; i++) {
WL_DBG("%02x\n", pmkid.pmkid[0].PMKID[i]);
}
@@ -2088,7 +2083,7 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
ETH_ALEN);
memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID,
&wl->pmk_list->pmkids.pmkid[i + 1].PMKID,
- WPA2_PMKID_LEN);
+ WLAN_PMKID_LEN);
}
wl->pmk_list->pmkids.npmkid--;
} else {
@@ -2264,7 +2259,7 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
u32 freq;
s32 err = 0;
- if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) {
+ if (unlikely(le32_to_cpu(bi->length) > WL_BSS_INFO_MAX)) {
WL_DBG("Beacon is larger than buffer. Discarding\n");
return err;
}
@@ -2313,7 +2308,9 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
notif_bss_info->frame_len =
offsetof(struct ieee80211_mgmt,
u.beacon.variable) + wl_get_ielen(wl);
- freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
+ freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
+ band->band);
+
channel = ieee80211_get_channel(wiphy, freq);
WL_DBG("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n",
@@ -2337,8 +2334,8 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e)
{
- u32 event = ntoh32(e->event_type);
- u16 flags = ntoh16(e->flags);
+ u32 event = be32_to_cpu(e->event_type);
+ u16 flags = be16_to_cpu(e->flags);
if (event == WLC_E_LINK) {
if (flags & WLC_EVENT_MSG_LINK) {
@@ -2356,8 +2353,8 @@ static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e)
static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e)
{
- u32 event = ntoh32(e->event_type);
- u16 flags = ntoh16(e->flags);
+ u32 event = be32_to_cpu(e->event_type);
+ u16 flags = be16_to_cpu(e->flags);
if (event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND) {
return true;
@@ -2371,8 +2368,8 @@ static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e)
static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e)
{
- u32 event = ntoh32(e->event_type);
- u32 status = ntoh32(e->status);
+ u32 event = be32_to_cpu(e->event_type);
+ u32 status = be32_to_cpu(e->status);
if (event == WLC_E_SET_SSID || event == WLC_E_LINK) {
if (status == WLC_E_STATUS_NO_NETWORKS)
@@ -2436,7 +2433,7 @@ wl_dev_bufvar_set(struct net_device *dev, s8 *name, s8 *buf, s32 len)
u32 buflen;
buflen = bcm_mkiovar(name, buf, len, wl->ioctl_buf, WL_IOCTL_LEN_MAX);
- BUG_ON(unlikely(!buflen));
+ BUG_ON(!buflen);
return wl_dev_ioctl(dev, WLC_SET_VAR, wl->ioctl_buf, buflen);
}
@@ -2450,7 +2447,7 @@ wl_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf,
s32 err = 0;
len = bcm_mkiovar(name, NULL, 0, wl->ioctl_buf, WL_IOCTL_LEN_MAX);
- BUG_ON(unlikely(!len));
+ BUG_ON(!len);
err = wl_dev_ioctl(dev, WLC_GET_VAR, (void *)wl->ioctl_buf,
WL_IOCTL_LEN_MAX);
if (unlikely(err)) {
@@ -2537,10 +2534,10 @@ static void wl_ch_to_chanspec(int ch, struct wl_join_params *join_params,
join_params->params.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK;
join_params->params.chanspec_list[0] |= chanspec;
join_params->params.chanspec_list[0] =
- htodchanspec(join_params->params.chanspec_list[0]);
+ cpu_to_le16(join_params->params.chanspec_list[0]);
join_params->params.chanspec_num =
- htod32(join_params->params.chanspec_num);
+ cpu_to_le32(join_params->params.chanspec_num);
WL_DBG("join_params->params.chanspec_list[0]= %#X, channel %d, chanspec %#X\n",
join_params->params.chanspec_list[0], ch, chanspec);
@@ -2571,7 +2568,7 @@ static s32 wl_update_bss_info(struct wl_priv *wl)
rtnl_lock();
if (unlikely(!bss)) {
WL_DBG("Could not find the AP\n");
- *(u32 *) wl->extra_buf = htod32(WL_EXTRA_BUF_MAX);
+ *(u32 *) wl->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_BSS_INFO,
wl->extra_buf, WL_EXTRA_BUF_MAX);
if (unlikely(err)) {
@@ -2682,7 +2679,7 @@ static s32
wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
{
- u16 flags = ntoh16(e->flags);
+ u16 flags = be16_to_cpu(e->flags);
enum nl80211_key_type key_type;
rtnl_lock();
@@ -2723,7 +2720,7 @@ wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev,
WL_ERR("scan busy (%d)\n", err);
goto scan_done_out;
}
- channel_inform.scan_channel = dtoh32(channel_inform.scan_channel);
+ channel_inform.scan_channel = le32_to_cpu(channel_inform.scan_channel);
if (unlikely(channel_inform.scan_channel)) {
WL_DBG("channel_inform.scan_channel (%d)\n",
@@ -2732,16 +2729,16 @@ wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev,
wl->bss_list = wl->scan_results;
bss_list = wl->bss_list;
memset(bss_list, 0, len);
- bss_list->buflen = htod32(len);
+ bss_list->buflen = cpu_to_le32(len);
err = wl_dev_ioctl(ndev, WLC_SCAN_RESULTS, bss_list, len);
if (unlikely(err)) {
WL_ERR("%s Scan_results error (%d)\n", ndev->name, err);
err = -EINVAL;
goto scan_done_out;
}
- bss_list->buflen = dtoh32(bss_list->buflen);
- bss_list->version = dtoh32(bss_list->version);
- bss_list->count = dtoh32(bss_list->count);
+ bss_list->buflen = le32_to_cpu(bss_list->buflen);
+ bss_list->version = le32_to_cpu(bss_list->version);
+ bss_list->count = le32_to_cpu(bss_list->count);
err = wl_inform_bss(wl);
if (err)
@@ -2950,7 +2947,7 @@ wl_get_iscan_results(struct wl_iscan_ctrl *iscan, u32 *status,
results->count = 0;
memset(&list, 0, sizeof(list));
- list.results.buflen = htod32(WL_ISCAN_BUF_MAX);
+ list.results.buflen = cpu_to_le32(WL_ISCAN_BUF_MAX);
err = wl_dev_iovar_getbuf(iscan->dev, "iscanresults", &list,
WL_ISCAN_RESULTS_FIXED_SIZE, iscan->scan_buf,
WL_ISCAN_BUF_MAX);
@@ -2958,12 +2955,12 @@ wl_get_iscan_results(struct wl_iscan_ctrl *iscan, u32 *status,
WL_ERR("error (%d)\n", err);
return err;
}
- results->buflen = dtoh32(results->buflen);
- results->version = dtoh32(results->version);
- results->count = dtoh32(results->count);
+ results->buflen = le32_to_cpu(results->buflen);
+ results->version = le32_to_cpu(results->version);
+ results->count = le32_to_cpu(results->count);
WL_DBG("results->count = %d\n", results->count);
WL_DBG("results->buflen = %d\n", results->buflen);
- *status = dtoh32(list_buf->status);
+ *status = le32_to_cpu(list_buf->status);
*bss_list = results;
return err;
@@ -3274,7 +3271,7 @@ static s32 wl_event_handler(void *data)
void
wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t * e, void *data)
{
- u32 event_type = ntoh32(e->event_type);
+ u32 event_type = be32_to_cpu(e->event_type);
struct wl_priv *wl = ndev_to_wl(ndev);
#if (WL_DBG_LEVEL > 0)
s8 *estr = (event_type <= sizeof(wl_dbg_estr) / WL_DBG_ESTR_MAX - 1) ?
@@ -3393,8 +3390,8 @@ static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype)
WL_ERR("invalid type (%d)\n", iftype);
return err;
}
- infra = htod32(infra);
- ap = htod32(ap);
+ infra = cpu_to_le32(infra);
+ ap = cpu_to_le32(ap);
WL_DBG("%s ap (%d), infra (%d)\n", ndev->name, ap, infra);
err = wl_dev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra));
if (unlikely(err)) {
@@ -3656,26 +3653,28 @@ static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode)
pkt_filterp = (struct wl_pkt_filter *)(buf + str_len + 1);
/* Parse packet filter id. */
- pkt_filter.id = htod32(100);
+ pkt_filter.id = cpu_to_le32(100);
/* Parse filter polarity. */
- pkt_filter.negate_match = htod32(0);
+ pkt_filter.negate_match = cpu_to_le32(0);
/* Parse filter type. */
- pkt_filter.type = htod32(0);
+ pkt_filter.type = cpu_to_le32(0);
/* Parse pattern filter offset. */
- pkt_filter.u.pattern.offset = htod32(0);
+ pkt_filter.u.pattern.offset = cpu_to_le32(0);
/* Parse pattern filter mask. */
- mask_size = htod32(wl_pattern_atoh("0xff",
- (char *)pkt_filterp->u.pattern.
- mask_and_pattern));
+ mask_size = cpu_to_le32(wl_pattern_atoh("0xff",
+ (char *)pkt_filterp->u.pattern.
+ mask_and_pattern));
/* Parse pattern filter pattern. */
- pattern_size = htod32(wl_pattern_atoh("0x00",
- (char *)&pkt_filterp->u.pattern.
- mask_and_pattern[mask_size]));
+ pattern_size = cpu_to_le32(wl_pattern_atoh("0x00",
+ (char *)&pkt_filterp->u.
+ pattern.
+ mask_and_pattern
+ [mask_size]));
if (mask_size != pattern_size) {
WL_ERR("Mask and pattern not the same size\n");
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index 482691be210a..5112160e0ae3 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -20,7 +20,6 @@
#include <linux/wireless.h>
#include <linux/wireless.h>
#include <net/cfg80211.h>
-#include <proto/ethernet.h>
#include <wlioctl.h>
struct wl_conf;
@@ -29,23 +28,6 @@ struct wl_priv;
struct wl_security;
struct wl_ibss;
-#if defined(IL_BIGENDIAN)
-#include <bcmendian.h>
-#define htod32(i) (bcmswap32(i))
-#define htod16(i) (bcmswap16(i))
-#define dtoh32(i) (bcmswap32(i))
-#define dtoh16(i) (bcmswap16(i))
-#define htodchanspec(i) htod16(i)
-#define dtohchanspec(i) dtoh16(i)
-#else
-#define htod32(i) i
-#define htod16(i) i
-#define dtoh32(i) i
-#define dtoh16(i) i
-#define htodchanspec(i) i
-#define dtohchanspec(i) i
-#endif
-
#define WL_DBG_NONE 0
#define WL_DBG_DBG (1 << 2)
#define WL_DBG_INFO (1 << 1)
@@ -316,7 +298,7 @@ struct wl_priv {
cfg80211 layer */
struct wl_ie ie; /* information element object for
internal purpose */
- struct ether_addr bssid; /* bssid of currently engaged network */
+ u8 bssid[ETH_ALEN]; /* bssid of currently engaged network */
struct semaphore event_sync; /* for synchronization of main event
thread */
struct wl_profile *profile; /* holding dongle profile */
@@ -366,7 +348,8 @@ static inline struct wl_bss_info *next_bss(struct wl_scan_results *list,
{
return bss = bss ?
(struct wl_bss_info *)((unsigned long)bss +
- dtoh32(bss->length)) : list->bss_info;
+ le32_to_cpu(bss->length)) :
+ list->bss_info;
}
#define for_each_bss(list, bss, __i) \
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
index db6e68eab290..b49957fb7586 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
@@ -18,12 +18,9 @@
#include <linux/semaphore.h>
#include <bcmdefs.h>
#include <linux/netdevice.h>
-#include <osl.h>
#include <wlioctl.h>
#include <bcmutils.h>
-#include <bcmendian.h>
-#include <proto/ethernet.h>
#include <linux/if_arp.h>
#include <asm/uaccess.h>
@@ -31,11 +28,10 @@
#include <dngl_stats.h>
#include <dhd.h>
#include <dhdioctl.h>
-
+#include <linux/ieee80211.h>
typedef const struct si_pub si_t;
#include <wlioctl.h>
-#include <proto/ethernet.h>
#include <dngl_stats.h>
#include <dhd.h>
@@ -72,23 +68,6 @@ uint wl_msg_level = WL_ERROR_VAL;
#define MAX_WLIW_IOCTL_LEN 1024
-#if defined(IL_BIGENDIAN)
-#include <bcmendian.h>
-#define htod32(i) (bcmswap32(i))
-#define htod16(i) (bcmswap16(i))
-#define dtoh32(i) (bcmswap32(i))
-#define dtoh16(i) (bcmswap16(i))
-#define htodchanspec(i) htod16(i)
-#define dtohchanspec(i) dtoh16(i)
-#else
-#define htod32(i) i
-#define htod16(i) i
-#define dtoh32(i) i
-#define dtoh16(i) i
-#define htodchanspec(i) i
-#define dtohchanspec(i) i
-#endif
-
#ifdef CONFIG_WIRELESS_EXT
extern struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev);
@@ -137,6 +116,9 @@ typedef struct iscan_info {
int iscan_ex_param_size;
} iscan_info_t;
iscan_info_t *g_iscan;
+
+static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};
+
static void wl_iw_timerfunc(unsigned long data);
static void wl_iw_set_event_mask(struct net_device *dev);
static int wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, u16 action);
@@ -158,24 +140,24 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
static void swap_key_from_BE(wl_wsec_key_t *key)
{
- key->index = htod32(key->index);
- key->len = htod32(key->len);
- key->algo = htod32(key->algo);
- key->flags = htod32(key->flags);
- key->rxiv.hi = htod32(key->rxiv.hi);
- key->rxiv.lo = htod16(key->rxiv.lo);
- key->iv_initialized = htod32(key->iv_initialized);
+ key->index = cpu_to_le32(key->index);
+ key->len = cpu_to_le32(key->len);
+ key->algo = cpu_to_le32(key->algo);
+ key->flags = cpu_to_le32(key->flags);
+ key->rxiv.hi = cpu_to_le32(key->rxiv.hi);
+ key->rxiv.lo = cpu_to_le16(key->rxiv.lo);
+ key->iv_initialized = cpu_to_le32(key->iv_initialized);
}
static void swap_key_to_BE(wl_wsec_key_t *key)
{
- key->index = dtoh32(key->index);
- key->len = dtoh32(key->len);
- key->algo = dtoh32(key->algo);
- key->flags = dtoh32(key->flags);
- key->rxiv.hi = dtoh32(key->rxiv.hi);
- key->rxiv.lo = dtoh16(key->rxiv.lo);
- key->iv_initialized = dtoh32(key->iv_initialized);
+ key->index = le32_to_cpu(key->index);
+ key->len = le32_to_cpu(key->len);
+ key->algo = le32_to_cpu(key->algo);
+ key->flags = le32_to_cpu(key->flags);
+ key->rxiv.hi = le32_to_cpu(key->rxiv.hi);
+ key->rxiv.lo = le16_to_cpu(key->rxiv.lo);
+ key->iv_initialized = le32_to_cpu(key->iv_initialized);
}
static int dev_wlc_ioctl(struct net_device *dev, int cmd, void *arg, int len)
@@ -223,7 +205,7 @@ static int dev_wlc_intvar_set(struct net_device *dev, char *name, int val)
char buf[WLC_IOCTL_SMLEN];
uint len;
- val = htod32(val);
+ val = cpu_to_le32(val);
len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf));
ASSERT(len);
@@ -288,7 +270,7 @@ dev_wlc_bufvar_get(struct net_device *dev, char *name, char *buf, int buflen)
dev_wlc_ioctl(dev, WLC_GET_VAR, (void *)ioctlbuf,
MAX_WLIW_IOCTL_LEN);
if (!error)
- bcopy(ioctlbuf, buf, buflen);
+ memcpy(buf, ioctlbuf, buflen);
return error;
}
@@ -310,7 +292,7 @@ static int dev_wlc_intvar_get(struct net_device *dev, char *name, int *retval)
ASSERT(len);
error = dev_wlc_ioctl(dev, WLC_GET_VAR, (void *)&var, len);
- *retval = dtoh32(var.val);
+ *retval = le32_to_cpu(var.val);
return error;
}
@@ -340,7 +322,7 @@ wl_iw_config_commit(struct net_device *dev,
if (error)
return error;
- ssid.SSID_len = dtoh32(ssid.SSID_len);
+ ssid.SSID_len = le32_to_cpu(ssid.SSID_len);
if (!ssid.SSID_len)
return 0;
@@ -392,7 +374,7 @@ wl_iw_set_freq(struct net_device *dev,
chan = wf_mhz2channel(fwrq->m, sf);
}
- chan = htod32(chan);
+ chan = cpu_to_le32(chan);
error = dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan));
if (error)
@@ -415,8 +397,8 @@ wl_iw_get_freq(struct net_device *dev,
if (error)
return error;
- fwrq->m = dtoh32(ci.hw_channel);
- fwrq->e = dtoh32(0);
+ fwrq->m = le32_to_cpu(ci.hw_channel);
+ fwrq->e = le32_to_cpu(0);
return 0;
}
@@ -441,8 +423,8 @@ wl_iw_set_mode(struct net_device *dev,
default:
return -EINVAL;
}
- infra = htod32(infra);
- ap = htod32(ap);
+ infra = cpu_to_le32(infra);
+ ap = cpu_to_le32(ap);
error = dev_wlc_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra));
if (error)
@@ -471,8 +453,8 @@ wl_iw_get_mode(struct net_device *dev,
if (error)
return error;
- infra = dtoh32(infra);
- ap = dtoh32(ap);
+ infra = le32_to_cpu(infra);
+ ap = le32_to_cpu(ap);
*uwrq = infra ? ap ? IW_MODE_MASTER : IW_MODE_INFRA : IW_MODE_ADHOC;
return 0;
@@ -488,7 +470,7 @@ wl_iw_get_range(struct net_device *dev,
wl_rateset_t rateset;
s8 *channels;
int error, i, k;
- uint sf, ch;
+ uint ch;
int phytype;
int bw_cap = 0, sgi_tx = 0, nmode = 0;
@@ -517,23 +499,24 @@ wl_iw_get_range(struct net_device *dev,
range->min_nwid = range->max_nwid = 0;
- list->count = htod32(MAXCHANNEL);
+ list->count = cpu_to_le32(MAXCHANNEL);
error = dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels,
(MAXCHANNEL + 1) * 4);
if (error) {
kfree(channels);
return error;
}
- for (i = 0; i < dtoh32(list->count) && i < IW_MAX_FREQUENCIES; i++) {
- range->freq[i].i = dtoh32(list->element[i]);
-
- ch = dtoh32(list->element[i]);
- if (ch <= CH_MAX_2G_CHANNEL)
- sf = WF_CHAN_FACTOR_2_4_G;
- else
- sf = WF_CHAN_FACTOR_5_G;
+ for (i = 0; i < le32_to_cpu(list->count) && i < IW_MAX_FREQUENCIES;
+ i++) {
+ range->freq[i].i = le32_to_cpu(list->element[i]);
- range->freq[i].m = wf_channel2mhz(ch, sf);
+ ch = le32_to_cpu(list->element[i]);
+ if (ch <= CH_MAX_2G_CHANNEL) {
+ range->freq[i].m = ieee80211_dsss_chan_to_freq(ch);
+ } else {
+ range->freq[i].m = ieee80211_ofdm_chan_to_freq(
+ WF_CHAN_FACTOR_5_G/2, ch);
+ }
range->freq[i].e = 6;
}
range->num_frequency = range->num_channels = i;
@@ -555,7 +538,7 @@ wl_iw_get_range(struct net_device *dev,
kfree(channels);
return error;
}
- rateset.count = dtoh32(rateset.count);
+ rateset.count = le32_to_cpu(rateset.count);
range->num_bitrates = rateset.count;
for (i = 0; i < rateset.count && i < IW_MAX_BITRATES; i++)
range->bitrate[i] = (rateset.rates[i] & 0x7f) * 500000;
@@ -567,7 +550,7 @@ wl_iw_get_range(struct net_device *dev,
dev_wlc_intvar_get(dev, "sgi_tx", &sgi_tx);
dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci,
sizeof(channel_info_t));
- ci.hw_channel = dtoh32(ci.hw_channel);
+ ci.hw_channel = le32_to_cpu(ci.hw_channel);
if (bw_cap == 0 || (bw_cap == 2 && ci.hw_channel <= 14)) {
if (sgi_tx == 0)
@@ -593,7 +576,7 @@ wl_iw_get_range(struct net_device *dev,
kfree(channels);
return error;
}
- i = dtoh32(i);
+ i = le32_to_cpu(i);
if (i == WLC_PHY_TYPE_A)
range->throughput = 24000000;
else
@@ -606,14 +589,14 @@ wl_iw_get_range(struct net_device *dev,
range->max_encoding_tokens = DOT11_MAX_DEFAULT_KEYS;
range->num_encoding_sizes = 4;
- range->encoding_size[0] = WEP1_KEY_SIZE;
- range->encoding_size[1] = WEP128_KEY_SIZE;
+ range->encoding_size[0] = WLAN_KEY_LEN_WEP40;
+ range->encoding_size[1] = WLAN_KEY_LEN_WEP104;
#if WIRELESS_EXT > 17
- range->encoding_size[2] = TKIP_KEY_SIZE;
+ range->encoding_size[2] = WLAN_KEY_LEN_TKIP;
#else
range->encoding_size[2] = 0;
#endif
- range->encoding_size[3] = AES_KEY_SIZE;
+ range->encoding_size[3] = WLAN_KEY_LEN_AES_CMAC;
range->min_pmp = 0;
range->max_pmp = 0;
@@ -690,7 +673,7 @@ wl_iw_set_spy(struct net_device *dev,
iw->spy_num = min_t(int, ARRAY_SIZE(iw->spy_addr), dwrq->length);
for (i = 0; i < iw->spy_num; i++)
- memcpy(&iw->spy_addr[i], addr[i].sa_data, ETH_ALEN);
+ memcpy(iw->spy_addr[i], addr[i].sa_data, ETH_ALEN);
memset(iw->spy_qual, 0, sizeof(iw->spy_qual));
return 0;
@@ -712,7 +695,7 @@ wl_iw_get_spy(struct net_device *dev,
dwrq->length = iw->spy_num;
for (i = 0; i < iw->spy_num; i++) {
- memcpy(addr[i].sa_data, &iw->spy_addr[i], ETH_ALEN);
+ memcpy(addr[i].sa_data, iw->spy_addr[i], ETH_ALEN);
addr[i].sa_family = AF_UNIX;
memcpy(&qual[i], &iw->spy_qual[i], sizeof(struct iw_quality));
iw->spy_qual[i].updated = 0;
@@ -745,10 +728,10 @@ wl_iw_ch_to_chanspec(int ch, wl_join_params_t *join_params,
join_params->params.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK;
join_params->params.chanspec_list[0] |= chanspec;
join_params->params.chanspec_list[0] =
- htodchanspec(join_params->params.chanspec_list[0]);
+ cpu_to_le16(join_params->params.chanspec_list[0]);
join_params->params.chanspec_num =
- htod32(join_params->params.chanspec_num);
+ cpu_to_le32(join_params->params.chanspec_num);
WL_TRACE("%s join_params->params.chanspec_list[0]= %X\n",
__func__, join_params->params.chanspec_list[0]);
@@ -784,7 +767,7 @@ wl_iw_set_wap(struct net_device *dev,
join_params_size = sizeof(join_params.ssid);
memcpy(join_params.ssid.SSID, g_ssid.SSID, g_ssid.SSID_len);
- join_params.ssid.SSID_len = htod32(g_ssid.SSID_len);
+ join_params.ssid.SSID_len = cpu_to_le32(g_ssid.SSID_len);
memcpy(&join_params.params.bssid, awrq->sa_data, ETH_ALEN);
WL_TRACE("%s target_channel=%d\n",
@@ -840,15 +823,15 @@ wl_iw_mlme(struct net_device *dev,
}
scbval.val = mlme->reason_code;
- bcopy(&mlme->addr.sa_data, &scbval.ea, ETH_ALEN);
+ memcpy(&scbval.ea, &mlme->addr.sa_data, ETH_ALEN);
if (mlme->cmd == IW_MLME_DISASSOC) {
- scbval.val = htod32(scbval.val);
+ scbval.val = cpu_to_le32(scbval.val);
error =
dev_wlc_ioctl(dev, WLC_DISASSOC, &scbval,
sizeof(scb_val_t));
} else if (mlme->cmd == IW_MLME_DEAUTH) {
- scbval.val = htod32(scbval.val);
+ scbval.val = cpu_to_le32(scbval.val);
error =
dev_wlc_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON,
&scbval, sizeof(scb_val_t));
@@ -879,20 +862,19 @@ wl_iw_get_aplist(struct net_device *dev,
if (!extra)
return -EINVAL;
- list = kmalloc(buflen, GFP_KERNEL);
+ list = kzalloc(buflen, GFP_KERNEL);
if (!list)
return -ENOMEM;
- memset(list, 0, buflen);
- list->buflen = htod32(buflen);
+ list->buflen = cpu_to_le32(buflen);
error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, buflen);
if (error) {
WL_ERROR("%d: Scan results error %d\n", __LINE__, error);
kfree(list);
return error;
}
- list->buflen = dtoh32(list->buflen);
- list->version = dtoh32(list->version);
- list->count = dtoh32(list->count);
+ list->buflen = le32_to_cpu(list->buflen);
+ list->version = le32_to_cpu(list->version);
+ list->count = le32_to_cpu(list->count);
if (list->version != WL_BSS_INFO_VERSION) {
WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n",
__func__, list->version);
@@ -903,18 +885,18 @@ wl_iw_get_aplist(struct net_device *dev,
for (i = 0, dwrq->length = 0;
i < list->count && dwrq->length < IW_MAX_AP; i++) {
bi = bi ? (wl_bss_info_t *) ((unsigned long)bi +
- dtoh32(bi->length)) : list->
+ le32_to_cpu(bi->length)) : list->
bss_info;
- ASSERT(((unsigned long)bi + dtoh32(bi->length)) <=
+ ASSERT(((unsigned long)bi + le32_to_cpu(bi->length)) <=
((unsigned long)list + buflen));
- if (!(dtoh16(bi->capability) & DOT11_CAP_ESS))
+ if (!(le16_to_cpu(bi->capability) & WLAN_CAPABILITY_ESS))
continue;
memcpy(addr[dwrq->length].sa_data, &bi->BSSID, ETH_ALEN);
addr[dwrq->length].sa_family = ARPHRD_ETHER;
- qual[dwrq->length].qual = rssi_to_qual(dtoh16(bi->RSSI));
- qual[dwrq->length].level = 0x100 + dtoh16(bi->RSSI);
+ qual[dwrq->length].qual = rssi_to_qual(le16_to_cpu(bi->RSSI));
+ qual[dwrq->length].level = 0x100 + le16_to_cpu(bi->RSSI);
qual[dwrq->length].noise = 0x100 + bi->phy_noise;
#if WIRELESS_EXT > 18
@@ -975,20 +957,22 @@ wl_iw_iscan_get_aplist(struct net_device *dev,
for (i = 0, dwrq->length = 0;
i < list->count && dwrq->length < IW_MAX_AP; i++) {
bi = bi ? (wl_bss_info_t *) ((unsigned long)bi +
- dtoh32(bi->length)) :
+ le32_to_cpu(bi->length)) :
list->bss_info;
- ASSERT(((unsigned long)bi + dtoh32(bi->length)) <=
+ ASSERT(((unsigned long)bi + le32_to_cpu(bi->length)) <=
((unsigned long)list + WLC_IW_ISCAN_MAXLEN));
- if (!(dtoh16(bi->capability) & DOT11_CAP_ESS))
+ if (!(le16_to_cpu(bi->capability) &
+ WLAN_CAPABILITY_ESS))
continue;
memcpy(addr[dwrq->length].sa_data, &bi->BSSID,
ETH_ALEN);
addr[dwrq->length].sa_family = ARPHRD_ETHER;
qual[dwrq->length].qual =
- rssi_to_qual(dtoh16(bi->RSSI));
- qual[dwrq->length].level = 0x100 + dtoh16(bi->RSSI);
+ rssi_to_qual(le16_to_cpu(bi->RSSI));
+ qual[dwrq->length].level = 0x100 +
+ le16_to_cpu(bi->RSSI);
qual[dwrq->length].noise = 0x100 + bi->phy_noise;
#if WIRELESS_EXT > 18
@@ -1015,7 +999,7 @@ static int wl_iw_iscan_prep(wl_scan_params_t *params, wlc_ssid_t *ssid)
{
int err = 0;
- memcpy(&params->bssid, &ether_bcast, ETH_ALEN);
+ memcpy(params->bssid, ether_bcast, ETH_ALEN);
params->bss_type = DOT11_BSSTYPE_ANY;
params->scan_type = 0;
params->nprobes = -1;
@@ -1024,10 +1008,10 @@ static int wl_iw_iscan_prep(wl_scan_params_t *params, wlc_ssid_t *ssid)
params->home_time = -1;
params->channel_num = 0;
- params->nprobes = htod32(params->nprobes);
- params->active_time = htod32(params->active_time);
- params->passive_time = htod32(params->passive_time);
- params->home_time = htod32(params->home_time);
+ params->nprobes = cpu_to_le32(params->nprobes);
+ params->active_time = cpu_to_le32(params->active_time);
+ params->passive_time = cpu_to_le32(params->passive_time);
+ params->home_time = cpu_to_le32(params->home_time);
if (ssid && ssid->SSID_len)
memcpy(&params->ssid, ssid, sizeof(wlc_ssid_t));
@@ -1038,9 +1022,9 @@ static int wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, u16 action)
{
int err = 0;
- iscan->iscan_ex_params_p->version = htod32(ISCAN_REQ_VERSION);
- iscan->iscan_ex_params_p->action = htod16(action);
- iscan->iscan_ex_params_p->scan_duration = htod16(0);
+ iscan->iscan_ex_params_p->version = cpu_to_le32(ISCAN_REQ_VERSION);
+ iscan->iscan_ex_params_p->action = cpu_to_le16(action);
+ iscan->iscan_ex_params_p->scan_duration = cpu_to_le16(0);
WL_SCAN("%s : nprobes=%d\n",
__func__, iscan->iscan_ex_params_p->params.nprobes);
@@ -1077,7 +1061,7 @@ static void wl_iw_set_event_mask(struct net_device *dev)
char iovbuf[WL_EVENTING_MASK_LEN + 12];
dev_iw_iovar_getbuf(dev, "event_msgs", "", 0, iovbuf, sizeof(iovbuf));
- bcopy(iovbuf, eventmask, WL_EVENTING_MASK_LEN);
+ memcpy(eventmask, iovbuf, WL_EVENTING_MASK_LEN);
setbit(eventmask, WLC_E_SCAN_COMPLETE);
dev_iw_iovar_setbuf(dev, "event_msgs", eventmask, WL_EVENTING_MASK_LEN,
iovbuf, sizeof(iovbuf));
@@ -1124,19 +1108,19 @@ static u32 wl_iw_iscan_get(iscan_info_t *iscan)
results->count = 0;
memset(&list, 0, sizeof(list));
- list.results.buflen = htod32(WLC_IW_ISCAN_MAXLEN);
+ list.results.buflen = cpu_to_le32(WLC_IW_ISCAN_MAXLEN);
res = dev_iw_iovar_getbuf(iscan->dev,
"iscanresults",
&list,
WL_ISCAN_RESULTS_FIXED_SIZE,
buf->iscan_buf, WLC_IW_ISCAN_MAXLEN);
if (res == 0) {
- results->buflen = dtoh32(results->buflen);
- results->version = dtoh32(results->version);
- results->count = dtoh32(results->count);
+ results->buflen = le32_to_cpu(results->buflen);
+ results->version = le32_to_cpu(results->version);
+ results->count = le32_to_cpu(results->count);
WL_TRACE("results->count = %d\n", results->count);
WL_TRACE("results->buflen = %d\n", results->buflen);
- status = dtoh32(list_buf->status);
+ status = le32_to_cpu(list_buf->status);
} else {
WL_ERROR("%s returns error %d\n", __func__, res);
status = WL_SCAN_RESULTS_NO_MEM;
@@ -1283,7 +1267,7 @@ wl_iw_set_scan(struct net_device *dev,
memcpy(g_specific_ssid.SSID, req->essid,
g_specific_ssid.SSID_len);
g_specific_ssid.SSID_len =
- htod32(g_specific_ssid.SSID_len);
+ cpu_to_le32(g_specific_ssid.SSID_len);
g_scan_specified_ssid = 1;
WL_TRACE("### Specific scan ssid=%s len=%d\n",
g_specific_ssid.SSID,
@@ -1367,7 +1351,7 @@ wl_iw_iscan_set_scan(struct net_device *dev,
if (g_scan_specified_ssid) {
WL_TRACE("%s Specific SCAN already running ignoring BC scan\n",
__func__);
- return EBUSY;
+ return -EBUSY;
}
memset(&ssid, 0, sizeof(ssid));
@@ -1379,7 +1363,7 @@ wl_iw_iscan_set_scan(struct net_device *dev,
ssid.SSID_len = min_t(size_t, sizeof(ssid.SSID),
req->essid_len);
memcpy(ssid.SSID, req->essid, ssid.SSID_len);
- ssid.SSID_len = htod32(ssid.SSID_len);
+ ssid.SSID_len = cpu_to_le32(ssid.SSID_len);
} else {
g_scan_specified_ssid = 0;
@@ -1505,7 +1489,7 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
}
bi = bi ? (wl_bss_info_t *)((unsigned long)bi +
- dtoh32(bi->length)) : list->
+ le32_to_cpu(bi->length)) : list->
bss_info;
WL_TRACE("%s : %s\n", __func__, bi->SSID);
@@ -1516,14 +1500,15 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
event =
IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
IW_EV_ADDR_LEN);
- iwe.u.data.length = dtoh32(bi->SSID_len);
+ iwe.u.data.length = le32_to_cpu(bi->SSID_len);
iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1;
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, bi->SSID);
- if (dtoh16(bi->capability) & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) {
+ if (le16_to_cpu(bi->capability) & (WLAN_CAPABILITY_ESS |
+ WLAN_CAPABILITY_IBSS)) {
iwe.cmd = SIOCGIWMODE;
- if (dtoh16(bi->capability) & DOT11_CAP_ESS)
+ if (le16_to_cpu(bi->capability) & WLAN_CAPABILITY_ESS)
iwe.u.mode = IW_MODE_INFRA;
else
iwe.u.mode = IW_MODE_ADHOC;
@@ -1533,19 +1518,23 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
}
iwe.cmd = SIOCGIWFREQ;
- iwe.u.freq.m = wf_channel2mhz(CHSPEC_CHANNEL(bi->chanspec),
- CHSPEC_CHANNEL(bi->chanspec) <=
- CH_MAX_2G_CHANNEL ?
- WF_CHAN_FACTOR_2_4_G :
- WF_CHAN_FACTOR_5_G);
+
+ if (CHSPEC_CHANNEL(bi->chanspec) <= CH_MAX_2G_CHANNEL)
+ iwe.u.freq.m = ieee80211_dsss_chan_to_freq(
+ CHSPEC_CHANNEL(bi->chanspec));
+ else
+ iwe.u.freq.m = ieee80211_ofdm_chan_to_freq(
+ WF_CHAN_FACTOR_5_G/2,
+ CHSPEC_CHANNEL(bi->chanspec));
+
iwe.u.freq.e = 6;
event =
IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
IW_EV_FREQ_LEN);
iwe.cmd = IWEVQUAL;
- iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI));
- iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI);
+ iwe.u.qual.qual = rssi_to_qual(le16_to_cpu(bi->RSSI));
+ iwe.u.qual.level = 0x100 + le16_to_cpu(bi->RSSI);
iwe.u.qual.noise = 0x100 + bi->phy_noise;
event =
IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
@@ -1554,7 +1543,7 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
wl_iw_handle_scanresults_ies(&event, end, info, bi);
iwe.cmd = SIOCGIWENCODE;
- if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY)
+ if (le16_to_cpu(bi->capability) & WLAN_CAPABILITY_PRIVACY)
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
else
iwe.u.data.flags = IW_ENCODE_DISABLED;
@@ -1621,7 +1610,7 @@ wl_iw_get_scan(struct net_device *dev,
error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci));
if (error)
return error;
- ci.scan_channel = dtoh32(ci.scan_channel);
+ ci.scan_channel = le32_to_cpu(ci.scan_channel);
if (ci.scan_channel)
return -EAGAIN;
@@ -1636,7 +1625,7 @@ wl_iw_get_scan(struct net_device *dev,
}
memset(list, 0, len);
- list->buflen = htod32(len);
+ list->buflen = cpu_to_le32(len);
error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, len);
if (error) {
WL_ERROR("%s: %s : Scan_results ERROR %d\n",
@@ -1648,9 +1637,9 @@ wl_iw_get_scan(struct net_device *dev,
}
return 0;
}
- list->buflen = dtoh32(list->buflen);
- list->version = dtoh32(list->version);
- list->count = dtoh32(list->count);
+ list->buflen = le32_to_cpu(list->buflen);
+ list->version = le32_to_cpu(list->version);
+ list->count = le32_to_cpu(list->count);
if (list->version != WL_BSS_INFO_VERSION) {
WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n",
@@ -1770,9 +1759,9 @@ wl_iw_iscan_get_scan(struct net_device *dev,
for (ii = 0; ii < list->count && apcnt < IW_MAX_AP;
apcnt++, ii++) {
bi = bi ? (wl_bss_info_t *)((unsigned long)bi +
- dtoh32(bi->length)) :
+ le32_to_cpu(bi->length)) :
list->bss_info;
- ASSERT(((unsigned long)bi + dtoh32(bi->length)) <=
+ ASSERT(((unsigned long)bi + le32_to_cpu(bi->length)) <=
((unsigned long)list + WLC_IW_ISCAN_MAXLEN));
if (event + ETH_ALEN + bi->SSID_len +
@@ -1787,17 +1776,18 @@ wl_iw_iscan_get_scan(struct net_device *dev,
IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
IW_EV_ADDR_LEN);
- iwe.u.data.length = dtoh32(bi->SSID_len);
+ iwe.u.data.length = le32_to_cpu(bi->SSID_len);
iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1;
event =
IWE_STREAM_ADD_POINT(info, event, end, &iwe,
bi->SSID);
- if (dtoh16(bi->capability) &
- (DOT11_CAP_ESS | DOT11_CAP_IBSS)) {
+ if (le16_to_cpu(bi->capability) &
+ (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
iwe.cmd = SIOCGIWMODE;
- if (dtoh16(bi->capability) & DOT11_CAP_ESS)
+ if (le16_to_cpu(bi->capability) &
+ WLAN_CAPABILITY_ESS)
iwe.u.mode = IW_MODE_INFRA;
else
iwe.u.mode = IW_MODE_ADHOC;
@@ -1810,20 +1800,23 @@ wl_iw_iscan_get_scan(struct net_device *dev,
channel =
(bi->ctl_ch ==
0) ? CHSPEC_CHANNEL(bi->chanspec) : bi->ctl_ch;
- iwe.u.freq.m =
- wf_channel2mhz(channel,
- channel <=
- CH_MAX_2G_CHANNEL ?
- WF_CHAN_FACTOR_2_4_G :
- WF_CHAN_FACTOR_5_G);
+
+ if (channel <= CH_MAX_2G_CHANNEL)
+ iwe.u.freq.m =
+ ieee80211_dsss_chan_to_freq(channel);
+ else
+ iwe.u.freq.m = ieee80211_ofdm_chan_to_freq(
+ WF_CHAN_FACTOR_5_G/2,
+ channel);
+
iwe.u.freq.e = 6;
event =
IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
IW_EV_FREQ_LEN);
iwe.cmd = IWEVQUAL;
- iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI));
- iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI);
+ iwe.u.qual.qual = rssi_to_qual(le16_to_cpu(bi->RSSI));
+ iwe.u.qual.level = 0x100 + le16_to_cpu(bi->RSSI);
iwe.u.qual.noise = 0x100 + bi->phy_noise;
event =
IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
@@ -1832,7 +1825,8 @@ wl_iw_iscan_get_scan(struct net_device *dev,
wl_iw_handle_scanresults_ies(&event, end, info, bi);
iwe.cmd = SIOCGIWENCODE;
- if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY)
+ if (le16_to_cpu(bi->capability) &
+ WLAN_CAPABILITY_PRIVACY)
iwe.u.data.flags =
IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
else
@@ -1912,14 +1906,14 @@ wl_iw_set_essid(struct net_device *dev,
} else {
g_ssid.SSID_len = 0;
}
- g_ssid.SSID_len = htod32(g_ssid.SSID_len);
+ g_ssid.SSID_len = cpu_to_le32(g_ssid.SSID_len);
memset(&join_params, 0, sizeof(join_params));
join_params_size = sizeof(join_params.ssid);
memcpy(&join_params.ssid.SSID, g_ssid.SSID, g_ssid.SSID_len);
- join_params.ssid.SSID_len = htod32(g_ssid.SSID_len);
- memcpy(&join_params.params.bssid, &ether_bcast, ETH_ALEN);
+ join_params.ssid.SSID_len = cpu_to_le32(g_ssid.SSID_len);
+ memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params,
&join_params_size);
@@ -1955,7 +1949,7 @@ wl_iw_get_essid(struct net_device *dev,
return error;
}
- ssid.SSID_len = dtoh32(ssid.SSID_len);
+ ssid.SSID_len = le32_to_cpu(ssid.SSID_len);
memcpy(extra, ssid.SSID, ssid.SSID_len);
@@ -2017,7 +2011,7 @@ wl_iw_set_rate(struct net_device *dev,
if (error)
return error;
- rateset.count = dtoh32(rateset.count);
+ rateset.count = le32_to_cpu(rateset.count);
if (vwrq->value < 0)
rate = rateset.rates[rateset.count - 1] & 0x7f;
@@ -2042,7 +2036,7 @@ wl_iw_set_rate(struct net_device *dev,
for (i = 0; i < rateset.count; i++)
if ((rateset.rates[i] & 0x7f) > rate)
break;
- rateset.count = htod32(i);
+ rateset.count = cpu_to_le32(i);
error = dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset,
sizeof(rateset));
@@ -2064,7 +2058,7 @@ wl_iw_get_rate(struct net_device *dev,
error = dev_wlc_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate));
if (error)
return error;
- rate = dtoh32(rate);
+ rate = le32_to_cpu(rate);
vwrq->value = rate * 500000;
return 0;
@@ -2164,7 +2158,7 @@ wl_iw_set_txpow(struct net_device *dev,
disable = vwrq->disabled ? WL_RADIO_SW_DISABLE : 0;
disable += WL_RADIO_SW_DISABLE << 16;
- disable = htod32(disable);
+ disable = cpu_to_le32(disable);
error = dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable));
if (error)
return error;
@@ -2206,7 +2200,7 @@ wl_iw_get_txpow(struct net_device *dev,
if (error)
return error;
- disable = dtoh32(disable);
+ disable = le32_to_cpu(disable);
result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
vwrq->value = (s32) bcm_qdbm_to_mw(result);
vwrq->fixed = 0;
@@ -2241,7 +2235,7 @@ wl_iw_set_retry(struct net_device *dev,
if ((vwrq->flags & IW_RETRY_MAX)
|| !(vwrq->flags & IW_RETRY_MIN)) {
#endif
- lrl = htod32(vwrq->value);
+ lrl = cpu_to_le32(vwrq->value);
error = dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl,
sizeof(lrl));
if (error)
@@ -2256,7 +2250,7 @@ wl_iw_set_retry(struct net_device *dev,
if ((vwrq->flags & IW_RETRY_MIN)
|| !(vwrq->flags & IW_RETRY_MAX)) {
#endif
- srl = htod32(vwrq->value);
+ srl = cpu_to_le32(vwrq->value);
error = dev_wlc_ioctl(dev, WLC_SET_SRL, &srl,
sizeof(srl));
if (error)
@@ -2288,8 +2282,8 @@ wl_iw_get_retry(struct net_device *dev,
if (error)
return error;
- lrl = dtoh32(lrl);
- srl = dtoh32(srl);
+ lrl = le32_to_cpu(lrl);
+ srl = le32_to_cpu(srl);
if (vwrq->flags & IW_RETRY_MAX) {
vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
@@ -2320,12 +2314,12 @@ wl_iw_set_encode(struct net_device *dev,
if ((dwrq->flags & IW_ENCODE_INDEX) == 0) {
for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS;
key.index++) {
- val = htod32(key.index);
+ val = cpu_to_le32(key.index);
error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val,
sizeof(val));
if (error)
return error;
- val = dtoh32(val);
+ val = le32_to_cpu(val);
if (val)
break;
}
@@ -2338,7 +2332,7 @@ wl_iw_set_encode(struct net_device *dev,
}
if (!extra || !dwrq->length || (dwrq->flags & IW_ENCODE_NOKEY)) {
- val = htod32(key.index);
+ val = cpu_to_le32(key.index);
error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val,
sizeof(val));
if (error)
@@ -2353,16 +2347,16 @@ wl_iw_set_encode(struct net_device *dev,
key.flags = WL_PRIMARY_KEY;
switch (key.len) {
- case WEP1_KEY_SIZE:
+ case WLAN_KEY_LEN_WEP40:
key.algo = CRYPTO_ALGO_WEP1;
break;
- case WEP128_KEY_SIZE:
+ case WLAN_KEY_LEN_WEP104:
key.algo = CRYPTO_ALGO_WEP128;
break;
- case TKIP_KEY_SIZE:
+ case WLAN_KEY_LEN_TKIP:
key.algo = CRYPTO_ALGO_TKIP;
break;
- case AES_KEY_SIZE:
+ case WLAN_KEY_LEN_AES_CMAC:
key.algo = CRYPTO_ALGO_AES_CCM;
break;
default:
@@ -2389,7 +2383,7 @@ wl_iw_set_encode(struct net_device *dev,
return error;
val = (dwrq->flags & IW_ENCODE_RESTRICTED) ? 1 : 0;
- val = htod32(val);
+ val = cpu_to_le32(val);
error = dev_wlc_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val));
if (error)
return error;
@@ -2417,7 +2411,7 @@ wl_iw_get_encode(struct net_device *dev,
sizeof(val));
if (error)
return error;
- val = dtoh32(val);
+ val = le32_to_cpu(val);
if (val)
break;
}
@@ -2437,9 +2431,9 @@ wl_iw_get_encode(struct net_device *dev,
swap_key_to_BE(&key);
- wsec = dtoh32(wsec);
- auth = dtoh32(auth);
- dwrq->length = min_t(u16, DOT11_MAX_KEY_SIZE, key.len);
+ wsec = le32_to_cpu(wsec);
+ auth = le32_to_cpu(auth);
+ dwrq->length = min_t(u16, WLAN_MAX_KEY_LEN, key.len);
dwrq->flags = key.index + 1;
if (!(wsec & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED)))
@@ -2465,7 +2459,7 @@ wl_iw_set_power(struct net_device *dev,
pm = vwrq->disabled ? PM_OFF : PM_MAX;
- pm = htod32(pm);
+ pm = cpu_to_le32(pm);
error = dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm));
if (error)
return error;
@@ -2486,7 +2480,7 @@ wl_iw_get_power(struct net_device *dev,
if (error)
return error;
- pm = dtoh32(pm);
+ pm = le32_to_cpu(pm);
vwrq->disabled = pm ? 0 : 1;
vwrq->flags = IW_POWER_ALL_R;
@@ -2545,14 +2539,13 @@ wl_iw_set_encodeext(struct net_device *dev,
key.len = iwe->key_len;
if (!is_multicast_ether_addr(iwe->addr.sa_data))
- bcopy((void *)&iwe->addr.sa_data, (char *)&key.ea,
- ETH_ALEN);
+ memcpy(&key.ea, &iwe->addr.sa_data, ETH_ALEN);
if (key.len == 0) {
if (iwe->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
WL_WSEC("Changing the the primary Key to %d\n",
key.index);
- key.index = htod32(key.index);
+ key.index = cpu_to_le32(key.index);
error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY,
&key.index, sizeof(key.index));
if (error)
@@ -2571,13 +2564,13 @@ wl_iw_set_encodeext(struct net_device *dev,
key.flags = WL_PRIMARY_KEY;
}
- bcopy((void *)iwe->key, key.data, iwe->key_len);
+ memcpy(key.data, iwe->key, iwe->key_len);
if (iwe->alg == IW_ENCODE_ALG_TKIP) {
u8 keybuf[8];
- bcopy(&key.data[24], keybuf, sizeof(keybuf));
- bcopy(&key.data[16], &key.data[24], sizeof(keybuf));
- bcopy(keybuf, &key.data[16], sizeof(keybuf));
+ memcpy(keybuf, &key.data[24], sizeof(keybuf));
+ memcpy(&key.data[24], &key.data[16], sizeof(keybuf));
+ memcpy(&key.data[16], keybuf, sizeof(keybuf));
}
if (iwe->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
@@ -2594,7 +2587,7 @@ wl_iw_set_encodeext(struct net_device *dev,
key.algo = CRYPTO_ALGO_OFF;
break;
case IW_ENCODE_ALG_WEP:
- if (iwe->key_len == WEP1_KEY_SIZE)
+ if (iwe->key_len == WLAN_KEY_LEN_WEP40)
key.algo = CRYPTO_ALGO_WEP1;
else
key.algo = CRYPTO_ALGO_WEP128;
@@ -2651,14 +2644,16 @@ wl_iw_set_pmksa(struct net_device *dev,
uint j;
pmkidptr = &pmkid;
- bcopy(&iwpmksa->bssid.sa_data[0],
- &pmkidptr->pmkid[0].BSSID, ETH_ALEN);
- bcopy(&iwpmksa->pmkid[0], &pmkidptr->pmkid[0].PMKID,
- WPA2_PMKID_LEN);
+ memcpy(&pmkidptr->pmkid[0].BSSID,
+ &iwpmksa->bssid.sa_data[0],
+ ETH_ALEN);
+ memcpy(&pmkidptr->pmkid[0].PMKID,
+ &iwpmksa->pmkid[0],
+ WLAN_PMKID_LEN);
- WL_WSEC("wl_iw_set_pmksa:IW_PMKSA_REMOVE:PMKID: %pM = ",
- &pmkidptr->pmkid[0].BSSID);
- for (j = 0; j < WPA2_PMKID_LEN; j++)
+ WL_WSEC("wl_iw_set_pmksa:IW_PMKSA_REMOVE:PMKID: "
+ "%pM = ", &pmkidptr->pmkid[0].BSSID);
+ for (j = 0; j < WLAN_PMKID_LEN; j++)
WL_WSEC("%02x ", pmkidptr->pmkid[0].PMKID[j]);
WL_WSEC("\n");
}
@@ -2673,12 +2668,12 @@ wl_iw_set_pmksa(struct net_device *dev,
&& (i < pmkid_list.pmkids.npmkid)) {
memset(&pmkid_list.pmkids.pmkid[i], 0, sizeof(pmkid_t));
for (; i < (pmkid_list.pmkids.npmkid - 1); i++) {
- bcopy(&pmkid_list.pmkids.pmkid[i + 1].BSSID,
- &pmkid_list.pmkids.pmkid[i].BSSID,
- ETH_ALEN);
- bcopy(&pmkid_list.pmkids.pmkid[i + 1].PMKID,
- &pmkid_list.pmkids.pmkid[i].PMKID,
- WPA2_PMKID_LEN);
+ memcpy(&pmkid_list.pmkids.pmkid[i].BSSID,
+ &pmkid_list.pmkids.pmkid[i + 1].BSSID,
+ ETH_ALEN);
+ memcpy(&pmkid_list.pmkids.pmkid[i].PMKID,
+ &pmkid_list.pmkids.pmkid[i + 1].PMKID,
+ WLAN_PMKID_LEN);
}
pmkid_list.pmkids.npmkid--;
} else
@@ -2692,12 +2687,12 @@ wl_iw_set_pmksa(struct net_device *dev,
&pmkid_list.pmkids.pmkid[i].BSSID, ETH_ALEN))
break;
if (i < MAXPMKID) {
- bcopy(&iwpmksa->bssid.sa_data[0],
- &pmkid_list.pmkids.pmkid[i].BSSID,
- ETH_ALEN);
- bcopy(&iwpmksa->pmkid[0],
- &pmkid_list.pmkids.pmkid[i].PMKID,
- WPA2_PMKID_LEN);
+ memcpy(&pmkid_list.pmkids.pmkid[i].BSSID,
+ &iwpmksa->bssid.sa_data[0],
+ ETH_ALEN);
+ memcpy(&pmkid_list.pmkids.pmkid[i].PMKID,
+ &iwpmksa->pmkid[0],
+ WLAN_PMKID_LEN);
if (i == pmkid_list.pmkids.npmkid)
pmkid_list.pmkids.npmkid++;
} else
@@ -2708,7 +2703,7 @@ wl_iw_set_pmksa(struct net_device *dev,
k = pmkid_list.pmkids.npmkid;
WL_WSEC("wl_iw_set_pmksa,IW_PMKSA_ADD - PMKID: %pM = ",
&pmkid_list.pmkids.pmkid[k].BSSID);
- for (j = 0; j < WPA2_PMKID_LEN; j++)
+ for (j = 0; j < WLAN_PMKID_LEN; j++)
WL_WSEC("%02x ",
pmkid_list.pmkids.pmkid[k].PMKID[j]);
WL_WSEC("\n");
@@ -2720,7 +2715,7 @@ wl_iw_set_pmksa(struct net_device *dev,
uint j;
WL_WSEC("PMKID[%d]: %pM = ",
i, &pmkid_list.pmkids.pmkid[i].BSSID);
- for (j = 0; j < WPA2_PMKID_LEN; j++)
+ for (j = 0; j < WLAN_PMKID_LEN; j++)
WL_WSEC("%02x ", pmkid_list.pmkids.pmkid[i].PMKID[j]);
WL_WSEC("\n");
}
@@ -3342,9 +3337,9 @@ wl_iw_conn_status_str(u32 event_type, u32 status, u32 reason,
static bool
wl_iw_check_conn_fail(wl_event_msg_t *e, char *stringBuf, uint buflen)
{
- u32 event = ntoh32(e->event_type);
- u32 status = ntoh32(e->status);
- u32 reason = ntoh32(e->reason);
+ u32 event = be32_to_cpu(e->event_type);
+ u32 status = be32_to_cpu(e->status);
+ u32 reason = be32_to_cpu(e->reason);
if (wl_iw_conn_status_str(event, status, reason, stringBuf, buflen)) {
return true;
@@ -3363,10 +3358,10 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
union iwreq_data wrqu;
char extra[IW_CUSTOM_MAX + 1];
int cmd = 0;
- u32 event_type = ntoh32(e->event_type);
- u16 flags = ntoh16(e->flags);
- u32 datalen = ntoh32(e->datalen);
- u32 status = ntoh32(e->status);
+ u32 event_type = be32_to_cpu(e->event_type);
+ u16 flags = be16_to_cpu(e->flags);
+ u32 datalen = be32_to_cpu(e->datalen);
+ u32 status = be32_to_cpu(e->status);
wl_iw_t *iw;
u32 toto;
memset(&wrqu, 0, sizeof(wrqu));
@@ -3409,8 +3404,6 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
if (!(flags & WLC_EVENT_MSG_LINK)) {
memset(wrqu.addr.sa_data, 0, ETH_ALEN);
memset(&extra, 0, ETH_ALEN);
- WAKE_LOCK_TIMEOUT(iw->pub, WAKE_LOCK_LINK_DOWN_TMOUT,
- 20 * HZ);
} else {
memcpy(wrqu.addr.sa_data, &e->addr, ETH_ALEN);
WL_TRACE("Link UP\n");
@@ -3436,10 +3429,10 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
wrqu.data.length = sizeof(status) + 1;
extra[0] = WLC_E_ACTION_FRAME_COMPLETE;
memcpy(&extra[1], &status, sizeof(status));
- printf("wl_iw_event status %d PacketId %d\n", status,
- toto);
- printf("WLC_E_ACTION_FRAME_COMPLETE len %d\n",
- wrqu.data.length);
+ WL_TRACE("wl_iw_event status %d PacketId %d\n", status,
+ toto);
+ WL_TRACE("WLC_E_ACTION_FRAME_COMPLETE len %d\n",
+ wrqu.data.length);
}
break;
#endif /* WIRELESS_EXT > 14 */
@@ -3471,9 +3464,8 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
cmd = IWEVPMKIDCAND;
pmkcandlist = data;
- count =
- ntoh32_ua((u8 *) &
- pmkcandlist->npmkid_cand);
+ count = get_unaligned_be32(&pmkcandlist->
+ npmkid_cand);
ASSERT(count >= 0);
wrqu.data.length = sizeof(struct iw_pmkid_cand);
pmkidcand = pmkcandlist->pmkid_cand;
@@ -3483,9 +3475,9 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
if (pmkidcand->preauth)
iwpmkidcand->flags |=
IW_PMKID_CAND_PREAUTH;
- bcopy(&pmkidcand->BSSID,
- &iwpmkidcand->bssid.sa_data,
- ETH_ALEN);
+ memcpy(&iwpmkidcand->bssid.sa_data,
+ &pmkidcand->BSSID,
+ ETH_ALEN);
#ifndef SANDGATE2G
wireless_send_event(dev, cmd, &wrqu,
extra);
@@ -3523,8 +3515,6 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
WL_ERROR("%s Event WLC_E_PFN_NET_FOUND, send %s up : find %s len=%d\n",
__func__, PNO_EVENT_UP,
ssid->SSID, ssid->SSID_len);
- WAKE_LOCK_TIMEOUT(iw->pub, WAKE_LOCK_PNO_FIND_TMOUT,
- 20 * HZ);
cmd = IWEVCUSTOM;
memset(&wrqu, 0, sizeof(wrqu));
strcpy(extra, PNO_EVENT_UP);
@@ -3562,7 +3552,7 @@ int
wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats)
{
int res = 0;
- wl_cnt_t cnt;
+ struct wl_cnt cnt;
int phy_noise;
int rssi;
scb_val_t scb_val;
@@ -3573,7 +3563,7 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats)
if (res)
goto done;
- phy_noise = dtoh32(phy_noise);
+ phy_noise = le32_to_cpu(phy_noise);
WL_TRACE("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise);
memset(&scb_val, 0, sizeof(scb_val_t));
@@ -3581,7 +3571,7 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats)
if (res)
goto done;
- rssi = dtoh32(scb_val.val);
+ rssi = le32_to_cpu(scb_val.val);
WL_TRACE("wl_iw_get_wireless_stats rssi=%d\n", rssi);
if (rssi <= WL_IW_RSSI_NO_SIGNAL)
wstats->qual.qual = 0;
@@ -3605,47 +3595,50 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats)
#endif
#if WIRELESS_EXT > 11
- WL_TRACE("wl_iw_get_wireless_stats counters=%zu\n", sizeof(wl_cnt_t));
+ WL_TRACE("wl_iw_get_wireless_stats counters=%zu\n",
+ sizeof(struct wl_cnt));
- memset(&cnt, 0, sizeof(wl_cnt_t));
+ memset(&cnt, 0, sizeof(struct wl_cnt));
res =
- dev_wlc_bufvar_get(dev, "counters", (char *)&cnt, sizeof(wl_cnt_t));
+ dev_wlc_bufvar_get(dev, "counters", (char *)&cnt,
+ sizeof(struct wl_cnt));
if (res) {
WL_ERROR("wl_iw_get_wireless_stats counters failed error=%d\n",
res);
goto done;
}
- cnt.version = dtoh16(cnt.version);
+ cnt.version = le16_to_cpu(cnt.version);
if (cnt.version != WL_CNT_T_VERSION) {
- WL_TRACE("\tIncorrect version of counters struct: expected %d; got %d\n",
+ WL_TRACE("\tIncorrect counter version: expected %d; got %d\n",
WL_CNT_T_VERSION, cnt.version);
goto done;
}
wstats->discard.nwid = 0;
- wstats->discard.code = dtoh32(cnt.rxundec);
- wstats->discard.fragment = dtoh32(cnt.rxfragerr);
- wstats->discard.retries = dtoh32(cnt.txfail);
- wstats->discard.misc = dtoh32(cnt.rxrunt) + dtoh32(cnt.rxgiant);
+ wstats->discard.code = le32_to_cpu(cnt.rxundec);
+ wstats->discard.fragment = le32_to_cpu(cnt.rxfragerr);
+ wstats->discard.retries = le32_to_cpu(cnt.txfail);
+ wstats->discard.misc = le32_to_cpu(cnt.rxrunt) +
+ le32_to_cpu(cnt.rxgiant);
wstats->miss.beacon = 0;
WL_TRACE("wl_iw_get_wireless_stats counters txframe=%d txbyte=%d\n",
- dtoh32(cnt.txframe), dtoh32(cnt.txbyte));
+ le32_to_cpu(cnt.txframe), le32_to_cpu(cnt.txbyte));
WL_TRACE("wl_iw_get_wireless_stats counters rxfrmtoolong=%d\n",
- dtoh32(cnt.rxfrmtoolong));
+ le32_to_cpu(cnt.rxfrmtoolong));
WL_TRACE("wl_iw_get_wireless_stats counters rxbadplcp=%d\n",
- dtoh32(cnt.rxbadplcp));
+ le32_to_cpu(cnt.rxbadplcp));
WL_TRACE("wl_iw_get_wireless_stats counters rxundec=%d\n",
- dtoh32(cnt.rxundec));
+ le32_to_cpu(cnt.rxundec));
WL_TRACE("wl_iw_get_wireless_stats counters rxfragerr=%d\n",
- dtoh32(cnt.rxfragerr));
+ le32_to_cpu(cnt.rxfragerr));
WL_TRACE("wl_iw_get_wireless_stats counters txfail=%d\n",
- dtoh32(cnt.txfail));
+ le32_to_cpu(cnt.txfail));
WL_TRACE("wl_iw_get_wireless_stats counters rxrunt=%d\n",
- dtoh32(cnt.rxrunt));
+ le32_to_cpu(cnt.rxrunt));
WL_TRACE("wl_iw_get_wireless_stats counters rxgiant=%d\n",
- dtoh32(cnt.rxgiant));
+ le32_to_cpu(cnt.rxgiant));
#endif /* WIRELESS_EXT > 11 */
done:
@@ -3673,11 +3666,10 @@ int wl_iw_attach(struct net_device *dev, void *dhdp)
params_size =
(WL_SCAN_PARAMS_FIXED_SIZE + offsetof(wl_iscan_params_t, params));
#endif
- iscan = kmalloc(sizeof(iscan_info_t), GFP_KERNEL);
+ iscan = kzalloc(sizeof(iscan_info_t), GFP_KERNEL);
if (!iscan)
return -ENOMEM;
- memset(iscan, 0, sizeof(iscan_info_t));
iscan->iscan_ex_params_p = kmalloc(params_size, GFP_KERNEL);
if (!iscan->iscan_ex_params_p)
@@ -3711,11 +3703,10 @@ int wl_iw_attach(struct net_device *dev, void *dhdp)
priv_dev = dev;
MUTEX_LOCK_SOFTAP_SET_INIT(iw->pub);
#endif
- g_scan = kmalloc(G_SCAN_RESULTS, GFP_KERNEL);
+ g_scan = kzalloc(G_SCAN_RESULTS, GFP_KERNEL);
if (!g_scan)
return -ENOMEM;
- memset(g_scan, 0, G_SCAN_RESULTS);
g_scan_specified_ssid = 0;
return 0;
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.h b/drivers/staging/brcm80211/brcmfmac/wl_iw.h
index c8637c50dc17..fe06174cee7d 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_iw.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.h
@@ -19,7 +19,6 @@
#include <linux/wireless.h>
-#include <proto/ethernet.h>
#include <wlioctl.h>
#define WL_SCAN_PARAMS_SSID_MAX 10
@@ -92,7 +91,7 @@ typedef struct wl_iw {
u32 gwsec;
bool privacy_invoked;
- struct ether_addr spy_addr[IW_MAX_SPY];
+ u8 spy_addr[IW_MAX_SPY][ETH_ALEN];
struct iw_quality spy_qual[IW_MAX_SPY];
void *wlinfo;
dhd_pub_t *pub;
@@ -140,10 +139,4 @@ extern int dhd_dev_get_pno_status(struct net_device *dev);
#define PNO_TLV_TYPE_TIME 'T'
#define PNO_EVENT_UP "PNO_EVENT"
-typedef struct cmd_tlv {
- char prefix;
- char version;
- char subver;
- char reserved;
-} cmd_tlv_t;
#endif /* _wl_iw_h_ */