diff options
Diffstat (limited to 'drivers/staging/brcm80211/brcmfmac')
18 files changed, 1004 insertions, 1183 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/README b/drivers/staging/brcm80211/brcmfmac/README index 43601fa..be29e42 100644 --- a/drivers/staging/brcm80211/brcmfmac/README +++ b/drivers/staging/brcm80211/brcmfmac/README @@ -25,8 +25,9 @@ Firmware is available from the Linux firmware repository at: http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git https://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git -For 4329 chip, copy brcm/bcm4329-fullmac-4-218-248-5.bin and -bcm4329-fullmac-4-218-248-5.txt to /lib/firmware/brcm +For 4329 chip, copy brcm/bcm4329-fullmac-4.bin and brcm/bcm4329-fullmac-4.txt +to /lib/firmware/brcm (or wherever firmware is normally installed on your +system). Contact Info: ============= diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c index 4c613da..acf43a3 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c @@ -16,13 +16,14 @@ /* ****************** BCMSDH Interface Functions *************************** */ #include <linux/types.h> +#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> -#include <osl.h> #include <bcmsdh.h> /* BRCM API for SDIO clients (such as wl, dhd) */ @@ -38,7 +39,7 @@ 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 */ - osl_t *osh; + struct osl_info *osh; bool regfail; /* Save status of last reg_read/reg_write call */ u32 sbwad; /* Save backplane window address */ @@ -55,7 +56,8 @@ void bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable) } #endif -bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq) +bcmsdh_info_t *bcmsdh_attach(struct osl_info *osh, void *cfghdl, + void **regsva, uint irq) { bcmsdh_info_t *bcmsdh; @@ -84,7 +86,7 @@ bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq) return bcmsdh; } -int bcmsdh_detach(osl_t *osh, void *sdh) +int bcmsdh_detach(struct osl_info *osh, void *sdh) { bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; @@ -451,7 +453,7 @@ bool bcmsdh_regfail(void *sdh) int bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags, - u8 *buf, uint nbytes, void *pkt, + u8 *buf, uint nbytes, struct sk_buff *pkt, bcmsdh_cmplt_fn_t complete, void *handle) { bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c index 9028cd0..d24b5e7 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c @@ -20,8 +20,7 @@ #define __UNDEF_NO_VERSION__ -#include <linuxver.h> - +#include <linux/netdevice.h> #include <linux/pci.h> #include <linux/completion.h> @@ -57,7 +56,7 @@ struct bcmsdh_hc { #else struct pci_dev *dev; /* pci device handle */ #endif /* BCMPLATFORM_BUS */ - osl_t *osh; + struct osl_info *osh; void *regs; /* SDIO Host Controller address */ bcmsdh_info_t *sdh; /* SDIO Host Controller handle */ void *ch; @@ -139,22 +138,11 @@ static int __devexit bcmsdh_remove(struct device *dev); #endif /* BCMLXSDMMC */ #ifndef BCMLXSDMMC -static struct device_driver bcmsdh_driver = { - .name = "pxa2xx-mci", - .bus = &platform_bus_type, - .probe = bcmsdh_probe, - .remove = bcmsdh_remove, - .suspend = NULL, - .resume = NULL, -}; -#endif /* BCMLXSDMMC */ - -#ifndef BCMLXSDMMC static #endif /* BCMLXSDMMC */ int bcmsdh_probe(struct device *dev) { - osl_t *osh = NULL; + struct osl_info *osh = NULL; bcmsdh_hc_t *sdhc = NULL; unsigned long regs = 0; bcmsdh_info_t *sdh = NULL; @@ -189,7 +177,7 @@ int bcmsdh_probe(struct device *dev) } #endif /* defined(OOB_INTR_ONLY) */ /* allocate SDIO Host Controller state info */ - osh = osl_attach(dev, PCI_BUS, false); + osh = osl_attach(dev, PCI_BUS); if (!osh) { SDLX_MSG(("%s: osl_attach failed\n", __func__)); goto err; @@ -258,7 +246,7 @@ static int bcmsdh_remove(struct device *dev) { bcmsdh_hc_t *sdhc, *prev; - osl_t *osh; + struct osl_info *osh; sdhc = sdhcinfo; drvinfo.detach(sdhc->ch); @@ -291,269 +279,23 @@ int bcmsdh_remove(struct device *dev) return 0; } - -#else /* BCMPLATFORM_BUS */ - -#if !defined(BCMLXSDMMC) -/* forward declarations for PCI probe and remove functions. */ -static int __devinit bcmsdh_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *ent); -static void __devexit bcmsdh_pci_remove(struct pci_dev *pdev); - -/** - * pci id table - */ -static struct pci_device_id bcmsdh_pci_devid[] __devinitdata = { -{ - .vendor = PCI_ANY_ID, - .device = PCI_ANY_ID, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .class = 0, - .class_mask = 0, - .driver_data = 0, -}, -{0,} -}; - -MODULE_DEVICE_TABLE(pci, bcmsdh_pci_devid); - -/** - * SDIO Host Controller pci driver info - */ -static struct pci_driver bcmsdh_pci_driver = { - .node = {}, - .name = "bcmsdh", - .id_table = bcmsdh_pci_devid, - .probe = bcmsdh_pci_probe, - .remove = bcmsdh_pci_remove, - .suspend = NULL, - .resume = NULL, -}; - -extern uint sd_pci_slot; /* Force detection to a particular PCI */ - /* slot only . Allows for having multiple */ - /* WL devices at once in a PC */ - /* Only one instance of dhd will be */ - /* usable at a time */ - /* Upper word is bus number, */ - /* lower word is slot number */ - /* Default value of 0xFFFFffff turns this */ - /* off */ -module_param(sd_pci_slot, uint, 0); - -/** - * Detect supported SDIO Host Controller and attach if found. - * - * Determine if the device described by pdev is a supported SDIO Host - * Controller. If so, attach to it and attach to the target device. - */ -static int __devinit -bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - osl_t *osh = NULL; - bcmsdh_hc_t *sdhc = NULL; - unsigned long regs; - bcmsdh_info_t *sdh = NULL; - int rc; - - if (sd_pci_slot != 0xFFFFffff) { - if (pdev->bus->number != (sd_pci_slot >> 16) || - PCI_SLOT(pdev->devfn) != (sd_pci_slot & 0xffff)) { - SDLX_MSG(("%s: %s: bus %X, slot %X, vend %X, dev %X\n", - __func__, - bcmsdh_chipmatch(pdev->vendor, pdev->device) ? - "Found compatible SDIOHC" : - "Probing unknown device", - pdev->bus->number, PCI_SLOT(pdev->devfn), - pdev->vendor, pdev->device)); - return -ENODEV; - } - SDLX_MSG(("%s: %s: bus %X, slot %X, vendor %X, device %X " - "(good PCI location)\n", __func__, - bcmsdh_chipmatch(pdev->vendor, pdev->device) ? - "Using compatible SDIOHC" : "WARNING, forced use " - "of unkown device", - pdev->bus->number, PCI_SLOT(pdev->devfn), pdev->vendor, - pdev->device)); - } - - if ((pdev->vendor == VENDOR_TI) - && ((pdev->device == PCIXX21_FLASHMEDIA_ID) - || (pdev->device == PCIXX21_FLASHMEDIA0_ID))) { - u32 config_reg; - - SDLX_MSG(("%s: Disabling TI FlashMedia Controller.\n", - __func__)); - osh = osl_attach(pdev, PCI_BUS, false); - if (!osh) { - SDLX_MSG(("%s: osl_attach failed\n", __func__)); - goto err; - } - - config_reg = OSL_PCI_READ_CONFIG(osh, 0x4c, 4); - - /* - * Set MMC_SD_DIS bit in FlashMedia Controller. - * Disbling the SD/MMC Controller in the FlashMedia Controller - * allows the Standard SD Host Controller to take over control - * of the SD Slot. - */ - config_reg |= 0x02; - OSL_PCI_WRITE_CONFIG(osh, 0x4c, 4, config_reg); - osl_detach(osh); - } - /* match this pci device with what we support */ - /* we can't solely rely on this to believe it is - our SDIO Host Controller! */ - if (!bcmsdh_chipmatch(pdev->vendor, pdev->device)) - return -ENODEV; - - /* this is a pci device we might support */ - SDLX_MSG(("%s: Found possible SDIO Host Controller: " - "bus %d slot %d func %d irq %d\n", __func__, - pdev->bus->number, PCI_SLOT(pdev->devfn), - PCI_FUNC(pdev->devfn), pdev->irq)); - - /* use bcmsdh_query_device() to get the vendor ID of the target device - * so it will eventually appear in the Broadcom string on the console - */ - - /* allocate SDIO Host Controller state info */ - osh = osl_attach(pdev, PCI_BUS, false); - 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 = pdev; - - /* map to address where host can access */ - pci_set_master(pdev); - rc = pci_enable_device(pdev); - if (rc) { - SDLX_MSG(("%s: Cannot enable PCI device\n", __func__)); - goto err; - } - sdh = bcmsdh_attach(osh, (void *)(unsigned long)pci_resource_start(pdev, 0), - (void **)®s, pdev->irq); - if (!sdh) { - SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__)); - goto err; - } - - sdhc->sdh = sdh; - - /* try to attach to the target device */ - sdhc->ch = drvinfo.attach(VENDOR_BROADCOM, /* pdev->vendor, */ - bcmsdh_query_device(sdh) & 0xFFFF, 0, 0, 0, 0, - (void *)regs, NULL, sdh); - if (!sdhc->ch) { - SDLX_MSG(("%s: device attach failed\n", __func__)); - goto err; - } - - /* chain SDIO Host Controller info together */ - sdhc->next = sdhcinfo; - sdhcinfo = sdhc; - - return 0; - - /* error handling */ -err: - if (sdhc->sdh) - bcmsdh_detach(sdhc->osh, sdhc->sdh); - if (sdhc) - kfree(sdhc); - if (osh) - osl_detach(osh); - return -ENODEV; -} - -/** - * Detach from target devices and SDIO Host Controller - */ -static void __devexit bcmsdh_pci_remove(struct pci_dev *pdev) -{ - bcmsdh_hc_t *sdhc, *prev; - osl_t *osh; - - /* 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) { - if (sdhc->dev == pdev) { - if (prev) - prev->next = sdhc->next; - else - sdhcinfo = NULL; - break; - } - prev = sdhc; - } - if (!sdhc) - return; - - drvinfo.detach(sdhc->ch); - - bcmsdh_detach(sdhc->osh, sdhc->sdh); - - /* release SDIO Host Controller info */ - osh = sdhc->osh; - kfree(sdhc); - osl_detach(osh); -} -#endif /* BCMLXSDMMC */ #endif /* BCMPLATFORM_BUS */ extern int sdio_function_init(void); int bcmsdh_register(bcmsdh_driver_t *driver) { - int error = 0; - drvinfo = *driver; -#if defined(BCMPLATFORM_BUS) -#if defined(BCMLXSDMMC) SDLX_MSG(("Linux Kernel SDIO/MMC Driver\n")); - error = sdio_function_init(); -#else - SDLX_MSG(("Intel PXA270 SDIO Driver\n")); - error = driver_register(&bcmsdh_driver); -#endif /* defined(BCMLXSDMMC) */ - return error; -#endif /* defined(BCMPLATFORM_BUS) */ - -#if !defined(BCMPLATFORM_BUS) && !defined(BCMLXSDMMC) - error = pci_register_driver(&bcmsdh_pci_driver); - if (!error) - return 0; - - SDLX_MSG(("%s: pci_register_driver failed 0x%x\n", __func__, error)); -#endif /* BCMPLATFORM_BUS */ - - return error; + return sdio_function_init(); } extern void sdio_function_cleanup(void); void bcmsdh_unregister(void) { -#if defined(BCMPLATFORM_BUS) && !defined(BCMLXSDMMC) - driver_unregister(&bcmsdh_driver); -#endif -#if defined(BCMLXSDMMC) sdio_function_cleanup(); -#endif /* BCMLXSDMMC */ -#if !defined(BCMPLATFORM_BUS) && !defined(BCMLXSDMMC) - pci_unregister_driver(&bcmsdh_pci_driver); -#endif /* BCMPLATFORM_BUS */ } #if defined(OOB_INTR_ONLY) diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c index f6c9c45..d399b5c 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c @@ -14,11 +14,12 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <linux/types.h> +#include <linux/netdevice.h> #include <bcmdefs.h> #include <bcmdevs.h> #include <bcmendian.h> -#include <bcmutils.h> #include <osl.h> +#include <bcmutils.h> #include <sdio.h> /* SDIO Device and Protocol Specs */ #include <sdioh.h> /* SDIO Host Controller Specification */ #include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */ @@ -111,7 +112,7 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) /* * Public entry points & extern's */ -extern sdioh_info_t *sdioh_attach(osl_t *osh, void *bar0, uint irq) +extern sdioh_info_t *sdioh_attach(struct osl_info *osh, void *bar0, uint irq) { sdioh_info_t *sd; int err_ret; @@ -174,7 +175,7 @@ extern sdioh_info_t *sdioh_attach(osl_t *osh, void *bar0, uint irq) return sd; } -extern SDIOH_API_RC sdioh_detach(osl_t *osh, sdioh_info_t *sd) +extern SDIOH_API_RC sdioh_detach(struct osl_info *osh, sdioh_info_t *sd) { sd_trace(("%s\n", __func__)); @@ -750,7 +751,7 @@ sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length) sd_trace(("%s: Func = %d\n", __func__, func)); if (!sd->func_cis_ptr[func]) { - bzero(cis, length); + memset(cis, 0, length); sd_err(("%s: no func_cis_ptr[%d]\n", __func__, func)); return SDIOH_API_RC_FAIL; } @@ -927,13 +928,13 @@ sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, static SDIOH_API_RC sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, - uint addr, void *pkt) + uint addr, struct sk_buff *pkt) { bool fifo = (fix_inc == SDIOH_DATA_FIX); u32 SGCount = 0; int err_ret = 0; - void *pnext; + struct sk_buff *pnext; sd_trace(("%s: Enter\n", __func__)); @@ -943,8 +944,8 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, /* Claim host controller */ sdio_claim_host(gInstance->func[func]); - for (pnext = pkt; pnext; pnext = PKTNEXT(pnext)) { - uint pkt_len = PKTLEN(pnext); + for (pnext = pkt; pnext; pnext = pnext->next) { + uint pkt_len = pnext->len; pkt_len += 3; pkt_len &= 0xFFFFFFFC; @@ -961,23 +962,23 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, * is supposed to give * us something we can work with. */ - ASSERT(((u32) (PKTDATA(pkt)) & DMA_ALIGN_MASK) == 0); + ASSERT(((u32) (pkt->data) & DMA_ALIGN_MASK) == 0); if ((write) && (!fifo)) { err_ret = sdio_memcpy_toio(gInstance->func[func], addr, - ((u8 *) PKTDATA(pnext)), + ((u8 *) (pnext->data)), pkt_len); } else if (write) { err_ret = sdio_memcpy_toio(gInstance->func[func], addr, - ((u8 *) PKTDATA(pnext)), + ((u8 *) (pnext->data)), pkt_len); } else if (fifo) { err_ret = sdio_readsb(gInstance->func[func], - ((u8 *) PKTDATA(pnext)), + ((u8 *) (pnext->data)), addr, pkt_len); } else { err_ret = sdio_memcpy_fromio(gInstance->func[func], - ((u8 *) PKTDATA(pnext)), + ((u8 *) (pnext->data)), addr, pkt_len); } @@ -1025,10 +1026,10 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, uint func, uint addr, uint reg_width, uint buflen_u, - u8 *buffer, void *pkt) + u8 *buffer, struct sk_buff *pkt) { SDIOH_API_RC Status; - void *mypkt = NULL; + struct sk_buff *mypkt = NULL; sd_trace(("%s: Enter\n", __func__)); @@ -1038,52 +1039,52 @@ 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 = PKTGET(sd->osh, buflen_u, write ? true : false); + mypkt = pkt_buf_get_skb(sd->osh, buflen_u); if (!mypkt) { - sd_err(("%s: PKTGET failed: len %d\n", + sd_err(("%s: pkt_buf_get_skb failed: len %d\n", __func__, buflen_u)); return SDIOH_API_RC_FAIL; } /* For a write, copy the buffer data into the packet. */ if (write) - bcopy(buffer, PKTDATA(mypkt), buflen_u); + bcopy(buffer, mypkt->data, 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(PKTDATA(mypkt), buffer, buflen_u); + bcopy(mypkt->data, buffer, buflen_u); - PKTFREE(sd->osh, mypkt, write ? true : false); - } else if (((u32) (PKTDATA(pkt)) & DMA_ALIGN_MASK) != 0) { + pkt_buf_free_skb(sd->osh, mypkt, write ? true : false); + } else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) { /* Case 2: We have a packet, but it is unaligned. */ /* In this case, we cannot have a chain. */ - ASSERT(PKTNEXT(pkt) == NULL); + ASSERT(pkt->next == NULL); sd_data(("%s: Creating aligned %s Packet, len=%d\n", - __func__, write ? "TX" : "RX", PKTLEN(pkt))); - mypkt = PKTGET(sd->osh, PKTLEN(pkt), write ? true : false); + __func__, write ? "TX" : "RX", pkt->len)); + mypkt = pkt_buf_get_skb(sd->osh, pkt->len); if (!mypkt) { - sd_err(("%s: PKTGET failed: len %d\n", - __func__, PKTLEN(pkt))); + sd_err(("%s: pkt_buf_get_skb failed: len %d\n", + __func__, pkt->len)); return SDIOH_API_RC_FAIL; } /* For a write, copy the buffer data into the packet. */ if (write) - bcopy(PKTDATA(pkt), PKTDATA(mypkt), PKTLEN(pkt)); + bcopy(pkt->data, mypkt->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(PKTDATA(mypkt), PKTDATA(pkt), PKTLEN(mypkt)); + bcopy(mypkt->data, pkt->data, mypkt->len); - PKTFREE(sd->osh, mypkt, write ? true : false); + pkt_buf_free_skb(sd->osh, mypkt, write ? true : false); } 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_linux.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c index ae7b566..ceaa474 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c @@ -15,7 +15,9 @@ */ #include <linux/types.h> #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 */ @@ -211,7 +213,7 @@ int sdio_function_init(void) if (!gInstance) return -ENOMEM; - bzero(&sdmmc_dev, sizeof(sdmmc_dev)); + memset(&sdmmc_dev, 0, sizeof(sdmmc_dev)); error = sdio_register_driver(&bcmsdh_sdmmc_driver); return error; diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h index 57d06b2..69c6a02 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd.h +++ b/drivers/staging/brcm80211/brcmfmac/dhd.h @@ -77,7 +77,7 @@ enum dhd_prealloc_index { /* Common structure for module and instance linkage */ typedef struct dhd_pub { /* Linkage ponters */ - osl_t *osh; /* OSL handle */ + 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 */ @@ -277,15 +277,16 @@ typedef struct dhd_if_event { */ /* To allow osl_attach/detach calls from os-independent modules */ -osl_t *dhd_osl_attach(void *pdev, uint bustype); -void dhd_osl_detach(osl_t *osh); +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(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen); +extern dhd_pub_t *dhd_attach(struct osl_info *osh, struct dhd_bus *bus, + uint bus_hdrlen); extern int dhd_net_attach(dhd_pub_t *dhdp, int idx); /* Indication from bus module regarding removal/absence of dongle */ @@ -294,10 +295,12 @@ extern void dhd_detach(dhd_pub_t *dhdp); /* Indication from bus module to change flow-control state */ extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on); -extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec); +extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, + struct sk_buff *pkt, int prec); /* Receive frame for delivery to OS. Callee disposes of rxp. */ -extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *rxp, int numpkt); +extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, + struct sk_buff *rxp, int numpkt); /* Return pointer to interface name */ extern char *dhd_ifname(dhd_pub_t *dhdp, int idx); @@ -306,7 +309,7 @@ extern char *dhd_ifname(dhd_pub_t *dhdp, int idx); extern void dhd_sched_dpc(dhd_pub_t *dhdp); /* Notify tx completion */ -extern void dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success); +extern void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success); /* Query ioctl */ extern int dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, @@ -377,7 +380,7 @@ extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, unsigned char * cp, int len); /* Send packet to dongle via data channel */ -extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pkt); +extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pkt); /* Send event to host */ extern void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h index 3b39c99..cd0d540 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h +++ b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h @@ -26,8 +26,8 @@ extern int dhd_bus_register(void); extern void dhd_bus_unregister(void); /* Download firmware image and nvram image */ -extern bool dhd_bus_download_firmware(struct dhd_bus *bus, osl_t * osh, - char *fw_path, char *nv_path); +extern bool dhd_bus_download_firmware(struct dhd_bus *bus, + struct osl_info *osh, 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); @@ -36,7 +36,7 @@ extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex); extern int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex); /* Send a data frame to the dongle. Callee disposes of txp. */ -extern int dhd_bus_txdata(struct dhd_bus *bus, void *txp); +extern int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *txp); /* Send/receive a control message to/from the dongle. * Expects caller to enforce a single outstanding transaction. diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c index bcbaac9..b7b527f 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c @@ -15,6 +15,7 @@ */ #include <linux/types.h> +#include <linux/netdevice.h> #include <bcmdefs.h> #include <osl.h> @@ -297,6 +298,15 @@ done: return ret; } +#define PKTSUMNEEDED(skb) \ + (((struct sk_buff *)(skb))->ip_summed == CHECKSUM_PARTIAL) +#define PKTSETSUMGOOD(skb, x) \ + (((struct sk_buff *)(skb))->ip_summed = \ + ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE)) + +/* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because + skb->ip_summed is overloaded */ + int dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name, void *params, int plen, void *arg, int len, bool set) @@ -309,7 +319,7 @@ void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf) bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid); } -void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, void *pktbuf) +void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) { #ifdef BDC struct bdc_header *h; @@ -320,33 +330,33 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, void *pktbuf) #ifdef BDC /* Push BDC header used to convey priority for buses that don't */ - PKTPUSH(pktbuf, BDC_HEADER_LEN); + skb_push(pktbuf, BDC_HEADER_LEN); - h = (struct bdc_header *)PKTDATA(pktbuf); + h = (struct bdc_header *)(pktbuf->data); h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT); if (PKTSUMNEEDED(pktbuf)) h->flags |= BDC_FLAG_SUM_NEEDED; - h->priority = (PKTPRIO(pktbuf) & BDC_PRIORITY_MASK); + h->priority = (pktbuf->priority & BDC_PRIORITY_MASK); h->flags2 = 0; h->rssi = 0; #endif /* BDC */ BDC_SET_IF_IDX(h, ifidx); } -bool dhd_proto_fcinfo(dhd_pub_t *dhd, void *pktbuf, u8 * fcbits) +bool dhd_proto_fcinfo(dhd_pub_t *dhd, struct sk_buff *pktbuf, u8 * fcbits) { #ifdef BDC struct bdc_header *h; - if (PKTLEN(pktbuf) < BDC_HEADER_LEN) { + if (pktbuf->len < BDC_HEADER_LEN) { DHD_ERROR(("%s: rx data too short (%d < %d)\n", - __func__, PKTLEN(pktbuf), BDC_HEADER_LEN)); + __func__, pktbuf->len, BDC_HEADER_LEN)); return BCME_ERROR; } - h = (struct bdc_header *)PKTDATA(pktbuf); + h = (struct bdc_header *)(pktbuf->data); *fcbits = h->priority >> BDC_PRIORITY_FC_SHIFT; if ((h->flags2 & BDC_FLAG2_FC_FLAG) == BDC_FLAG2_FC_FLAG) @@ -355,7 +365,7 @@ bool dhd_proto_fcinfo(dhd_pub_t *dhd, void *pktbuf, u8 * fcbits) return false; } -int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf) +int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) { #ifdef BDC struct bdc_header *h; @@ -366,13 +376,13 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf) #ifdef BDC /* Pop BDC header used to convey priority for buses that don't */ - if (PKTLEN(pktbuf) < BDC_HEADER_LEN) { + if (pktbuf->len < BDC_HEADER_LEN) { DHD_ERROR(("%s: rx data too short (%d < %d)\n", __func__, - PKTLEN(pktbuf), BDC_HEADER_LEN)); + pktbuf->len, BDC_HEADER_LEN)); return BCME_ERROR; } - h = (struct bdc_header *)PKTDATA(pktbuf); + h = (struct bdc_header *)(pktbuf->data); *ifidx = BDC_GET_IF_IDX(h); if (*ifidx >= DHD_MAX_IFS) { @@ -395,9 +405,9 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf) PKTSETSUMGOOD(pktbuf, true); } - PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK)); + pktbuf->priority = h->priority & BDC_PRIORITY_MASK; - PKTPULL(pktbuf, BDC_HEADER_LEN); + skb_pull(pktbuf, BDC_HEADER_LEN); #endif /* BDC */ return 0; @@ -467,7 +477,7 @@ int dhd_prot_init(dhd_pub_t *dhd) dhd_os_proto_unblock(dhd); return ret; } - memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN); + memcpy(dhd->mac.octet, 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 703188f..3dbf72e 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c @@ -16,6 +16,7 @@ #include <linux/kernel.h> #include <linux/string.h> #include <bcmdefs.h> +#include <linux/netdevice.h> #include <osl.h> #include <bcmutils.h> #include <bcmendian.h> @@ -326,9 +327,10 @@ void dhd_store_conn_status(u32 event, u32 status, u32 reason) } } -bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec) +bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, + int prec) { - void *p; + struct sk_buff *p; int eprec = -1; /* precedence to evict from */ bool discard_oldest; @@ -366,7 +368,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec) ASSERT(p); } - PKTFREE(dhdp->osh, p, true); + pkt_buf_free_skb(dhdp->osh, p, true); } /* Enqueue */ @@ -832,7 +834,7 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata, u16 flags; int evlen; - if (bcmp(BRCM_OUI, &pvt_data->bcm_hdr.oui[0], DOT11_OUI_LEN)) { + if (memcmp(BRCM_OUI, &pvt_data->bcm_hdr.oui[0], DOT11_OUI_LEN)) { DHD_ERROR(("%s: mismatched OUI, bailing\n", __func__)); return BCME_ERROR; } @@ -1254,7 +1256,7 @@ int dhd_preinit_ioctls(dhd_pub_t *dhd) */ ret = dhd_custom_get_mac_address(ea_addr.octet); if (!ret) { - bcm_mkiovar("cur_etheraddr", (void *)&ea_addr, ETHER_ADDR_LEN, + 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) { @@ -1262,7 +1264,7 @@ int dhd_preinit_ioctls(dhd_pub_t *dhd) __func__, ret)); } else memcpy(dhd->mac.octet, (void *)&ea_addr, - ETHER_ADDR_LEN); + ETH_ALEN); } #endif /* GET_CUSTOM_MAC_ENABLE */ @@ -1532,7 +1534,7 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip) break; if (!memcmp - (bi->BSSID.octet, addr, ETHER_ADDR_LEN)) { + (bi->BSSID.octet, addr, ETH_ALEN)) { DHD_ISCAN(("%s: Del BSS[%2.2d:%2.2d] " "%X:%X:%X:%X:%X:%X\n", __func__, l, i, bi->BSSID.octet[0], @@ -1670,7 +1672,7 @@ int dhd_iscan_request(void *dhdp, u16 action) char buf[WLC_IOCTL_SMLEN]; memset(¶ms, 0, sizeof(wl_iscan_params_t)); - memcpy(¶ms.params.bssid, ðer_bcast, ETHER_ADDR_LEN); + memcpy(¶ms.params.bssid, ðer_bcast, ETH_ALEN); params.params.bss_type = DOT11_BSSTYPE_ANY; params.params.scan_type = DOT11_SCANTYPE_ACTIVE; diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c b/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c index f647034..c3f18bb 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c @@ -14,7 +14,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <linuxver.h> +#include <linux/netdevice.h> #include <osl.h> #include <bcmutils.h> @@ -24,8 +24,8 @@ #include <wlioctl.h> #include <wl_iw.h> -#define WL_ERROR(x) printf x -#define WL_TRACE(x) +#define WL_ERROR(fmt, args...) printk(fmt, ##args) +#define WL_TRACE(fmt, args...) no_printk(fmt, ##args) #ifdef CUSTOMER_HW extern void bcm_wlan_power_off(int); @@ -67,13 +67,13 @@ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) #endif if (dhd_oob_gpio_num < 0) { - WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined\n", - __func__)); + WL_ERROR("%s: ERROR customer specific Host GPIO is NOT defined\n", + __func__); return dhd_oob_gpio_num; } - WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n", - __func__, dhd_oob_gpio_num)); + WL_ERROR("%s: customer specific Host GPIO number is (%d)\n", + __func__, dhd_oob_gpio_num); #if defined CUSTOMER_HW host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num); @@ -93,40 +93,40 @@ void dhd_customer_gpio_wlan_ctrl(int onoff) { switch (onoff) { case WLAN_RESET_OFF: - WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n", - __func__)); + WL_TRACE("%s: call customer specific GPIO to insert WLAN RESET\n", + __func__); #ifdef CUSTOMER_HW bcm_wlan_power_off(2); #endif /* CUSTOMER_HW */ #ifdef CUSTOMER_HW2 wifi_set_power(0, 0); #endif - WL_ERROR(("=========== WLAN placed in RESET ========\n")); + WL_ERROR("=========== WLAN placed in RESET ========\n"); break; case WLAN_RESET_ON: - WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n", - __func__)); + WL_TRACE("%s: callc customer specific GPIO to remove WLAN RESET\n", + __func__); #ifdef CUSTOMER_HW bcm_wlan_power_on(2); #endif /* CUSTOMER_HW */ #ifdef CUSTOMER_HW2 wifi_set_power(1, 0); #endif - WL_ERROR(("=========== WLAN going back to live ========\n")); + WL_ERROR("=========== WLAN going back to live ========\n"); break; case WLAN_POWER_OFF: - WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n", - __func__)); + WL_TRACE("%s: call customer specific GPIO to turn off WL_REG_ON\n", + __func__); #ifdef CUSTOMER_HW bcm_wlan_power_off(1); #endif /* CUSTOMER_HW */ break; case WLAN_POWER_ON: - WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n", - __func__)); + WL_TRACE("%s: call customer specific GPIO to turn on WL_REG_ON\n", + __func__); #ifdef CUSTOMER_HW bcm_wlan_power_on(1); #endif /* CUSTOMER_HW */ @@ -140,7 +140,7 @@ void dhd_customer_gpio_wlan_ctrl(int onoff) /* Function to get custom MAC address */ int dhd_custom_get_mac_address(unsigned char *buf) { - WL_TRACE(("%s Enter\n", __func__)); + WL_TRACE("%s Enter\n", __func__); if (!buf) return -EINVAL; diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c index 9335f02..db45083 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c @@ -32,7 +32,6 @@ #include <linux/fs.h> #include <linux/uaccess.h> #include <bcmdefs.h> -#include <linuxver.h> #include <osl.h> #include <bcmutils.h> #include <bcmendian.h> @@ -211,7 +210,7 @@ typedef struct dhd_if { int idx; /* iface idx in dongle */ int state; /* interface state */ uint subunit; /* subunit */ - u8 mac_addr[ETHER_ADDR_LEN]; /* assigned MAC address */ + u8 mac_addr[ETH_ALEN]; /* assigned MAC address */ bool attached; /* Delayed attachment when unset */ bool txflowcontrol; /* Per interface flow control indicator */ char name[IFNAMSIZ]; /* linux interface name */ @@ -709,7 +708,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) /* Send down the multicast list first. */ - buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETHER_ADDR_LEN); + buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETH_ALEN); bufp = buf = kmalloc(buflen, GFP_ATOMIC); if (!bufp) { DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n", @@ -727,8 +726,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) netdev_for_each_mc_addr(ha, dev) { if (!cnt) break; - memcpy(bufp, ha->addr, ETHER_ADDR_LEN); - bufp += ETHER_ADDR_LEN; + memcpy(bufp, ha->addr, ETH_ALEN); + bufp += ETH_ALEN; cnt--; } @@ -812,7 +811,7 @@ _dhd_set_mac_address(dhd_info_t *dhd, int ifidx, struct ether_addr *addr) DHD_TRACE(("%s enter\n", __func__)); if (!bcm_mkiovar - ("cur_etheraddr", (char *)addr, ETHER_ADDR_LEN, buf, 32)) { + ("cur_etheraddr", (char *)addr, ETH_ALEN, buf, 32)) { DHD_ERROR(("%s: mkiovar failed for cur_etheraddr\n", dhd_ifname(&dhd->pub, ifidx))); return -1; @@ -828,7 +827,7 @@ _dhd_set_mac_address(dhd_info_t *dhd, int ifidx, struct ether_addr *addr) DHD_ERROR(("%s: set cur_etheraddr failed\n", dhd_ifname(&dhd->pub, ifidx))); } else { - memcpy(dhd->iflist[ifidx]->net->dev_addr, addr, ETHER_ADDR_LEN); + memcpy(dhd->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN); } return ret; @@ -998,7 +997,7 @@ static int dhd_set_mac_address(struct net_device *dev, void *addr) return -1; ASSERT(dhd->sysioc_tsk); - memcpy(&dhd->macvalue, sa->sa_data, ETHER_ADDR_LEN); + memcpy(&dhd->macvalue, sa->sa_data, ETH_ALEN); dhd->set_macaddress = true; up(&dhd->sysioc_sem); @@ -1019,7 +1018,7 @@ static void dhd_set_multicast_list(struct net_device *dev) up(&dhd->sysioc_sem); } -int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pktbuf) +int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf) { int ret; dhd_info_t *dhd = (dhd_info_t *) (dhdp->info); @@ -1029,13 +1028,13 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pktbuf) return -ENODEV; /* Update multicast statistic */ - if (PKTLEN(pktbuf) >= ETHER_ADDR_LEN) { - u8 *pktdata = (u8 *) PKTDATA(pktbuf); + if (pktbuf->len >= ETH_ALEN) { + u8 *pktdata = (u8 *) (pktbuf->data); struct ether_header *eh = (struct ether_header *)pktdata; - if (ETHER_ISMULTI(eh->ether_dhost)) + if (is_multicast_ether_addr(eh->ether_dhost)) dhdp->tx_multicast++; - if (ntoh16(eh->ether_type) == ETHER_TYPE_802_1X) + if (ntoh16(eh->ether_type) == ETH_P_PAE) atomic_inc(&dhd->pend_8021x_cnt); } @@ -1053,6 +1052,32 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pktbuf) return ret; } +static inline void * +osl_pkt_frmnative(struct osl_info *osh, 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)) + +static inline struct sk_buff * +osl_pkt_tonative(struct osl_info *osh, 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)) + static int dhd_start_xmit(struct sk_buff *skb, struct net_device *net) { int ret; @@ -1133,13 +1158,15 @@ void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool state) netif_wake_queue(net); } -void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt) +void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, + int numpkt) { dhd_info_t *dhd = (dhd_info_t *) dhdp->info; struct sk_buff *skb; unsigned char *eth; uint len; - void *data, *pnext, *save_pktbuf; + void *data; + struct sk_buff *pnext, *save_pktbuf; int i; dhd_if_t *ifp; wl_event_msg_t event; @@ -1150,8 +1177,8 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt) for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) { - pnext = PKTNEXT(pktbuf); - PKTSETNEXT(pktbuf, NULL); + pnext = pktbuf->next; + pktbuf->next = NULL; skb = PKTTONATIVE(dhdp->osh, pktbuf); @@ -1190,7 +1217,7 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt) /* Process special event packets and then discard them */ if (ntoh16(skb->protocol) == ETHER_TYPE_BRCM) dhd_wl_host_event(dhd, &ifidx, - skb->mac_header, + skb_mac_header(skb), &event, &data); ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]); @@ -1223,7 +1250,7 @@ void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx) return; } -void dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success) +void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success) { uint ifidx; dhd_info_t *dhd = (dhd_info_t *) (dhdp->info); @@ -1232,10 +1259,10 @@ void dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success) dhd_prot_hdrpull(dhdp, &ifidx, txp); - eh = (struct ether_header *)PKTDATA(txp); + eh = (struct ether_header *)(txp->data); type = ntoh16(eh->ether_type); - if (type == ETHER_TYPE_802_1X) + if (type == ETH_P_PAE) atomic_dec(&dhd->pend_8021x_cnt); } @@ -1621,6 +1648,51 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) return 0; } +static s16 linuxbcmerrormap[] = { 0, /* 0 */ + -EINVAL, /* BCME_ERROR */ + -EINVAL, /* BCME_BADARG */ + -EINVAL, /* BCME_BADOPTION */ + -EINVAL, /* BCME_NOTUP */ + -EINVAL, /* BCME_NOTDOWN */ + -EINVAL, /* BCME_NOTAP */ + -EINVAL, /* BCME_NOTSTA */ + -EINVAL, /* BCME_BADKEYIDX */ + -EINVAL, /* BCME_RADIOOFF */ + -EINVAL, /* BCME_NOTBANDLOCKED */ + -EINVAL, /* BCME_NOCLK */ + -EINVAL, /* BCME_BADRATESET */ + -EINVAL, /* BCME_BADBAND */ + -E2BIG, /* BCME_BUFTOOSHORT */ + -E2BIG, /* BCME_BUFTOOLONG */ + -EBUSY, /* BCME_BUSY */ + -EINVAL, /* BCME_NOTASSOCIATED */ + -EINVAL, /* BCME_BADSSIDLEN */ + -EINVAL, /* BCME_OUTOFRANGECHAN */ + -EINVAL, /* BCME_BADCHAN */ + -EFAULT, /* BCME_BADADDR */ + -ENOMEM, /* BCME_NORESOURCE */ + -EOPNOTSUPP, /* BCME_UNSUPPORTED */ + -EMSGSIZE, /* BCME_BADLENGTH */ + -EINVAL, /* BCME_NOTREADY */ + -EPERM, /* BCME_NOTPERMITTED */ + -ENOMEM, /* BCME_NOMEM */ + -EINVAL, /* BCME_ASSOCIATED */ + -ERANGE, /* BCME_RANGE */ + -EINVAL, /* BCME_NOTFOUND */ + -EINVAL, /* BCME_WME_NOT_ENABLED */ + -EINVAL, /* BCME_TSPEC_NOTFOUND */ + -EINVAL, /* BCME_ACM_NOTSUPPORTED */ + -EINVAL, /* BCME_NOT_WME_ASSOCIATION */ + -EIO, /* BCME_SDIO_ERROR */ + -ENODEV, /* BCME_DONGLE_DOWN */ + -EINVAL, /* BCME_VERSION */ + -EIO, /* BCME_TXFAIL */ + -EIO, /* BCME_RXFAIL */ + -EINVAL, /* BCME_NODEVICE */ + -EINVAL, /* BCME_NMODE_DISABLED */ + -ENODATA, /* BCME_NONRESIDENT */ +}; + static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) { dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net); @@ -1742,7 +1814,12 @@ done: if (buf) kfree(buf); - return OSL_ERROR(bcmerror); + if (bcmerror > 0) + bcmerror = 0; + else if (bcmerror < BCME_LAST) + bcmerror = BCME_ERROR; + + return linuxbcmerrormap[-bcmerror]; } static int dhd_stop(struct net_device *net) @@ -1789,7 +1866,7 @@ static int dhd_open(struct net_device *net) } atomic_set(&dhd->pend_8021x_cnt, 0); - memcpy(net->dev_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN); + memcpy(net->dev_addr, dhd->pub.mac.octet, ETH_ALEN); #ifdef TOE /* Get current TOE mode from dongle */ @@ -1814,12 +1891,12 @@ static int dhd_open(struct net_device *net) return ret; } -osl_t *dhd_osl_attach(void *pdev, uint bustype) +struct osl_info *dhd_osl_attach(void *pdev, uint bustype) { - return osl_attach(pdev, bustype, true); + return osl_attach(pdev, bustype); } -void dhd_osl_detach(osl_t *osh) +void dhd_osl_detach(struct osl_info *osh) { osl_detach(osh); } @@ -1845,7 +1922,7 @@ dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name, dhd->iflist[ifidx] = ifp; strlcpy(ifp->name, name, IFNAMSIZ); if (mac_addr != NULL) - memcpy(&ifp->mac_addr, mac_addr, ETHER_ADDR_LEN); + memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN); if (handle == NULL) { ifp->state = WLC_E_IF_ADD; @@ -1877,7 +1954,8 @@ void dhd_del_if(dhd_info_t *dhd, int ifidx) up(&dhd->sysioc_sem); } -dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) +dhd_pub_t *dhd_attach(struct osl_info *osh, struct dhd_bus *bus, + uint bus_hdrlen) { dhd_info_t *dhd = NULL; struct net_device *net; @@ -2199,19 +2277,11 @@ static struct net_device_ops dhd_ops_pri = { .ndo_set_multicast_list = dhd_set_multicast_list }; -static struct net_device_ops dhd_ops_virt = { - .ndo_get_stats = dhd_get_stats, - .ndo_do_ioctl = dhd_ioctl_entry, - .ndo_start_xmit = dhd_start_xmit, - .ndo_set_mac_address = dhd_set_mac_address, - .ndo_set_multicast_list = dhd_set_multicast_list -}; - int dhd_net_attach(dhd_pub_t *dhdp, int ifidx) { dhd_info_t *dhd = (dhd_info_t *) dhdp->info; struct net_device *net; - u8 temp_addr[ETHER_ADDR_LEN] = { + u8 temp_addr[ETH_ALEN] = { 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33}; DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx)); @@ -2229,7 +2299,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, ETHER_ADDR_LEN); + memcpy(temp_addr, dhd->pub.mac.octet, ETH_ALEN); } @@ -2257,7 +2327,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx) dhd->pub.rxsz = net->mtu + net->hard_header_len + dhd->pub.hdrlen; - memcpy(net->dev_addr, temp_addr, ETHER_ADDR_LEN); + memcpy(net->dev_addr, temp_addr, ETH_ALEN); if (register_netdev(net) != 0) { DHD_ERROR(("%s: couldn't register the net device\n", diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux_sched.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux_sched.c index bf8df98..c66f1c2 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_linux_sched.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux_sched.c @@ -16,7 +16,6 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> -#include <linuxver.h> int setScheduler(struct task_struct *p, int policy, struct sched_param *param) { diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_proto.h b/drivers/staging/brcm80211/brcmfmac/dhd_proto.h index cc42fa4..a5309e2 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_proto.h +++ b/drivers/staging/brcm80211/brcmfmac/dhd_proto.h @@ -46,15 +46,16 @@ 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, void *pktbuf, u8 *fcbits); +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. */ -extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, void *txp); +extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, struct sk_buff *txp); /* Remove any protocol-specific data header. */ -extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, void *rxp); +extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, struct sk_buff *rxp); /* Use protocol to issue ioctl to dongle */ extern int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c index b2281d9..3edce44 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c @@ -16,6 +16,7 @@ #include <linux/types.h> #include <bcmdefs.h> +#include <linux/netdevice.h> #include <osl.h> #include <bcmsdh.h> @@ -143,7 +144,7 @@ * bufpool was present for gspi bus. */ #define PKTFREE2() if ((bus->bus != SPI_BUS) || bus->usebufpool) \ - PKTFREE(bus->dhd->osh, pkt, false); + pkt_buf_free_skb(bus->dhd->osh, pkt, false); DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep); extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len); @@ -202,8 +203,8 @@ typedef struct dhd_bus { u8 rx_seq; /* Receive sequence number (expected) */ bool rxskip; /* Skip receive (awaiting NAK ACK) */ - void *glomd; /* Packet containing glomming descriptor */ - void *glom; /* Packet chain for glommed superframe */ + struct sk_buff *glomd; /* Packet containing glomming descriptor */ + struct sk_buff *glom; /* Packet chain for glommed superframe */ uint glomerr; /* Glom packet read errors */ u8 *rxbuf; /* Buffer for receiving control packets */ @@ -356,16 +357,16 @@ 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(_osh, _p, _len, _align) \ do { \ uint datalign; \ - datalign = (unsigned long)PKTDATA((p)); \ - datalign = roundup(datalign, (align)) - datalign; \ - ASSERT(datalign < (align)); \ - ASSERT(PKTLEN((p)) >= ((len) + datalign)); \ + datalign = (unsigned long)((_p)->data); \ + datalign = roundup(datalign, (_align)) - datalign; \ + ASSERT(datalign < (_align)); \ + ASSERT((_p)->len >= ((_len) + datalign)); \ if (datalign) \ - PKTPULL((p), datalign); \ - PKTSETLEN((p), (len)); \ + skb_pull((_p), datalign); \ + __skb_trim((_p), (_len)); \ } while (0) /* Limit on rounding up frames */ @@ -430,27 +431,30 @@ 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, osl_t *osh); -static void dhdsdio_release_malloc(dhd_bus_t *bus, osl_t *osh); +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_disconnect(void *ptr); static bool dhdsdio_chipmatch(u16 chipid); -static bool dhdsdio_probe_attach(dhd_bus_t *bus, osl_t *osh, void *sdh, - void *regsva, u16 devid); -static bool dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh); -static bool dhdsdio_probe_init(dhd_bus_t *bus, osl_t *osh, void *sdh); -static void dhdsdio_release_dongle(dhd_bus_t *bus, osl_t * osh); +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 uint process_nvram_vars(char *varbuf, uint len); static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size); static int dhd_bcmsdh_recv_buf(dhd_bus_t *bus, u32 addr, uint fn, - uint flags, u8 *buf, uint nbytes, void *pkt, - bcmsdh_cmplt_fn_t complete, void *handle); + uint flags, u8 *buf, uint nbytes, + struct sk_buff *pkt, bcmsdh_cmplt_fn_t complete, + void *handle); static int dhd_bcmsdh_send_buf(dhd_bus_t *bus, u32 addr, uint fn, - uint flags, u8 *buf, uint nbytes, void *pkt, - bcmsdh_cmplt_fn_t complete, void *handle); + uint flags, u8 *buf, uint nbytes, + struct sk_buff *pkt, bcmsdh_cmplt_fn_t complete, + void *handle); -static bool dhdsdio_download_firmware(struct dhd_bus *bus, osl_t *osh, +static bool dhdsdio_download_firmware(struct dhd_bus *bus, struct osl_info *osh, void *sdh); static int _dhdsdio_download_firmware(struct dhd_bus *bus); @@ -900,16 +904,17 @@ void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable) /* Writes a HW/SW header into the packet and sends it. */ /* Assumes: (a) header space already there, (b) caller holds lock */ -static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt) +static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, + bool free_pkt) { int ret; - osl_t *osh; + struct osl_info *osh; u8 *frame; u16 len, pad = 0; u32 swheader; uint retries = 0; bcmsdh_info_t *sdh; - void *new; + struct sk_buff *new; int i; DHD_TRACE(("%s: Enter\n", __func__)); @@ -922,46 +927,46 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt) goto done; } - frame = (u8 *) PKTDATA(pkt); + frame = (u8 *) (pkt->data); /* Add alignment padding, allocate new packet if needed */ pad = ((unsigned long)frame % DHD_SDALIGN); if (pad) { - if (PKTHEADROOM(pkt) < pad) { + if (skb_headroom(pkt) < pad) { DHD_INFO(("%s: insufficient headroom %d for %d pad\n", - __func__, (int)PKTHEADROOM(pkt), pad)); + __func__, skb_headroom(pkt), pad)); bus->dhd->tx_realloc++; - new = PKTGET(osh, (PKTLEN(pkt) + DHD_SDALIGN), true); + new = pkt_buf_get_skb(osh, (pkt->len + DHD_SDALIGN)); if (!new) { DHD_ERROR(("%s: couldn't allocate new %d-byte " "packet\n", - __func__, PKTLEN(pkt) + DHD_SDALIGN)); + __func__, pkt->len + DHD_SDALIGN)); ret = BCME_NOMEM; goto done; } - PKTALIGN(osh, new, PKTLEN(pkt), DHD_SDALIGN); - bcopy(PKTDATA(pkt), PKTDATA(new), PKTLEN(pkt)); + PKTALIGN(osh, new, pkt->len, DHD_SDALIGN); + bcopy(pkt->data, new->data, pkt->len); if (free_pkt) - PKTFREE(osh, pkt, true); + pkt_buf_free_skb(osh, pkt, true); /* free the pkt if canned one is not used */ free_pkt = true; pkt = new; - frame = (u8 *) PKTDATA(pkt); + frame = (u8 *) (pkt->data); ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0); pad = 0; } else { - PKTPUSH(pkt, pad); - frame = (u8 *) PKTDATA(pkt); + skb_push(pkt, pad); + frame = (u8 *) (pkt->data); - ASSERT((pad + SDPCM_HDRLEN) <= (int)PKTLEN(pkt)); - bzero(frame, pad + SDPCM_HDRLEN); + ASSERT((pad + SDPCM_HDRLEN) <= (int)(pkt->len)); + memset(frame, 0, pad + SDPCM_HDRLEN); } } ASSERT(pad < DHD_SDALIGN); /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ - len = (u16) PKTLEN(pkt); + len = (u16) (pkt->len); *(u16 *) frame = htol16(len); *(((u16 *) frame) + 1) = htol16(~len); @@ -974,7 +979,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt) htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); #ifdef DHD_DEBUG - tx_packets[PKTPRIO(pkt)]++; + tx_packets[pkt->priority]++; if (DHD_BYTES_ON() && (((DHD_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) || (DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) { @@ -989,7 +994,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt) u16 pad = bus->blocksize - (len % bus->blocksize); if ((pad <= bus->roundup) && (pad < bus->blocksize)) #ifdef NOTUSED - if (pad <= PKTTAILROOM(pkt)) + if (pad <= skb_tailroom(pkt)) #endif /* NOTUSED */ len += pad; } else if (len % DHD_SDALIGN) { @@ -999,7 +1004,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt) /* Some controllers have trouble with odd bytes -- round to even */ if (forcealign && (len & (ALIGNMENT - 1))) { #ifdef NOTUSED - if (PKTTAILROOM(pkt)) + if (skb_tailroom(pkt)) #endif len = roundup(len, ALIGNMENT); #ifdef NOTUSED @@ -1050,34 +1055,34 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt) done: /* restore pkt buffer pointer before calling tx complete routine */ - PKTPULL(pkt, SDPCM_HDRLEN + pad); + skb_pull(pkt, SDPCM_HDRLEN + pad); dhd_os_sdunlock(bus->dhd); dhd_txcomplete(bus->dhd, pkt, ret != 0); dhd_os_sdlock(bus->dhd); if (free_pkt) - PKTFREE(osh, pkt, true); + pkt_buf_free_skb(osh, pkt, true); return ret; } -int dhd_bus_txdata(struct dhd_bus *bus, void *pkt) +int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) { int ret = BCME_ERROR; - osl_t *osh; + struct osl_info *osh; uint datalen, prec; DHD_TRACE(("%s: Enter\n", __func__)); osh = bus->dhd->osh; - datalen = PKTLEN(pkt); + datalen = pkt->len; #ifdef SDTEST /* Push the test header if doing loopback */ if (bus->ext_loop) { u8 *data; - PKTPUSH(pkt, SDPCM_TEST_HDRLEN); - data = PKTDATA(pkt); + skb_push(pkt, SDPCM_TEST_HDRLEN); + data = pkt->data; *data++ = SDPCM_TEST_ECHOREQ; *data++ = (u8) bus->loopid++; *data++ = (datalen >> 0); @@ -1087,10 +1092,10 @@ int dhd_bus_txdata(struct dhd_bus *bus, void *pkt) #endif /* SDTEST */ /* Add space for the header */ - PKTPUSH(pkt, SDPCM_HDRLEN); - ASSERT(IS_ALIGNED((unsigned long)PKTDATA(pkt), 2)); + skb_push(pkt, SDPCM_HDRLEN); + ASSERT(IS_ALIGNED((unsigned long)(pkt->data), 2)); - prec = PRIO2PREC((PKTPRIO(pkt) & PRIOMASK)); + prec = PRIO2PREC((pkt->priority & PRIOMASK)); /* Check for existing queue, current flow-control, pending event, or pending clock */ @@ -1105,9 +1110,9 @@ int dhd_bus_txdata(struct dhd_bus *bus, void *pkt) /* Priority based enq */ dhd_os_sdlock_txq(bus->dhd); if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) { - PKTPULL(pkt, SDPCM_HDRLEN); + skb_pull(pkt, SDPCM_HDRLEN); dhd_txcomplete(bus->dhd, pkt, false); - PKTFREE(osh, pkt, true); + pkt_buf_free_skb(osh, pkt, true); DHD_ERROR(("%s: out of bus->txq !!!\n", __func__)); ret = BCME_NORESOURCE; } else { @@ -1162,7 +1167,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, void *pkt) static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) { - void *pkt; + struct sk_buff *pkt; u32 intstatus = 0; uint retries = 0; int ret = 0, prec_out; @@ -1186,7 +1191,7 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) break; } dhd_os_sdunlock_txq(bus->dhd); - datalen = PKTLEN(pkt) - SDPCM_HDRLEN; + datalen = pkt->len - SDPCM_HDRLEN; #ifndef SDTEST ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true); @@ -1247,7 +1252,7 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) frame -= doff; len += doff; msglen += doff; - bzero(frame, doff + SDPCM_HDRLEN); + memset(frame, 0, doff + SDPCM_HDRLEN); } ASSERT(doff < DHD_SDALIGN); } @@ -2531,7 +2536,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) if (!vbuffer) return BCME_NOMEM; - bzero(vbuffer, varsize); + memset(vbuffer, 0, varsize); bcopy(bus->vars, vbuffer, bus->varsz); /* Write the vars list */ @@ -2823,7 +2828,7 @@ exit: void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex) { - osl_t *osh = bus->dhd->osh; + struct osl_info *osh = bus->dhd->osh; u32 local_hostintmask; u8 saveclk; uint retries; @@ -2877,10 +2882,10 @@ void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex) /* Clear any held glomming stuff */ if (bus->glomd) - PKTFREE(osh, bus->glomd, false); + pkt_buf_free_skb(osh, bus->glomd, false); if (bus->glom) - PKTFREE(osh, bus->glom, false); + pkt_buf_free_skb(osh, bus->glom, false); bus->glom = bus->glomd = NULL; @@ -3178,8 +3183,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) u8 *dptr, num = 0; u16 sublen, check; - void *pfirst, *plast, *pnext, *save_pfirst; - osl_t *osh = bus->dhd->osh; + struct sk_buff *pfirst, *plast, *pnext, *save_pfirst; + struct osl_info *osh = bus->dhd->osh; int errcode; u8 chan, seq, doff, sfdoff; @@ -3199,8 +3204,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) dhd_os_sdlock_rxq(bus->dhd); pfirst = plast = pnext = NULL; - dlen = (u16) PKTLEN(bus->glomd); - dptr = PKTDATA(bus->glomd); + dlen = (u16) (bus->glomd->len); + dptr = bus->glomd->data; if (!dlen || (dlen & 1)) { DHD_ERROR(("%s: bad glomd len(%d), ignore descriptor\n", __func__, dlen)); @@ -3235,19 +3240,19 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) } /* Allocate/chain packet for next subframe */ - pnext = PKTGET(osh, sublen + DHD_SDALIGN, false); + pnext = pkt_buf_get_skb(osh, sublen + DHD_SDALIGN); if (pnext == NULL) { - DHD_ERROR(("%s: PKTGET failed, num %d len %d\n", + DHD_ERROR(("%s: pkt_buf_get_skb failed, num %d len %d\n", __func__, num, sublen)); break; } - ASSERT(!PKTLINK(pnext)); + ASSERT(!(pnext->prev)); if (!pfirst) { ASSERT(!plast); pfirst = plast = pnext; } else { ASSERT(plast); - PKTSETNEXT(plast, pnext); + plast->next = pnext; plast = pnext; } @@ -3271,13 +3276,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) pfirst = pnext = NULL; } else { if (pfirst) - PKTFREE(osh, pfirst, false); + pkt_buf_free_skb(osh, pfirst, false); bus->glom = NULL; num = 0; } /* Done with descriptor packet */ - PKTFREE(osh, bus->glomd, false); + pkt_buf_free_skb(osh, bus->glomd, false); bus->glomd = NULL; bus->nextlen = 0; @@ -3290,10 +3295,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) if (DHD_GLOM_ON()) { DHD_GLOM(("%s: try superframe read, packet chain:\n", __func__)); - for (pnext = bus->glom; pnext; pnext = PKTNEXT(pnext)) { + for (pnext = bus->glom; pnext; pnext = pnext->next) { DHD_GLOM((" %p: %p len 0x%04x (%d)\n", - pnext, (u8 *) PKTDATA(pnext), - PKTLEN(pnext), PKTLEN(pnext))); + pnext, (u8 *) (pnext->data), + pnext->len, pnext->len)); } } @@ -3309,7 +3314,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) bcmsdh_cur_sbwad (bus->sdh), SDIO_FUNC_2, F2SYNC, - (u8 *) PKTDATA(pfirst), + (u8 *) pfirst->data, dlen, pfirst, NULL, NULL); } else if (bus->dataptr) { errcode = dhd_bcmsdh_recv_buf(bus, @@ -3346,7 +3351,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); - PKTFREE(osh, bus->glom, false); + pkt_buf_free_skb(osh, bus->glom, false); dhd_os_sdunlock_rxq(bus->dhd); bus->rxglomfail++; bus->glom = NULL; @@ -3355,13 +3360,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) } #ifdef DHD_DEBUG if (DHD_GLOM_ON()) { - prhex("SUPERFRAME", PKTDATA(pfirst), - min_t(int, PKTLEN(pfirst), 48)); + prhex("SUPERFRAME", pfirst->data, + min_t(int, pfirst->len, 48)); } #endif /* Validate the superframe header */ - dptr = (u8 *) PKTDATA(pfirst); + dptr = (u8 *) (pfirst->data); sublen = ltoh16_ua(dptr); check = ltoh16_ua(dptr + sizeof(u16)); @@ -3399,11 +3404,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) __func__)); errcode = -1; } else if ((doff < SDPCM_HDRLEN) || - (doff > (PKTLEN(pfirst) - SDPCM_HDRLEN))) { + (doff > (pfirst->len - SDPCM_HDRLEN))) { DHD_ERROR(("%s (superframe): Bad data offset %d: HW %d " "pkt %d min %d\n", __func__, doff, sublen, - PKTLEN(pfirst), SDPCM_HDRLEN)); + pfirst->len, SDPCM_HDRLEN)); errcode = -1; } @@ -3424,14 +3429,14 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) bus->tx_max = txmax; /* Remove superframe header, remember offset */ - PKTPULL(pfirst, doff); + skb_pull(pfirst, doff); sfdoff = doff; /* Validate all the subframe headers */ for (num = 0, pnext = pfirst; pnext && !errcode; - num++, pnext = PKTNEXT(pnext)) { - dptr = (u8 *) PKTDATA(pnext); - dlen = (u16) PKTLEN(pnext); + num++, pnext = pnext->next) { + dptr = (u8 *) (pnext->data); + dlen = (u16) (pnext->len); sublen = ltoh16_ua(dptr); check = ltoh16_ua(dptr + sizeof(u16)); chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); @@ -3469,13 +3474,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) a couple retries */ if (bus->glomerr++ < 3) { /* Restore superframe header space */ - PKTPUSH(pfirst, sfdoff); + skb_push(pfirst, sfdoff); dhdsdio_rxfail(bus, true, true); } else { bus->glomerr = 0; dhdsdio_rxfail(bus, true, false); dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(osh, bus->glom, false); + pkt_buf_free_skb(osh, bus->glom, false); dhd_os_sdunlock_rxq(bus->dhd); bus->rxglomfail++; bus->glom = NULL; @@ -3491,10 +3496,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) dhd_os_sdlock_rxq(bus->dhd); for (num = 0; pfirst; rxseq++, pfirst = pnext) { - pnext = PKTNEXT(pfirst); - PKTSETNEXT(pfirst, NULL); + pnext = pfirst->next; + pfirst->next = NULL; - dptr = (u8 *) PKTDATA(pfirst); + dptr = (u8 *) (pfirst->data); sublen = ltoh16_ua(dptr); chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]); @@ -3502,8 +3507,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) DHD_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d " "chan %d seq %d\n", - __func__, num, pfirst, PKTDATA(pfirst), - PKTLEN(pfirst), sublen, chan, seq)); + __func__, num, pfirst, pfirst->data, + pfirst->len, sublen, chan, seq)); ASSERT((chan == SDPCM_DATA_CHANNEL) || (chan == SDPCM_EVENT_CHANNEL)); @@ -3519,13 +3524,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) prhex("Rx Subframe Data", dptr, dlen); #endif - PKTSETLEN(pfirst, sublen); - PKTPULL(pfirst, doff); + __skb_trim(pfirst, sublen); + skb_pull(pfirst, doff); - if (PKTLEN(pfirst) == 0) { - PKTFREE(bus->dhd->osh, pfirst, false); + if (pfirst->len == 0) { + pkt_buf_free_skb(bus->dhd->osh, pfirst, false); if (plast) { - PKTSETNEXT(plast, pnext); + plast->next = pnext; } else { ASSERT(save_pfirst == pfirst); save_pfirst = pnext; @@ -3536,9 +3541,9 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) DHD_ERROR(("%s: rx protocol error\n", __func__)); bus->dhd->rx_errors++; - PKTFREE(osh, pfirst, false); + pkt_buf_free_skb(osh, pfirst, false); if (plast) { - PKTSETNEXT(plast, pnext); + plast->next = pnext; } else { ASSERT(save_pfirst == pfirst); save_pfirst = pnext; @@ -3548,7 +3553,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) /* this packet will go up, link back into chain and count it */ - PKTSETNEXT(pfirst, pnext); + pfirst->next = pnext; plast = pfirst; num++; @@ -3556,11 +3561,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) if (DHD_GLOM_ON()) { DHD_GLOM(("%s subframe %d to stack, %p(%p/%d) " "nxt/lnk %p/%p\n", - __func__, num, pfirst, PKTDATA(pfirst), - PKTLEN(pfirst), PKTNEXT(pfirst), - PKTLINK(pfirst))); - prhex("", (u8 *) PKTDATA(pfirst), - min_t(int, PKTLEN(pfirst), 32)); + __func__, num, pfirst, pfirst->data, + pfirst->len, pfirst->next, + pfirst->prev)); + prhex("", (u8 *) pfirst->data, + min_t(int, pfirst->len, 32)); } #endif /* DHD_DEBUG */ } @@ -3580,7 +3585,7 @@ 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) { - osl_t *osh = bus->dhd->osh; + struct osl_info *osh = bus->dhd->osh; bcmsdh_info_t *sdh = bus->sdh; u16 len, check; /* Extracted hardware header fields */ @@ -3588,7 +3593,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) u8 fcbits; /* Extracted fcbits from software header */ u8 delta; - void *pkt; /* Packet for event or data frames */ + struct sk_buff *pkt; /* Packet for event or data frames */ u16 pad; /* Number of pad bytes to read */ u16 rdlen; /* Total number of bytes to read */ u8 rxseq; /* Next sequence number to expect */ @@ -3675,7 +3680,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) */ /* Allocate a packet buffer */ dhd_os_sdlock_rxq(bus->dhd); - pkt = PKTGET(osh, rdlen + DHD_SDALIGN, false); + pkt = pkt_buf_get_skb(osh, rdlen + DHD_SDALIGN); if (!pkt) { if (bus->bus == SPI_BUS) { bus->usebufpool = false; @@ -3721,7 +3726,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) } else { /* Give up on data, request rtx of events */ - DHD_ERROR(("%s (nextlen): PKTGET failed: len %d rdlen %d " "expected rxseq %d\n", + DHD_ERROR(("%s (nextlen): pkt_buf_get_skb failed: len %d rdlen %d " "expected rxseq %d\n", __func__, len, rdlen, rxseq)); /* Just go try again w/normal header read */ @@ -3732,9 +3737,9 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) if (bus->bus == SPI_BUS) bus->usebufpool = true; - ASSERT(!PKTLINK(pkt)); + ASSERT(!(pkt->prev)); PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN); - rxbuf = (u8 *) PKTDATA(pkt); + rxbuf = (u8 *) (pkt->data); /* Read the entire frame */ sdret = dhd_bcmsdh_recv_buf(bus, @@ -3748,7 +3753,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)); - PKTFREE(bus->dhd->osh, pkt, false); + pkt_buf_free_skb(bus->dhd->osh, pkt, false); bus->dhd->rx_errors++; dhd_os_sdunlock_rxq(bus->dhd); /* Force retry w/normal header read. @@ -3896,7 +3901,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) doff); if (bus->usebufpool) { dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(bus->dhd->osh, pkt, + pkt_buf_free_skb(bus->dhd->osh, pkt, false); dhd_os_sdunlock_rxq(bus->dhd); } @@ -4086,10 +4091,10 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) } dhd_os_sdlock_rxq(bus->dhd); - pkt = PKTGET(osh, (rdlen + firstread + DHD_SDALIGN), false); + pkt = pkt_buf_get_skb(osh, (rdlen + firstread + DHD_SDALIGN)); if (!pkt) { /* Give up on data, request rtx of events */ - DHD_ERROR(("%s: PKTGET failed: rdlen %d chan %d\n", + DHD_ERROR(("%s: pkt_buf_get_skb failed: rdlen %d chan %d\n", __func__, rdlen, chan)); bus->dhd->rx_dropped++; dhd_os_sdunlock_rxq(bus->dhd); @@ -4098,17 +4103,17 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) } dhd_os_sdunlock_rxq(bus->dhd); - ASSERT(!PKTLINK(pkt)); + ASSERT(!(pkt->prev)); /* Leave room for what we already read, and align remainder */ - ASSERT(firstread < (PKTLEN(pkt))); - PKTPULL(pkt, firstread); + ASSERT(firstread < pkt->len); + skb_pull(pkt, firstread); PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN); /* Read the remaining frame data */ sdret = dhd_bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, - F2SYNC, ((u8 *) PKTDATA(pkt)), rdlen, + F2SYNC, ((u8 *) (pkt->data)), rdlen, pkt, NULL, NULL); bus->f2rxdata++; ASSERT(sdret != BCME_PENDING); @@ -4122,7 +4127,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ? "data" : "test")), sdret)); dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(bus->dhd->osh, pkt, false); + pkt_buf_free_skb(bus->dhd->osh, pkt, false); dhd_os_sdunlock_rxq(bus->dhd); bus->dhd->rx_errors++; dhdsdio_rxfail(bus, true, RETRYCHAN(chan)); @@ -4130,12 +4135,12 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) } /* Copy the already-read portion */ - PKTPUSH(pkt, firstread); - bcopy(bus->rxhdr, PKTDATA(pkt), firstread); + skb_push(pkt, firstread); + bcopy(bus->rxhdr, pkt->data, firstread); #ifdef DHD_DEBUG if (DHD_BYTES_ON() && DHD_DATA_ON()) - prhex("Rx Data", PKTDATA(pkt), len); + prhex("Rx Data", pkt->data, len); #endif deliver: @@ -4146,12 +4151,12 @@ deliver: __func__, len)); #ifdef DHD_DEBUG if (DHD_GLOM_ON()) { - prhex("Glom Data", PKTDATA(pkt), len); + prhex("Glom Data", pkt->data, len); } #endif - PKTSETLEN(pkt, len); + __skb_trim(pkt, len); ASSERT(doff == SDPCM_HDRLEN); - PKTPULL(pkt, SDPCM_HDRLEN); + skb_pull(pkt, SDPCM_HDRLEN); bus->glomd = pkt; } else { DHD_ERROR(("%s: glom superframe w/o " @@ -4162,8 +4167,8 @@ deliver: } /* Fill in packet len and prio, deliver upward */ - PKTSETLEN(pkt, len); - PKTPULL(pkt, doff); + __skb_trim(pkt, len); + skb_pull(pkt, doff); #ifdef SDTEST /* Test channel packets are processed separately */ @@ -4173,15 +4178,15 @@ deliver: } #endif /* SDTEST */ - if (PKTLEN(pkt) == 0) { + if (pkt->len == 0) { dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(bus->dhd->osh, pkt, false); + pkt_buf_free_skb(bus->dhd->osh, pkt, false); 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); - PKTFREE(bus->dhd->osh, pkt, false); + pkt_buf_free_skb(bus->dhd->osh, pkt, false); dhd_os_sdunlock_rxq(bus->dhd); bus->dhd->rx_errors++; continue; @@ -4626,11 +4631,11 @@ static void dhdsdio_pktgen_init(dhd_bus_t *bus) static void dhdsdio_pktgen(dhd_bus_t *bus) { - void *pkt; + struct sk_buff *pkt; u8 *data; uint pktcount; uint fillbyte; - osl_t *osh = bus->dhd->osh; + struct osl_info *osh = bus->dhd->osh; u16 len; /* Display current count if appropriate */ @@ -4658,16 +4663,16 @@ static void dhdsdio_pktgen(dhd_bus_t *bus) /* Allocate an appropriate-sized packet */ len = bus->pktgen_len; - pkt = PKTGET(osh, + pkt = pkt_buf_get_skb(osh, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN), true); if (!pkt) { - DHD_ERROR(("%s: PKTGET failed!\n", __func__)); + DHD_ERROR(("%s: pkt_buf_get_skb failed!\n", __func__)); break; } PKTALIGN(osh, pkt, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), DHD_SDALIGN); - data = (u8 *) PKTDATA(pkt) + SDPCM_HDRLEN; + data = (u8 *) (pkt->data) + SDPCM_HDRLEN; /* Write test header cmd and extra based on mode */ switch (bus->pktgen_mode) { @@ -4689,7 +4694,7 @@ static void dhdsdio_pktgen(dhd_bus_t *bus) default: DHD_ERROR(("Unrecognized pktgen mode %d\n", bus->pktgen_mode)); - PKTFREE(osh, pkt, true); + pkt_buf_free_skb(osh, pkt, true); bus->pktgen_count = 0; return; } @@ -4706,9 +4711,9 @@ static void dhdsdio_pktgen(dhd_bus_t *bus) #ifdef DHD_DEBUG if (DHD_BYTES_ON() && DHD_DATA_ON()) { - data = (u8 *) PKTDATA(pkt) + SDPCM_HDRLEN; + data = (u8 *) (pkt->data) + SDPCM_HDRLEN; prhex("dhdsdio_pktgen: Tx Data", data, - PKTLEN(pkt) - SDPCM_HDRLEN); + pkt->len - SDPCM_HDRLEN); } #endif @@ -4733,19 +4738,19 @@ static void dhdsdio_pktgen(dhd_bus_t *bus) static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start) { - void *pkt; + struct sk_buff *pkt; u8 *data; - osl_t *osh = bus->dhd->osh; + struct osl_info *osh = bus->dhd->osh; /* Allocate the packet */ - pkt = PKTGET(osh, SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN, + pkt = pkt_buf_get_skb(osh, SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN, true); if (!pkt) { - DHD_ERROR(("%s: PKTGET failed!\n", __func__)); + DHD_ERROR(("%s: pkt_buf_get_skb failed!\n", __func__)); return; } PKTALIGN(osh, pkt, (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), DHD_SDALIGN); - data = (u8 *) PKTDATA(pkt) + SDPCM_HDRLEN; + data = (u8 *) (pkt->data) + SDPCM_HDRLEN; /* Fill in the test header */ *data++ = SDPCM_TEST_SEND; @@ -4758,9 +4763,9 @@ static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start) bus->pktgen_fail++; } -static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq) +static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq) { - osl_t *osh = bus->dhd->osh; + struct osl_info *osh = bus->dhd->osh; u8 *data; uint pktlen; @@ -4770,16 +4775,16 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq) u16 offset; /* Check for min length */ - pktlen = PKTLEN(pkt); + pktlen = pkt->len; if (pktlen < SDPCM_TEST_HDRLEN) { DHD_ERROR(("dhdsdio_restrcv: toss runt frame, pktlen %d\n", pktlen)); - PKTFREE(osh, pkt, false); + pkt_buf_free_skb(osh, pkt, false); return; } /* Extract header fields */ - data = PKTDATA(pkt); + data = pkt->data; cmd = *data++; extra = *data++; len = *data++; @@ -4792,7 +4797,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, void *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)); - PKTFREE(osh, pkt, false); + pkt_buf_free_skb(osh, pkt, false); return; } } @@ -4802,19 +4807,19 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq) case SDPCM_TEST_ECHOREQ: /* Rx->Tx turnaround ok (even on NDIS w/current implementation) */ - *(u8 *) (PKTDATA(pkt)) = SDPCM_TEST_ECHORSP; + *(u8 *) (pkt->data) = SDPCM_TEST_ECHORSP; if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true) == 0) { bus->pktgen_sent++; } else { bus->pktgen_fail++; - PKTFREE(osh, pkt, false); + pkt_buf_free_skb(osh, pkt, false); } bus->pktgen_rcvd++; break; case SDPCM_TEST_ECHORSP: if (bus->ext_loop) { - PKTFREE(osh, pkt, false); + pkt_buf_free_skb(osh, pkt, false); bus->pktgen_rcvd++; break; } @@ -4827,12 +4832,12 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq) break; } } - PKTFREE(osh, pkt, false); + pkt_buf_free_skb(osh, pkt, false); bus->pktgen_rcvd++; break; case SDPCM_TEST_DISCARD: - PKTFREE(osh, pkt, false); + pkt_buf_free_skb(osh, pkt, false); bus->pktgen_rcvd++; break; @@ -4842,7 +4847,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, void *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)); - PKTFREE(osh, pkt, false); + pkt_buf_free_skb(osh, pkt, false); break; } @@ -4960,7 +4965,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen) dhd_bus_t *bus = dhdp->bus; u32 addr, val; int rv; - void *pkt; + struct sk_buff *pkt; /* Address could be zero if CONSOLE := 0 in dongle Makefile */ if (bus->console_addr == 0) @@ -5003,7 +5008,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 = PKTGET(bus->dhd->osh, 4 + SDPCM_RESERVE, true); + pkt = pkt_buf_get_skb(bus->dhd->osh, 4 + SDPCM_RESERVE); if ((pkt != NULL) && bus->clkstate == CLK_AVAIL) dhdsdio_txpkt(bus, pkt, SDPCM_EVENT_CHANNEL, true); @@ -5061,7 +5066,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, - osl_t *osh, void *sdh) + struct osl_info *osh, void *sdh) { int ret; dhd_bus_t *bus; @@ -5220,8 +5225,8 @@ fail: } static bool -dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva, - u16 devid) +dhdsdio_probe_attach(struct dhd_bus *bus, struct osl_info *osh, void *sdh, + void *regsva, u16 devid) { u8 clkctl = 0; int err = 0; @@ -5280,7 +5285,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva, "failed\n", fn)); break; } - bzero(cis[fn], SBSDIO_CIS_SIZE_LIMIT); + memset(cis[fn], 0, SBSDIO_CIS_SIZE_LIMIT); err = bcmsdh_cis_read(sdh, fn, cis[fn], SBSDIO_CIS_SIZE_LIMIT); @@ -5378,7 +5383,8 @@ fail: return false; } -static bool dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh) +static bool dhdsdio_probe_malloc(dhd_bus_t *bus, struct osl_info *osh, + void *sdh) { DHD_TRACE(("%s: Enter\n", __func__)); @@ -5419,7 +5425,7 @@ fail: return false; } -static bool dhdsdio_probe_init(dhd_bus_t *bus, osl_t *osh, void *sdh) +static bool dhdsdio_probe_init(dhd_bus_t *bus, struct osl_info *osh, void *sdh) { s32 fnum; @@ -5496,7 +5502,7 @@ static bool dhdsdio_probe_init(dhd_bus_t *bus, osl_t *osh, void *sdh) } bool -dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh, +dhd_bus_download_firmware(struct dhd_bus *bus, struct osl_info *osh, char *fw_path, char *nv_path) { bool ret; @@ -5509,7 +5515,7 @@ dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh, } static bool -dhdsdio_download_firmware(struct dhd_bus *bus, osl_t *osh, void *sdh) +dhdsdio_download_firmware(struct dhd_bus *bus, struct osl_info *osh, void *sdh) { bool ret; @@ -5524,7 +5530,7 @@ dhdsdio_download_firmware(struct dhd_bus *bus, osl_t *osh, void *sdh) } /* Detach and free everything */ -static void dhdsdio_release(dhd_bus_t *bus, osl_t *osh) +static void dhdsdio_release(dhd_bus_t *bus, struct osl_info *osh) { DHD_TRACE(("%s: Enter\n", __func__)); @@ -5554,7 +5560,7 @@ static void dhdsdio_release(dhd_bus_t *bus, osl_t *osh) DHD_TRACE(("%s: Disconnected\n", __func__)); } -static void dhdsdio_release_malloc(dhd_bus_t *bus, osl_t *osh) +static void dhdsdio_release_malloc(dhd_bus_t *bus, struct osl_info *osh) { DHD_TRACE(("%s: Enter\n", __func__)); @@ -5573,7 +5579,7 @@ static void dhdsdio_release_malloc(dhd_bus_t *bus, osl_t *osh) } } -static void dhdsdio_release_dongle(dhd_bus_t *bus, osl_t *osh) +static void dhdsdio_release_dongle(dhd_bus_t *bus, struct osl_info *osh) { DHD_TRACE(("%s: Enter\n", __func__)); @@ -5986,7 +5992,7 @@ err: static int dhd_bcmsdh_recv_buf(dhd_bus_t *bus, u32 addr, uint fn, uint flags, - u8 *buf, uint nbytes, void *pkt, + u8 *buf, uint nbytes, struct sk_buff *pkt, bcmsdh_cmplt_fn_t complete, void *handle) { int status; @@ -6000,7 +6006,7 @@ dhd_bcmsdh_recv_buf(dhd_bus_t *bus, u32 addr, uint fn, uint flags, static int dhd_bcmsdh_send_buf(dhd_bus_t *bus, u32 addr, uint fn, uint flags, - u8 *buf, uint nbytes, void *pkt, + u8 *buf, uint nbytes, struct sk_buff *pkt, bcmsdh_cmplt_fn_t complete, void *handle) { return bcmsdh_send_buf diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c index ea08252..991463f 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c @@ -16,7 +16,6 @@ #include <linux/kernel.h> #include <linux/if_arp.h> -#include <linuxver.h> #include <osl.h> #include <bcmutils.h> @@ -30,10 +29,6 @@ #include <dhdioctl.h> #include <wlioctl.h> -#include <proto/ethernet.h> -#include <dngl_stats.h> -#include <dhd.h> - #include <linux/kthread.h> #include <linux/netdevice.h> #include <linux/sched.h> @@ -342,7 +337,7 @@ static void wl_debugfs_remove_netdev(struct wl_priv *wl); struct wl_iface *ci; \ if (unlikely(!(wl_cfg80211_dev && \ (ci = wl_get_drvdata(wl_cfg80211_dev))))) { \ - WL_ERR(("wl_cfg80211_dev is unavailable\n")); \ + WL_ERR("wl_cfg80211_dev is unavailable\n"); \ BUG(); \ } \ ci_to_wl(ci); \ @@ -352,8 +347,8 @@ static void wl_debugfs_remove_netdev(struct wl_priv *wl); do { \ struct wl_priv *wl = wiphy_to_wl(wiphy); \ if (unlikely(!test_bit(WL_STATUS_READY, &wl->status))) { \ - WL_INFO(("device is not ready : status (%d)\n", \ - (int)wl->status)); \ + WL_INFO("device is not ready : status (%d)\n", \ + (int)wl->status); \ return -EIO; \ } \ } while (0) @@ -618,8 +613,8 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, switch (type) { case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_WDS: - WL_ERR(("type (%d) : currently we do not support this type\n", - type)); + WL_ERR("type (%d) : currently we do not support this type\n", + type); return -EOPNOTSUPP; case NL80211_IFTYPE_ADHOC: wl->conf->mode = WL_MODE_IBSS; @@ -635,15 +630,15 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ap = htod32(ap); wdev = ndev->ieee80211_ptr; wdev->iftype = type; - WL_DBG(("%s : ap (%d), infra (%d)\n", ndev->name, ap, infra)); + 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)) { - WL_ERR(("WLC_SET_INFRA error (%d)\n", err)); + WL_ERR("WLC_SET_INFRA error (%d)\n", err); return err; } err = wl_dev_ioctl(ndev, WLC_SET_AP, &ap, sizeof(ap)); if (unlikely(err)) { - WL_ERR(("WLC_SET_AP error (%d)\n", err)); + WL_ERR("WLC_SET_AP error (%d)\n", err); return err; } @@ -653,7 +648,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(¶ms->bssid, ðer_bcast, ETHER_ADDR_LEN); + memcpy(¶ms->bssid, ðer_bcast, ETH_ALEN); params->bss_type = DOT11_BSSTYPE_ANY; params->scan_type = 0; params->nprobes = -1; @@ -705,7 +700,7 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action) if (ssid && ssid->SSID_len) params_size += sizeof(struct wlc_ssid); - params = (struct wl_iscan_params *)kzalloc(params_size, GFP_KERNEL); + params = kzalloc(params_size, GFP_KERNEL); if (unlikely(!params)) return -ENOMEM; memset(params, 0, params_size); @@ -722,9 +717,9 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action) iscan->ioctl_buf, WLC_IOCTL_SMLEN); if (unlikely(err)) { if (err == -EBUSY) { - WL_INFO(("system busy : iscan canceled\n")); + WL_INFO("system busy : iscan canceled\n"); } else { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); } } kfree(params); @@ -748,7 +743,7 @@ static s32 wl_do_iscan(struct wl_priv *wl) err = wl_dev_ioctl(wl_to_ndev(wl), WLC_SET_PASSIVE_SCAN, &passive_scan, sizeof(passive_scan)); if (unlikely(err)) { - WL_DBG(("error (%d)\n", err)); + WL_DBG("error (%d)\n", err); return err; } wl_set_mpc(ndev, 0); @@ -774,12 +769,12 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, s32 err = 0; if (unlikely(test_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scanning already : status (%d)\n", (int)wl->status)); + WL_ERR("Scanning already : status (%d)\n", (int)wl->status); return -EAGAIN; } if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &wl->status))) { - WL_ERR(("Scanning being aborted : status (%d)\n", - (int)wl->status)); + WL_ERR("Scanning being aborted : status (%d)\n", + (int)wl->status); return -EAGAIN; } @@ -811,26 +806,26 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, else goto scan_out; } else { - WL_DBG(("ssid \"%s\", ssid_len (%d)\n", - ssids->ssid, ssids->ssid_len)); + WL_DBG("ssid \"%s\", ssid_len (%d)\n", + ssids->ssid, ssids->ssid_len); memset(&sr->ssid, 0, sizeof(sr->ssid)); sr->ssid.SSID_len = 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); - WL_DBG(("Specific scan ssid=\"%s\" len=%d\n", - sr->ssid.SSID, sr->ssid.SSID_len)); + WL_DBG("Specific scan ssid=\"%s\" len=%d\n", + sr->ssid.SSID, sr->ssid.SSID_len); spec_scan = true; } else { - WL_DBG(("Broadcast scan\n")); + WL_DBG("Broadcast scan\n"); } - WL_DBG(("sr->ssid.SSID_len (%d)\n", sr->ssid.SSID_len)); + WL_DBG("sr->ssid.SSID_len (%d)\n", sr->ssid.SSID_len); passive_scan = wl->active_scan ? 0 : 1; err = wl_dev_ioctl(ndev, WLC_SET_PASSIVE_SCAN, &passive_scan, sizeof(passive_scan)); if (unlikely(err)) { - WL_ERR(("WLC_SET_PASSIVE_SCAN error (%d)\n", err)); + WL_ERR("WLC_SET_PASSIVE_SCAN error (%d)\n", err); goto scan_out; } wl_set_mpc(ndev, 0); @@ -838,10 +833,10 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, sizeof(sr->ssid)); if (err) { if (err == -EBUSY) { - WL_INFO(("system busy : scan for \"%s\" " - "canceled\n", sr->ssid.SSID)); + WL_INFO("system busy : scan for \"%s\" canceled\n", + sr->ssid.SSID); } else { - WL_ERR(("WLC_SCAN error (%d)\n", err)); + WL_ERR("WLC_SCAN error (%d)\n", err); } wl_set_mpc(ndev, 1); goto scan_out; @@ -865,7 +860,7 @@ wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, CHECK_SYS_UP(); err = __wl_cfg80211_scan(wiphy, ndev, request, NULL); if (unlikely(err)) { - WL_DBG(("scan error (%d)\n", err)); + WL_DBG("scan error (%d)\n", err); return err; } @@ -884,7 +879,7 @@ static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val) err = wl_dev_ioctl(dev, WLC_SET_VAR, buf, len); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); } return err; @@ -907,7 +902,7 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) BUG_ON(unlikely(!len)); err = wl_dev_ioctl(dev, WLC_GET_VAR, &var, len); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); } *retval = dtoh32(var.val); @@ -920,7 +915,7 @@ static s32 wl_set_rts(struct net_device *dev, u32 rts_threshold) err = wl_dev_intvar_set(dev, "rtsthresh", rts_threshold); if (unlikely(err)) { - WL_ERR(("Error (%d)\n", err)); + WL_ERR("Error (%d)\n", err); return err; } return err; @@ -932,7 +927,7 @@ static s32 wl_set_frag(struct net_device *dev, u32 frag_threshold) err = wl_dev_intvar_set(dev, "fragthresh", frag_threshold); if (unlikely(err)) { - WL_ERR(("Error (%d)\n", err)); + WL_ERR("Error (%d)\n", err); return err; } return err; @@ -946,7 +941,7 @@ static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l) retry = htod32(retry); err = wl_dev_ioctl(dev, cmd, &retry, sizeof(retry)); if (unlikely(err)) { - WL_ERR(("cmd (%d) , error (%d)\n", cmd, err)); + WL_ERR("cmd (%d) , error (%d)\n", cmd, err); return err; } return err; @@ -1006,7 +1001,7 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, CHECK_SYS_UP(); if (params->bssid) { - WL_ERR(("Invalid bssid\n")); + WL_ERR("Invalid bssid\n"); return -EOPNOTSUPP; } bss = cfg80211_get_ibss(wiphy, NULL, params->ssid, params->ssid_len); @@ -1032,7 +1027,7 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, } if (bss) { wl->ibss_starter = false; - WL_DBG(("Found IBSS\n")); + WL_DBG("Found IBSS\n"); } else { wl->ibss_starter = true; } @@ -1049,14 +1044,14 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, join_params.ssid.SSID_len = htod32(params->ssid_len); if (params->bssid) memcpy(&join_params.params.bssid, params->bssid, - ETHER_ADDR_LEN); + ETH_ALEN); else - memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN); + memset(&join_params.params.bssid, 0, ETH_ALEN); err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, sizeof(join_params)); if (unlikely(err)) { - WL_ERR(("Error (%d)\n", err)); + WL_ERR("Error (%d)\n", err); return err; } return err; @@ -1087,10 +1082,10 @@ wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme) val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED; else val = WPA_AUTH_DISABLED; - WL_DBG(("setting wpa_auth to 0x%0x\n", val)); + WL_DBG("setting wpa_auth to 0x%0x\n", val); err = wl_dev_intvar_set(dev, "wpa_auth", val); if (unlikely(err)) { - WL_ERR(("set wpa_auth failed (%d)\n", err)); + WL_ERR("set wpa_auth failed (%d)\n", err); return err; } sec = wl_read_prof(wl, WL_PROF_SEC); @@ -1109,27 +1104,27 @@ wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme) switch (sme->auth_type) { case NL80211_AUTHTYPE_OPEN_SYSTEM: val = 0; - WL_DBG(("open system\n")); + WL_DBG("open system\n"); break; case NL80211_AUTHTYPE_SHARED_KEY: val = 1; - WL_DBG(("shared key\n")); + WL_DBG("shared key\n"); break; case NL80211_AUTHTYPE_AUTOMATIC: val = 2; - WL_DBG(("automatic\n")); + WL_DBG("automatic\n"); break; case NL80211_AUTHTYPE_NETWORK_EAP: - WL_DBG(("network eap\n")); + WL_DBG("network eap\n"); default: val = 2; - WL_ERR(("invalid auth type (%d)\n", sme->auth_type)); + WL_ERR("invalid auth type (%d)\n", sme->auth_type); break; } err = wl_dev_intvar_set(dev, "auth", val); if (unlikely(err)) { - WL_ERR(("set auth failed (%d)\n", err)); + WL_ERR("set auth failed (%d)\n", err); return err; } sec = wl_read_prof(wl, WL_PROF_SEC); @@ -1162,8 +1157,8 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) pval = AES_ENABLED; break; default: - WL_ERR(("invalid cipher pairwise (%d)\n", - sme->crypto.ciphers_pairwise[0])); + WL_ERR("invalid cipher pairwise (%d)\n", + sme->crypto.ciphers_pairwise[0]); return -EINVAL; } } @@ -1183,16 +1178,16 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) gval = AES_ENABLED; break; default: - WL_ERR(("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); + WL_ERR("invalid cipher group (%d)\n", + sme->crypto.cipher_group); return -EINVAL; } } - WL_DBG(("pval (%d) gval (%d)\n", pval, gval)); + WL_DBG("pval (%d) gval (%d)\n", pval, gval); err = wl_dev_intvar_set(dev, "wsec", pval | gval); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); return err; } @@ -1214,7 +1209,7 @@ wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) if (sme->crypto.n_akm_suites) { err = wl_dev_intvar_get(dev, "wpa_auth", &val); if (unlikely(err)) { - WL_ERR(("could not get wpa_auth (%d)\n", err)); + WL_ERR("could not get wpa_auth (%d)\n", err); return err; } if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { @@ -1226,8 +1221,8 @@ wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) val = WPA_AUTH_PSK; break; default: - WL_ERR(("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); + WL_ERR("invalid cipher group (%d)\n", + sme->crypto.cipher_group); return -EINVAL; } } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { @@ -1239,16 +1234,16 @@ wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) val = WPA2_AUTH_PSK; break; default: - WL_ERR(("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); + WL_ERR("invalid cipher group (%d)\n", + sme->crypto.cipher_group); return -EINVAL; } } - WL_DBG(("setting wpa_auth to %d\n", val)); + WL_DBG("setting wpa_auth to %d\n", val); err = wl_dev_intvar_set(dev, "wpa_auth", val); if (unlikely(err)) { - WL_ERR(("could not set wpa_auth (%d)\n", err)); + WL_ERR("could not set wpa_auth (%d)\n", err); return err; } } @@ -1268,11 +1263,11 @@ wl_set_set_sharedkey(struct net_device *dev, s32 val; s32 err = 0; - WL_DBG(("key len (%d)\n", sme->key_len)); + WL_DBG("key len (%d)\n", sme->key_len); if (sme->key_len) { sec = wl_read_prof(wl, WL_PROF_SEC); - WL_DBG(("wpa_versions 0x%x cipher_pairwise 0x%x\n", - sec->wpa_versions, sec->cipher_pairwise)); + WL_DBG("wpa_versions 0x%x cipher_pairwise 0x%x\n", + sec->wpa_versions, sec->cipher_pairwise); if (! (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) @@ -1282,7 +1277,7 @@ wl_set_set_sharedkey(struct net_device *dev, key.len = (u32) sme->key_len; key.index = (u32) sme->key_idx; if (unlikely(key.len > sizeof(key.data))) { - WL_ERR(("Too long key length (%u)\n", key.len)); + WL_ERR("Too long key length (%u)\n", key.len); return -EINVAL; } memcpy(key.data, sme->key, key.len); @@ -1295,27 +1290,27 @@ wl_set_set_sharedkey(struct net_device *dev, key.algo = CRYPTO_ALGO_WEP128; break; default: - WL_ERR(("Invalid algorithm (%d)\n", - sme->crypto.ciphers_pairwise[0])); + WL_ERR("Invalid algorithm (%d)\n", + sme->crypto.ciphers_pairwise[0]); return -EINVAL; } /* Set the new key/index */ - WL_DBG(("key length (%d) key index (%d) algo (%d)\n", - key.len, key.index, key.algo)); - WL_DBG(("key \"%s\"\n", key.data)); + WL_DBG("key length (%d) key index (%d) algo (%d)\n", + key.len, key.index, key.algo); + WL_DBG("key \"%s\"\n", key.data); swap_key_from_BE(&key); err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); if (unlikely(err)) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); + WL_ERR("WLC_SET_KEY error (%d)\n", err); return err; } if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) { - WL_DBG(("set auth_type to shared key\n")); + WL_DBG("set auth_type to shared key\n"); val = 1; /* shared key */ err = wl_dev_intvar_set(dev, "auth", val); if (unlikely(err)) { - WL_ERR(("set auth failed (%d)\n", err)); + WL_ERR("set auth failed (%d)\n", err); return err; } } @@ -1337,15 +1332,15 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, CHECK_SYS_UP(); if (unlikely(!sme->ssid)) { - WL_ERR(("Invalid ssid\n")); + WL_ERR("Invalid ssid\n"); return -EOPNOTSUPP; } if (chan) { wl->channel = ieee80211_frequency_to_channel(chan->center_freq); - WL_DBG(("channel (%d), center_req (%d)\n", wl->channel, - chan->center_freq)); + WL_DBG("channel (%d), center_req (%d)\n", + wl->channel, chan->center_freq); } - WL_DBG(("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len)); + WL_DBG("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); err = wl_set_wpa_version(dev, sme); if (unlikely(err)) return err; @@ -1378,18 +1373,18 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len); join_params.ssid.SSID_len = htod32(join_params.ssid.SSID_len); wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID); - memcpy(&join_params.params.bssid, ðer_bcast, ETHER_ADDR_LEN); + memcpy(&join_params.params.bssid, ðer_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 %d\n", join_params_size); if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) { - WL_DBG(("ssid \"%s\", len (%d)\n", join_params.ssid.SSID, - join_params.ssid.SSID_len)); + WL_DBG("ssid \"%s\", len (%d)\n", + join_params.ssid.SSID, join_params.ssid.SSID_len); } err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); return err; } set_bit(WL_STATUS_CONNECTING, &wl->status); @@ -1406,17 +1401,17 @@ wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, bool act = false; s32 err = 0; - WL_DBG(("Reason %d\n", reason_code)); + WL_DBG("Reason %d\n", reason_code); CHECK_SYS_UP(); act = *(bool *) wl_read_prof(wl, WL_PROF_ACT); if (likely(act)) { scbval.val = reason_code; - memcpy(&scbval.ea, &wl->bssid, ETHER_ADDR_LEN); + memcpy(&scbval.ea, &wl->bssid, ETH_ALEN); scbval.val = htod32(scbval.val); err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t)); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); return err; } } @@ -1441,13 +1436,13 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, break; case NL80211_TX_POWER_LIMITED: if (dbm < 0) { - WL_ERR(("TX_POWER_LIMITTED - dbm is negative\n")); + WL_ERR("TX_POWER_LIMITED - dbm is negative\n"); return -EINVAL; } break; case NL80211_TX_POWER_FIXED: if (dbm < 0) { - WL_ERR(("TX_POWER_FIXED - dbm is negative..\n")); + WL_ERR("TX_POWER_FIXED - dbm is negative\n"); return -EINVAL; } break; @@ -1457,7 +1452,7 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, disable = htod32(disable); err = wl_dev_ioctl(ndev, WLC_SET_RADIO, &disable, sizeof(disable)); if (unlikely(err)) { - WL_ERR(("WLC_SET_RADIO error (%d)\n", err)); + WL_ERR("WLC_SET_RADIO error (%d)\n", err); return err; } @@ -1468,7 +1463,7 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, err = wl_dev_intvar_set(ndev, "qtxpower", (s32) (bcm_mw_to_qdbm(txpwrmw))); if (unlikely(err)) { - WL_ERR(("qtxpower error (%d)\n", err)); + WL_ERR("qtxpower error (%d)\n", err); return err; } wl->conf->tx_power = dbm; @@ -1487,7 +1482,7 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) CHECK_SYS_UP(); err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); return err; } result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE); @@ -1504,12 +1499,12 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, s32 wsec; s32 err = 0; - WL_DBG(("key index (%d)\n", key_idx)); + WL_DBG("key index (%d)\n", key_idx); CHECK_SYS_UP(); err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)); if (unlikely(err)) { - WL_ERR(("WLC_GET_WSEC error (%d)\n", err)); + WL_ERR("WLC_GET_WSEC error (%d)\n", err); return err; } wsec = dtoh32(wsec); @@ -1520,7 +1515,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, err = wl_dev_ioctl(dev, WLC_SET_KEY_PRIMARY, &index, sizeof(index)); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); } } return err; @@ -1537,8 +1532,8 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, key.index = (u32) key_idx; /* Instead of bcast for ea address for default wep keys, driver needs it to be Null */ - if (!ETHER_ISMULTI(mac_addr)) - memcpy((char *)&key.ea, (void *)mac_addr, ETHER_ADDR_LEN); + if (!is_multicast_ether_addr(mac_addr)) + memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN); key.len = (u32) params->key_len; /* check for key index change */ if (key.len == 0) { @@ -1546,16 +1541,16 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, swap_key_from_BE(&key); err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); if (unlikely(err)) { - WL_ERR(("key delete error (%d)\n", err)); + WL_ERR("key delete error (%d)\n", err); return err; } } else { if (key.len > sizeof(key.data)) { - WL_ERR(("Invalid key length (%d)\n", key.len)); + WL_ERR("Invalid key length (%d)\n", key.len); return -EINVAL; } - WL_DBG(("Setting the key index %d\n", key.index)); + WL_DBG("Setting the key index %d\n", key.index); memcpy(key.data, params->key, key.len); if (params->cipher == WLAN_CIPHER_SUITE_TKIP) { @@ -1579,26 +1574,26 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, switch (params->cipher) { case WLAN_CIPHER_SUITE_WEP40: key.algo = CRYPTO_ALGO_WEP1; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); + WL_DBG("WLAN_CIPHER_SUITE_WEP40\n"); break; case WLAN_CIPHER_SUITE_WEP104: key.algo = CRYPTO_ALGO_WEP128; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); + WL_DBG("WLAN_CIPHER_SUITE_WEP104\n"); break; case WLAN_CIPHER_SUITE_TKIP: key.algo = CRYPTO_ALGO_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); + WL_DBG("WLAN_CIPHER_SUITE_TKIP\n"); break; case WLAN_CIPHER_SUITE_AES_CMAC: key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); + WL_DBG("WLAN_CIPHER_SUITE_AES_CMAC\n"); break; case WLAN_CIPHER_SUITE_CCMP: key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_CCMP\n")); + WL_DBG("WLAN_CIPHER_SUITE_CCMP\n"); break; default: - WL_ERR(("Invalid cipher (0x%x)\n", params->cipher)); + WL_ERR("Invalid cipher (0x%x)\n", params->cipher); return -EINVAL; } swap_key_from_BE(&key); @@ -1606,7 +1601,7 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, dhd_wait_pend8021x(dev); err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); if (unlikely(err)) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); + WL_ERR("WLC_SET_KEY error (%d)\n", err); return err; } } @@ -1623,7 +1618,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, s32 wsec; s32 err = 0; - WL_DBG(("key index (%d)\n", key_idx)); + WL_DBG("key index (%d)\n", key_idx); CHECK_SYS_UP(); if (mac_addr) @@ -1634,7 +1629,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, key.index = (u32) key_idx; if (unlikely(key.len > sizeof(key.data))) { - WL_ERR(("Too long key length (%u)\n", key.len)); + WL_ERR("Too long key length (%u)\n", key.len); return -EINVAL; } memcpy(key.data, params->key, key.len); @@ -1643,26 +1638,26 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, switch (params->cipher) { case WLAN_CIPHER_SUITE_WEP40: key.algo = CRYPTO_ALGO_WEP1; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); + WL_DBG("WLAN_CIPHER_SUITE_WEP40\n"); break; case WLAN_CIPHER_SUITE_WEP104: key.algo = CRYPTO_ALGO_WEP128; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); + WL_DBG("WLAN_CIPHER_SUITE_WEP104\n"); break; case WLAN_CIPHER_SUITE_TKIP: key.algo = CRYPTO_ALGO_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); + WL_DBG("WLAN_CIPHER_SUITE_TKIP\n"); break; case WLAN_CIPHER_SUITE_AES_CMAC: key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); + WL_DBG("WLAN_CIPHER_SUITE_AES_CMAC\n"); break; case WLAN_CIPHER_SUITE_CCMP: key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_CCMP\n")); + WL_DBG("WLAN_CIPHER_SUITE_CCMP\n"); break; default: - WL_ERR(("Invalid cipher (0x%x)\n", params->cipher)); + WL_ERR("Invalid cipher (0x%x)\n", params->cipher); return -EINVAL; } @@ -1670,21 +1665,21 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, swap_key_from_BE(&key); err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); if (unlikely(err)) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); + WL_ERR("WLC_SET_KEY error (%d)\n", err); return err; } val = WEP_ENABLED; err = wl_dev_intvar_get(dev, "wsec", &wsec); if (unlikely(err)) { - WL_ERR(("get wsec error (%d)\n", err)); + WL_ERR("get wsec error (%d)\n", err); return err; } wsec &= ~(WEP_ENABLED); wsec |= val; err = wl_dev_intvar_set(dev, "wsec", wsec); if (unlikely(err)) { - WL_ERR(("set wsec error (%d)\n", err)); + WL_ERR("set wsec error (%d)\n", err); return err; } @@ -1692,7 +1687,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, val = htod32(val); err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)); if (unlikely(err)) { - WL_ERR(("WLC_SET_AUTH error (%d)\n", err)); + WL_ERR("WLC_SET_AUTH error (%d)\n", err); return err; } return err; @@ -1714,7 +1709,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, key.flags = WL_PRIMARY_KEY; key.algo = CRYPTO_ALGO_OFF; - WL_DBG(("key index (%d)\n", key_idx)); + WL_DBG("key index (%d)\n", key_idx); /* Set the new key/index */ swap_key_from_BE(&key); err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); @@ -1722,10 +1717,10 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, if (err == -EINVAL) { if (key.index >= DOT11_MAX_DEFAULT_KEYS) { /* we ignore this key index in this case */ - WL_DBG(("invalid key index (%d)\n", key_idx)); + WL_DBG("invalid key index (%d)\n", key_idx); } } else { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); + WL_ERR("WLC_SET_KEY error (%d)\n", err); } return err; } @@ -1733,14 +1728,14 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, val = 0; err = wl_dev_intvar_get(dev, "wsec", &wsec); if (unlikely(err)) { - WL_ERR(("get wsec error (%d)\n", err)); + WL_ERR("get wsec error (%d)\n", err); return err; } wsec &= ~(WEP_ENABLED); wsec |= val; err = wl_dev_intvar_set(dev, "wsec", wsec); if (unlikely(err)) { - WL_ERR(("set wsec error (%d)\n", err)); + WL_ERR("set wsec error (%d)\n", err); return err; } @@ -1748,7 +1743,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, val = htod32(val); err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)); if (unlikely(err)) { - WL_ERR(("WLC_SET_AUTH error (%d)\n", err)); + WL_ERR("WLC_SET_AUTH error (%d)\n", err); return err; } return err; @@ -1766,7 +1761,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, s32 wsec; s32 err = 0; - WL_DBG(("key index (%d)\n", key_idx)); + WL_DBG("key index (%d)\n", key_idx); CHECK_SYS_UP(); memset(&key, 0, sizeof(key)); @@ -1778,7 +1773,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)); if (unlikely(err)) { - WL_ERR(("WLC_GET_WSEC error (%d)\n", err)); + WL_ERR("WLC_GET_WSEC error (%d)\n", err); return err; } wsec = dtoh32(wsec); @@ -1787,22 +1782,22 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, sec = wl_read_prof(wl, WL_PROF_SEC); if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { params.cipher = WLAN_CIPHER_SUITE_WEP40; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); + WL_DBG("WLAN_CIPHER_SUITE_WEP40\n"); } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) { params.cipher = WLAN_CIPHER_SUITE_WEP104; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); + WL_DBG("WLAN_CIPHER_SUITE_WEP104\n"); } break; case TKIP_ENABLED: params.cipher = WLAN_CIPHER_SUITE_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); + WL_DBG("WLAN_CIPHER_SUITE_TKIP\n"); break; case AES_ENABLED: params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); + WL_DBG("WLAN_CIPHER_SUITE_AES_CMAC\n"); break; default: - WL_ERR(("Invalid algo (0x%x)\n", wsec)); + WL_ERR("Invalid algo (0x%x)\n", wsec); return -EINVAL; } @@ -1814,7 +1809,7 @@ static s32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, struct net_device *dev, u8 key_idx) { - WL_INFO(("Not supported\n")); + WL_INFO("Not supported\n"); CHECK_SYS_UP(); return -EOPNOTSUPP; } @@ -1831,20 +1826,20 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, CHECK_SYS_UP(); if (unlikely - (memcmp(mac, wl_read_prof(wl, WL_PROF_BSSID), ETHER_ADDR_LEN))) { - WL_ERR(("Wrong Mac address\n")); + (memcmp(mac, wl_read_prof(wl, WL_PROF_BSSID), ETH_ALEN))) { + WL_ERR("Wrong Mac address\n"); return -ENOENT; } /* Report the current tx rate */ err = wl_dev_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)); if (err) { - WL_ERR(("Could not get rate (%d)\n", err)); + WL_ERR("Could not get rate (%d)\n", err); } else { rate = dtoh32(rate); sinfo->filled |= STATION_INFO_TX_BITRATE; sinfo->txrate.legacy = rate * 5; - WL_DBG(("Rate %d Mbps\n", (rate / 2))); + WL_DBG("Rate %d Mbps\n", rate / 2); } if (test_bit(WL_STATUS_CONNECTED, &wl->status)) { @@ -1852,13 +1847,13 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)); if (unlikely(err)) { - WL_ERR(("Could not get rssi (%d)\n", err)); + WL_ERR("Could not get rssi (%d)\n", err); return err; } rssi = dtoh32(scb_val.val); sinfo->filled |= STATION_INFO_SIGNAL; sinfo->signal = rssi; - WL_DBG(("RSSI %d dBm\n", rssi)); + WL_DBG("RSSI %d dBm\n", rssi); } return err; @@ -1874,13 +1869,13 @@ wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, CHECK_SYS_UP(); pm = enabled ? PM_FAST : PM_OFF; pm = htod32(pm); - WL_DBG(("power save %s\n", (pm ? "enabled" : "disabled"))); + WL_DBG("power save %s\n", (pm ? "enabled" : "disabled")); err = wl_dev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm)); if (unlikely(err)) { if (err == -ENODEV) - WL_DBG(("net_device is not ready yet\n")); + WL_DBG("net_device is not ready yet\n"); else - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); return err; } return err; @@ -1932,7 +1927,7 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, err = wl_dev_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset)); if (unlikely(err)) { - WL_ERR(("could not get current rateset (%d)\n", err)); + WL_ERR("could not get current rateset (%d)\n", err); return err; } @@ -1952,7 +1947,7 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, rate = val / 500000; } - WL_DBG(("rate %d mbps\n", (rate / 2))); + WL_DBG("rate %d mbps\n", rate / 2); /* * @@ -1962,7 +1957,7 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, err_bg = wl_dev_intvar_set(dev, "bg_rate", rate); err_a = wl_dev_intvar_set(dev, "a_rate", rate); if (unlikely(err_bg && err_a)) { - WL_ERR(("could not set fixed rate (%d) (%d)\n", err_bg, err_a)); + WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a); return err_bg | err_a; } @@ -2007,12 +2002,12 @@ wl_update_pmklist(struct net_device *dev, struct wl_pmk_list *pmk_list, { int i, j; - WL_DBG(("No of elements %d\n", pmk_list->pmkids.npmkid)); + 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)); + WL_DBG("PMKID[%d]: %pM =\n", i, + &pmk_list->pmkids.pmkid[i].BSSID); for (j = 0; j < WPA2_PMKID_LEN; j++) { - WL_DBG(("%02x\n", pmk_list->pmkids.pmkid[i].PMKID[j])); + WL_DBG("%02x\n", pmk_list->pmkids.pmkid[i].PMKID[j]); } } if (likely(!err)) { @@ -2034,11 +2029,11 @@ wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, CHECK_SYS_UP(); for (i = 0; i < wl->pmk_list->pmkids.npmkid; i++) if (!memcmp(pmksa->bssid, &wl->pmk_list->pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN)) + ETH_ALEN)) break; if (i < WL_NUM_PMKIDS_MAX) { memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID, pmksa->bssid, - ETHER_ADDR_LEN); + ETH_ALEN); memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID, pmksa->pmkid, WPA2_PMKID_LEN); if (i == wl->pmk_list->pmkids.npmkid) @@ -2046,12 +2041,12 @@ wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, } else { err = -EINVAL; } - WL_DBG(("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n", - &wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid].BSSID)); + 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++) { - WL_DBG(("%02x\n", - wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid]. - PMKID[i])); + WL_DBG("%02x\n", + wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid]. + PMKID[i]); } err = wl_update_pmklist(dev, wl->pmk_list, err); @@ -2069,19 +2064,19 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, int i; CHECK_SYS_UP(); - memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETHER_ADDR_LEN); + memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETH_ALEN); memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WPA2_PMKID_LEN); - WL_DBG(("del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n", - &pmkid.pmkid[0].BSSID)); + WL_DBG("del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n", + &pmkid.pmkid[0].BSSID); for (i = 0; i < WPA2_PMKID_LEN; i++) { - WL_DBG(("%02x\n", pmkid.pmkid[0].PMKID[i])); + WL_DBG("%02x\n", pmkid.pmkid[0].PMKID[i]); } for (i = 0; i < wl->pmk_list->pmkids.npmkid; i++) if (!memcmp (pmksa->bssid, &wl->pmk_list->pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN)) + ETH_ALEN)) break; if ((wl->pmk_list->pmkids.npmkid > 0) @@ -2090,7 +2085,7 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, for (; i < (wl->pmk_list->pmkids.npmkid - 1); i++) { memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID, &wl->pmk_list->pmkids.pmkid[i + 1].BSSID, - ETHER_ADDR_LEN); + ETH_ALEN); memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID, &wl->pmk_list->pmkids.pmkid[i + 1].PMKID, WPA2_PMKID_LEN); @@ -2168,13 +2163,13 @@ static struct wireless_dev *wl_alloc_wdev(s32 sizeof_iface, wdev = kzalloc(sizeof(*wdev), GFP_KERNEL); if (unlikely(!wdev)) { - WL_ERR(("Could not allocate wireless device\n")); + WL_ERR("Could not allocate wireless device\n"); return ERR_PTR(-ENOMEM); } wdev->wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct wl_priv) + sizeof_iface); if (unlikely(!wdev->wiphy)) { - WL_ERR(("Couldn not allocate wiphy device\n")); + WL_ERR("Couldn not allocate wiphy device\n"); err = -ENOMEM; goto wiphy_new_out; } @@ -2204,7 +2199,7 @@ static struct wireless_dev *wl_alloc_wdev(s32 sizeof_iface, #endif /* !WL_POWERSAVE_DISABLED */ err = wiphy_register(wdev->wiphy); if (unlikely(err < 0)) { - WL_ERR(("Couldn not register wiphy device (%d)\n", err)); + WL_ERR("Couldn not register wiphy device (%d)\n", err); goto wiphy_register_out; } return wdev; @@ -2223,7 +2218,7 @@ static void wl_free_wdev(struct wl_priv *wl) struct wireless_dev *wdev = wl_to_wdev(wl); if (unlikely(!wdev)) { - WL_ERR(("wdev is invalid\n")); + WL_ERR("wdev is invalid\n"); return; } wiphy_unregister(wdev->wiphy); @@ -2241,11 +2236,11 @@ static s32 wl_inform_bss(struct wl_priv *wl) bss_list = wl->bss_list; if (unlikely(bss_list->version != WL_BSS_INFO_VERSION)) { - WL_ERR(("Version %d != WL_BSS_INFO_VERSION\n", - bss_list->version)); + WL_ERR("Version %d != WL_BSS_INFO_VERSION\n", + bss_list->version); return -EOPNOTSUPP; } - WL_DBG(("scanned AP count (%d)\n", bss_list->count)); + WL_DBG("scanned AP count (%d)\n", bss_list->count); bi = next_bss(bss_list, bi); for_each_bss(bss_list, bi, i) { err = wl_inform_single_bss(wl, bi); @@ -2270,14 +2265,14 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi) s32 err = 0; if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) { - WL_DBG(("Beacon is larger than buffer. Discarding\n")); + WL_DBG("Beacon is larger than buffer. Discarding\n"); return err; } notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(u8) + WL_BSS_INFO_MAX, GFP_KERNEL); if (unlikely(!notif_bss_info)) { - WL_ERR(("notif_bss_info alloc failed\n")); + WL_ERR("notif_bss_info alloc failed\n"); return -ENOMEM; } mgmt = (struct ieee80211_mgmt *)notif_bss_info->frame_buf; @@ -2289,7 +2284,7 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi) else band = wiphy->bands[IEEE80211_BAND_5GHZ]; notif_bss_info->rssi = bi->RSSI; - memcpy(mgmt->bssid, &bi->BSSID, ETHER_ADDR_LEN); + memcpy(mgmt->bssid, &bi->BSSID, ETH_ALEN); mgmt_type = wl->active_scan ? IEEE80211_STYPE_PROBE_RESP : IEEE80211_STYPE_BEACON; if (!memcmp(bi->SSID, sr->ssid.SSID, bi->SSID_len)) { @@ -2321,17 +2316,17 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi) freq = ieee80211_channel_to_frequency(notif_bss_info->channel); channel = ieee80211_get_channel(wiphy, freq); - WL_DBG(("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n", - bi->SSID, - notif_bss_info->rssi, notif_bss_info->channel, - mgmt->u.beacon.capab_info, &bi->BSSID)); + WL_DBG("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n", + bi->SSID, + notif_bss_info->rssi, notif_bss_info->channel, + mgmt->u.beacon.capab_info, &bi->BSSID); signal = notif_bss_info->rssi * 100; if (unlikely(!cfg80211_inform_bss_frame(wiphy, channel, mgmt, le16_to_cpu (notif_bss_info->frame_len), signal, GFP_KERNEL))) { - WL_ERR(("cfg80211_inform_bss_frame error\n")); + WL_ERR("cfg80211_inform_bss_frame error\n"); kfree(notif_bss_info); return -EINVAL; } @@ -2399,12 +2394,12 @@ wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev, if (wl_is_ibssmode(wl)) { cfg80211_ibss_joined(ndev, (s8 *)&e->addr, GFP_KERNEL); - WL_DBG(("joined in IBSS network\n")); + WL_DBG("joined in IBSS network\n"); } else { wl_bss_connect_done(wl, ndev, e, data, true); - WL_DBG(("joined in BSS network \"%s\"\n", - ((struct wlc_ssid *) - wl_read_prof(wl, WL_PROF_SSID))->SSID)); + WL_DBG("joined in BSS network \"%s\"\n", + ((struct wlc_ssid *) + wl_read_prof(wl, WL_PROF_SSID))->SSID); } act = true; wl_update_prof(wl, e, &act, WL_PROF_ACT); @@ -2459,7 +2454,7 @@ wl_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf, err = wl_dev_ioctl(dev, WLC_GET_VAR, (void *)wl->ioctl_buf, WL_IOCTL_LEN_MAX); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); return err; } memcpy(buf, wl->ioctl_buf, buf_len); @@ -2479,7 +2474,7 @@ static s32 wl_get_assoc_ies(struct wl_priv *wl) err = wl_dev_bufvar_get(ndev, "assoc_info", wl->extra_buf, WL_ASSOC_INFO_MAX); if (unlikely(err)) { - WL_ERR(("could not get assoc info (%d)\n", err)); + WL_ERR("could not get assoc info (%d)\n", err); return err; } assoc_info = (struct wl_assoc_ielen *)wl->extra_buf; @@ -2489,7 +2484,7 @@ static s32 wl_get_assoc_ies(struct wl_priv *wl) err = wl_dev_bufvar_get(ndev, "assoc_req_ies", wl->extra_buf, WL_ASSOC_INFO_MAX); if (unlikely(err)) { - WL_ERR(("could not get assoc req (%d)\n", err)); + WL_ERR("could not get assoc req (%d)\n", err); return err; } conn_info->req_ie_len = req_len; @@ -2503,7 +2498,7 @@ static s32 wl_get_assoc_ies(struct wl_priv *wl) err = wl_dev_bufvar_get(ndev, "assoc_resp_ies", wl->extra_buf, WL_ASSOC_INFO_MAX); if (unlikely(err)) { - WL_ERR(("could not get assoc resp (%d)\n", err)); + WL_ERR("could not get assoc resp (%d)\n", err); return err; } conn_info->resp_ie_len = resp_len; @@ -2513,8 +2508,8 @@ static s32 wl_get_assoc_ies(struct wl_priv *wl) conn_info->resp_ie_len = 0; conn_info->resp_ie = NULL; } - WL_DBG(("req len (%d) resp len (%d)\n", conn_info->req_ie_len, - conn_info->resp_ie_len)); + WL_DBG("req len (%d) resp len (%d)\n", + conn_info->req_ie_len, conn_info->resp_ie_len); return err; } @@ -2547,8 +2542,8 @@ static void wl_ch_to_chanspec(int ch, struct wl_join_params *join_params, join_params->params.chanspec_num = htod32(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)); + WL_DBG("join_params->params.chanspec_list[0]= %#X, channel %d, chanspec %#X\n", + join_params->params.chanspec_list[0], ch, chanspec); } } @@ -2575,16 +2570,16 @@ static s32 wl_update_bss_info(struct wl_priv *wl) rtnl_lock(); if (unlikely(!bss)) { - WL_DBG(("Could not find the AP\n")); + WL_DBG("Could not find the AP\n"); *(u32 *) wl->extra_buf = htod32(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)) { - WL_ERR(("Could not get bss info %d\n", err)); + WL_ERR("Could not get bss info %d\n", err); goto update_bss_info_out; } bi = (struct wl_bss_info *)(wl->extra_buf + 4); - if (unlikely(memcmp(&bi->BSSID, &wl->bssid, ETHER_ADDR_LEN))) { + if (unlikely(memcmp(&bi->BSSID, &wl->bssid, ETH_ALEN))) { err = -EIO; goto update_bss_info_out; } @@ -2596,7 +2591,7 @@ static s32 wl_update_bss_info(struct wl_priv *wl) ie_len = bi->ie_length; beacon_interval = cpu_to_le16(bi->beacon_period); } else { - WL_DBG(("Found the AP in the list - BSSID %pM\n", bss->bssid)); + WL_DBG("Found the AP in the list - BSSID %pM\n", bss->bssid); ie = bss->information_elements; ie_len = bss->len_information_elements; beacon_interval = bss->beacon_interval; @@ -2615,7 +2610,7 @@ static s32 wl_update_bss_info(struct wl_priv *wl) err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_DTIMPRD, &dtim_period, sizeof(dtim_period)); if (unlikely(err)) { - WL_ERR(("WLC_GET_DTIMPRD error (%d)\n", err)); + WL_ERR("WLC_GET_DTIMPRD error (%d)\n", err); goto update_bss_info_out; } } @@ -2636,13 +2631,13 @@ wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev, s32 err = 0; wl_get_assoc_ies(wl); - memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); + memcpy(&wl->bssid, &e->addr, ETH_ALEN); wl_update_bss_info(wl); cfg80211_roamed(ndev, (u8 *)&wl->bssid, conn_info->req_ie, conn_info->req_ie_len, conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); - WL_DBG(("Report roaming result\n")); + WL_DBG("Report roaming result\n"); set_bit(WL_STATUS_CONNECTED, &wl->status); @@ -2657,7 +2652,7 @@ wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev, s32 err = 0; wl_get_assoc_ies(wl); - memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); + memcpy(&wl->bssid, &e->addr, ETH_ALEN); wl_update_bss_info(wl); if (test_and_clear_bit(WL_STATUS_CONNECTING, &wl->status)) { cfg80211_connect_result(ndev, @@ -2668,15 +2663,15 @@ wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev, conn_info->resp_ie_len, completed ? WLAN_STATUS_SUCCESS : WLAN_STATUS_AUTH_TIMEOUT, GFP_KERNEL); - WL_DBG(("Report connect result - connection %s\n", - completed ? "succeeded" : "failed")); + WL_DBG("Report connect result - connection %s\n", + completed ? "succeeded" : "failed"); } else { cfg80211_roamed(ndev, (u8 *)&wl->bssid, conn_info->req_ie, conn_info->req_ie_len, conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); - WL_DBG(("Report roaming result\n")); + WL_DBG("Report roaming result\n"); } set_bit(WL_STATUS_CONNECTED, &wl->status); @@ -2716,7 +2711,7 @@ wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, return wl_wakeup_iscan(wl_to_iscan(wl)); if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scan complete while device not scanning\n")); + WL_ERR("Scan complete while device not scanning\n"); return -EINVAL; } if (unlikely(!wl->scan_request)) { @@ -2725,14 +2720,14 @@ wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, err = wl_dev_ioctl(ndev, WLC_GET_CHANNEL, &channel_inform, sizeof(channel_inform)); if (unlikely(err)) { - WL_ERR(("scan busy (%d)\n", err)); + WL_ERR("scan busy (%d)\n", err); goto scan_done_out; } channel_inform.scan_channel = dtoh32(channel_inform.scan_channel); if (unlikely(channel_inform.scan_channel)) { - WL_DBG(("channel_inform.scan_channel (%d)\n", - channel_inform.scan_channel)); + WL_DBG("channel_inform.scan_channel (%d)\n", + channel_inform.scan_channel); } wl->bss_list = wl->scan_results; bss_list = wl->bss_list; @@ -2740,7 +2735,7 @@ wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, bss_list->buflen = htod32(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)); + WL_ERR("%s Scan_results error (%d)\n", ndev->name, err); err = -EINVAL; goto scan_done_out; } @@ -2794,55 +2789,54 @@ static void wl_init_eloop_handler(struct wl_event_loop *el) static s32 wl_init_priv_mem(struct wl_priv *wl) { - wl->scan_results = (void *)kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL); + wl->scan_results = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL); if (unlikely(!wl->scan_results)) { - WL_ERR(("Scan results alloc failed\n")); + WL_ERR("Scan results alloc failed\n"); goto init_priv_mem_out; } - wl->conf = (void *)kzalloc(sizeof(*wl->conf), GFP_KERNEL); + wl->conf = kzalloc(sizeof(*wl->conf), GFP_KERNEL); if (unlikely(!wl->conf)) { - WL_ERR(("wl_conf alloc failed\n")); + WL_ERR("wl_conf alloc failed\n"); goto init_priv_mem_out; } - wl->profile = (void *)kzalloc(sizeof(*wl->profile), GFP_KERNEL); + wl->profile = kzalloc(sizeof(*wl->profile), GFP_KERNEL); if (unlikely(!wl->profile)) { - WL_ERR(("wl_profile alloc failed\n")); + WL_ERR("wl_profile alloc failed\n"); goto init_priv_mem_out; } - wl->bss_info = (void *)kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); + wl->bss_info = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); if (unlikely(!wl->bss_info)) { - WL_ERR(("Bss information alloc failed\n")); + WL_ERR("Bss information alloc failed\n"); goto init_priv_mem_out; } - wl->scan_req_int = - (void *)kzalloc(sizeof(*wl->scan_req_int), GFP_KERNEL); + wl->scan_req_int = kzalloc(sizeof(*wl->scan_req_int), GFP_KERNEL); if (unlikely(!wl->scan_req_int)) { - WL_ERR(("Scan req alloc failed\n")); + WL_ERR("Scan req alloc failed\n"); goto init_priv_mem_out; } - wl->ioctl_buf = (void *)kzalloc(WL_IOCTL_LEN_MAX, GFP_KERNEL); + wl->ioctl_buf = kzalloc(WL_IOCTL_LEN_MAX, GFP_KERNEL); if (unlikely(!wl->ioctl_buf)) { - WL_ERR(("Ioctl buf alloc failed\n")); + WL_ERR("Ioctl buf alloc failed\n"); goto init_priv_mem_out; } - wl->extra_buf = (void *)kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); + wl->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); if (unlikely(!wl->extra_buf)) { - WL_ERR(("Extra buf alloc failed\n")); + WL_ERR("Extra buf alloc failed\n"); goto init_priv_mem_out; } - wl->iscan = (void *)kzalloc(sizeof(*wl->iscan), GFP_KERNEL); + wl->iscan = kzalloc(sizeof(*wl->iscan), GFP_KERNEL); if (unlikely(!wl->iscan)) { - WL_ERR(("Iscan buf alloc failed\n")); + WL_ERR("Iscan buf alloc failed\n"); goto init_priv_mem_out; } - wl->fw = (void *)kzalloc(sizeof(*wl->fw), GFP_KERNEL); + wl->fw = kzalloc(sizeof(*wl->fw), GFP_KERNEL); if (unlikely(!wl->fw)) { - WL_ERR(("fw object alloc failed\n")); + WL_ERR("fw object alloc failed\n"); goto init_priv_mem_out; } - wl->pmk_list = (void *)kzalloc(sizeof(*wl->pmk_list), GFP_KERNEL); + wl->pmk_list = kzalloc(sizeof(*wl->pmk_list), GFP_KERNEL); if (unlikely(!wl->pmk_list)) { - WL_ERR(("pmk list alloc failed\n")); + WL_ERR("pmk list alloc failed\n"); goto init_priv_mem_out; } @@ -2884,7 +2878,7 @@ static s32 wl_create_event_handler(struct wl_priv *wl) wl->event_tsk = kthread_run(wl_event_handler, wl, "wl_event_handler"); if (IS_ERR(wl->event_tsk)) { wl->event_tsk = NULL; - WL_ERR(("failed to create event thread\n")); + WL_ERR("failed to create event thread\n"); return -ENOMEM; } return 0; @@ -2917,7 +2911,7 @@ static void wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted) struct net_device *ndev = wl_to_ndev(wl); if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scan complete while device not scanning\n")); + WL_ERR("Scan complete while device not scanning\n"); return; } if (likely(wl->scan_request)) { @@ -2931,7 +2925,7 @@ static void wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted) static s32 wl_wakeup_iscan(struct wl_iscan_ctrl *iscan) { if (likely(iscan->state != WL_ISCAN_STATE_IDLE)) { - WL_DBG(("wake up iscan\n")); + WL_DBG("wake up iscan\n"); up(&iscan->sync); return 0; } @@ -2961,14 +2955,14 @@ wl_get_iscan_results(struct wl_iscan_ctrl *iscan, u32 *status, WL_ISCAN_RESULTS_FIXED_SIZE, iscan->scan_buf, WL_ISCAN_BUF_MAX); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); return err; } results->buflen = dtoh32(results->buflen); results->version = dtoh32(results->version); results->count = dtoh32(results->count); - WL_DBG(("results->count = %d\n", results->count)); - WL_DBG(("results->buflen = %d\n", results->buflen)); + WL_DBG("results->count = %d\n", results->count); + WL_DBG("results->buflen = %d\n", results->buflen); *status = dtoh32(list_buf->status); *bss_list = results; @@ -3053,7 +3047,7 @@ static s32 wl_iscan_thread(void *data) err = wl_get_iscan_results(iscan, &status, &wl->bss_list); if (unlikely(err)) { status = WL_SCAN_RESULTS_ABORTED; - WL_ERR(("Abort iscan\n")); + WL_ERR("Abort iscan\n"); } rtnl_unlock(); el->handler[status] (wl); @@ -3062,7 +3056,7 @@ static s32 wl_iscan_thread(void *data) del_timer_sync(&iscan->timer); iscan->timer_on = 0; } - WL_DBG(("%s was terminated\n", __func__)); + WL_DBG("%s was terminated\n", __func__); return 0; } @@ -3073,7 +3067,7 @@ static void wl_iscan_timer(unsigned long data) if (iscan) { iscan->timer_on = 0; - WL_DBG(("timer expired\n")); + WL_DBG("timer expired\n"); wl_wakeup_iscan(iscan); } } @@ -3088,7 +3082,7 @@ static s32 wl_invoke_iscan(struct wl_priv *wl) sema_init(&iscan->sync, 0); iscan->tsk = kthread_run(wl_iscan_thread, iscan, "wl_iscan"); if (IS_ERR(iscan->tsk)) { - WL_ERR(("Could not create iscan thread\n")); + WL_ERR("Could not create iscan thread\n"); iscan->tsk = NULL; return -ENOMEM; } @@ -3123,7 +3117,7 @@ static s32 wl_init_iscan(struct wl_priv *wl) sema_init(&iscan->sync, 0); iscan->tsk = kthread_run(wl_iscan_thread, iscan, "wl_iscan"); if (IS_ERR(iscan->tsk)) { - WL_ERR(("Could not create iscan thread\n")); + WL_ERR("Could not create iscan thread\n"); iscan->tsk = NULL; return -ENOMEM; } @@ -3192,17 +3186,17 @@ s32 wl_cfg80211_attach(struct net_device *ndev, void *data) s32 err = 0; if (unlikely(!ndev)) { - WL_ERR(("ndev is invaild\n")); + WL_ERR("ndev is invalid\n"); return -ENODEV; } wl_cfg80211_dev = kzalloc(sizeof(struct wl_dev), GFP_KERNEL); if (unlikely(!wl_cfg80211_dev)) { - WL_ERR(("wl_cfg80211_dev is invalid\n")); + WL_ERR("wl_cfg80211_dev is invalid\n"); return -ENOMEM; } - WL_DBG(("func %p\n", wl_cfg80211_get_sdio_func())); + WL_DBG("func %p\n", wl_cfg80211_get_sdio_func()); wdev = wl_alloc_wdev(sizeof(struct wl_iface), &wl_cfg80211_get_sdio_func()->dev); - if (unlikely(IS_ERR(wdev))) + if (IS_ERR(wdev)) return -ENOMEM; wdev->iftype = wl_mode_to_nl80211_iftype(WL_MODE_BSS); @@ -3216,7 +3210,7 @@ s32 wl_cfg80211_attach(struct net_device *ndev, void *data) wdev->netdev = ndev; err = wl_init_priv(wl); if (unlikely(err)) { - WL_ERR(("Failed to init iwm_priv (%d)\n", err)); + WL_ERR("Failed to init iwm_priv (%d)\n", err); goto cfg80211_attach_out; } wl_set_drvdata(wl_cfg80211_dev, ci); @@ -3261,19 +3255,19 @@ static s32 wl_event_handler(void *data) break; e = wl_deq_event(wl); if (unlikely(!e)) { - WL_ERR(("eqeue empty..\n")); + WL_ERR("event queue empty...\n"); BUG(); } - WL_DBG(("event type (%d)\n", e->etype)); + WL_DBG("event type (%d)\n", e->etype); if (wl->el.handler[e->etype]) { wl->el.handler[e->etype] (wl, wl_to_ndev(wl), &e->emsg, e->edata); } else { - WL_DBG(("Unknown Event (%d): ignoring\n", e->etype)); + WL_DBG("Unknown Event (%d): ignoring\n", e->etype); } wl_put_event(e); } - WL_DBG(("%s was terminated\n", __func__)); + WL_DBG("%s was terminated\n", __func__); return 0; } @@ -3286,7 +3280,7 @@ wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t * e, void *data) s8 *estr = (event_type <= sizeof(wl_dbg_estr) / WL_DBG_ESTR_MAX - 1) ? wl_dbg_estr[event_type] : (s8 *) "Unknown"; #endif /* (WL_DBG_LEVEL > 0) */ - WL_DBG(("event_type (%d):" "WLC_E_" "%s\n", event_type, estr)); + WL_DBG("event_type (%d):" "WLC_E_" "%s\n", event_type, estr); if (likely(!wl_enq_event(wl, event_type, e, data))) wl_wakeup_event(wl); } @@ -3341,7 +3335,7 @@ wl_enq_event(struct wl_priv *wl, u32 event, const wl_event_msg_t *msg, e = kzalloc(sizeof(struct wl_event_q), GFP_KERNEL); if (unlikely(!e)) { - WL_ERR(("event alloc failed\n")); + WL_ERR("event alloc failed\n"); return -ENOMEM; } @@ -3385,8 +3379,8 @@ static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype) switch (iftype) { case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_WDS: - WL_ERR(("type (%d) : currently we do not support this mode\n", - iftype)); + WL_ERR("type (%d) : currently we do not support this mode\n", + iftype); err = -EINVAL; return err; case NL80211_IFTYPE_ADHOC: @@ -3396,20 +3390,20 @@ static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype) break; default: err = -EINVAL; - WL_ERR(("invalid type (%d)\n", iftype)); + WL_ERR("invalid type (%d)\n", iftype); return err; } infra = htod32(infra); ap = htod32(ap); - WL_DBG(("%s ap (%d), infra (%d)\n", ndev->name, ap, infra)); + 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)) { - WL_ERR(("WLC_SET_INFRA error (%d)\n", err)); + WL_ERR("WLC_SET_INFRA error (%d)\n", err); return err; } err = wl_dev_ioctl(ndev, WLC_SET_AP, &ap, sizeof(ap)); if (unlikely(err)) { - WL_ERR(("WLC_SET_AP error (%d)\n", err)); + WL_ERR("WLC_SET_AP error (%d)\n", err); return err; } @@ -3431,7 +3425,7 @@ static s32 wl_dongle_up(struct net_device *ndev, u32 up) err = wl_dev_ioctl(ndev, WLC_UP, &up, sizeof(up)); if (unlikely(err)) { - WL_ERR(("WLC_UP error (%d)\n", err)); + WL_ERR("WLC_UP error (%d)\n", err); } return err; } @@ -3442,7 +3436,7 @@ static s32 wl_dongle_power(struct net_device *ndev, u32 power_mode) err = wl_dev_ioctl(ndev, WLC_SET_PM, &power_mode, sizeof(power_mode)); if (unlikely(err)) { - WL_ERR(("WLC_SET_PM error (%d)\n", err)); + WL_ERR("WLC_SET_PM error (%d)\n", err); } return err; } @@ -3459,14 +3453,14 @@ wl_dongle_glom(struct net_device *ndev, u32 glom, u32 dongle_align) sizeof(iovbuf)); err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); if (unlikely(err)) { - WL_ERR(("txglomalign error (%d)\n", err)); + WL_ERR("txglomalign error (%d)\n", err); goto dongle_glom_out; } /* disable glom option per default */ bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); if (unlikely(err)) { - WL_ERR(("txglom error (%d)\n", err)); + WL_ERR("txglom error (%d)\n", err); goto dongle_glom_out; } dongle_glom_out: @@ -3487,7 +3481,7 @@ wl_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout) sizeof(iovbuf)); err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); if (unlikely(err)) { - WL_ERR(("bcn_timeout error (%d)\n", err)); + WL_ERR("bcn_timeout error (%d)\n", err); goto dongle_rom_out; } } @@ -3496,7 +3490,7 @@ wl_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout) bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, sizeof(iovbuf)); err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); if (unlikely(err)) { - WL_ERR(("roam_off error (%d)\n", err)); + WL_ERR("roam_off error (%d)\n", err); goto dongle_rom_out; } dongle_rom_out: @@ -3516,7 +3510,7 @@ static s32 wl_dongle_eventmsg(struct net_device *ndev) sizeof(iovbuf)); err = wl_dev_ioctl(ndev, WLC_GET_VAR, iovbuf, sizeof(iovbuf)); if (unlikely(err)) { - WL_ERR(("Get event_msgs error (%d)\n", err)); + WL_ERR("Get event_msgs error (%d)\n", err); goto dongle_eventmsg_out; } memcpy(eventmask, iovbuf, WL_EVENTING_MASK_LEN); @@ -3544,7 +3538,7 @@ static s32 wl_dongle_eventmsg(struct net_device *ndev) sizeof(iovbuf)); err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); if (unlikely(err)) { - WL_ERR(("Set event_msgs error (%d)\n", err)); + WL_ERR("Set event_msgs error (%d)\n", err); goto dongle_eventmsg_out; } @@ -3562,9 +3556,9 @@ wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, sizeof(scan_assoc_time)); if (err) { if (err == -EOPNOTSUPP) { - WL_INFO(("Scan assoc time is not supported\n")); + WL_INFO("Scan assoc time is not supported\n"); } else { - WL_ERR(("Scan assoc time error (%d)\n", err)); + WL_ERR("Scan assoc time error (%d)\n", err); } goto dongle_scantime_out; } @@ -3572,9 +3566,9 @@ wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, sizeof(scan_unassoc_time)); if (err) { if (err == -EOPNOTSUPP) { - WL_INFO(("Scan unassoc time is not supported\n")); + WL_INFO("Scan unassoc time is not supported\n"); } else { - WL_ERR(("Scan unassoc time error (%d)\n", err)); + WL_ERR("Scan unassoc time error (%d)\n", err); } goto dongle_scantime_out; } @@ -3595,9 +3589,9 @@ wl_dongle_offload(struct net_device *ndev, s32 arpoe, s32 arp_ol) err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); if (err) { if (err == -EOPNOTSUPP) - WL_INFO(("arpoe is not supported\n")); + WL_INFO("arpoe is not supported\n"); else - WL_ERR(("arpoe error (%d)\n", err)); + WL_ERR("arpoe error (%d)\n", err); goto dongle_offload_out; } @@ -3605,9 +3599,9 @@ wl_dongle_offload(struct net_device *ndev, s32 arpoe, s32 arp_ol) err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); if (err) { if (err == -EOPNOTSUPP) - WL_INFO(("arp_ol is not supported\n")); + WL_INFO("arp_ol is not supported\n"); else - WL_ERR(("arp_ol error (%d)\n", err)); + WL_ERR("arp_ol error (%d)\n", err); goto dongle_offload_out; } @@ -3620,12 +3614,12 @@ static s32 wl_pattern_atoh(s8 *src, s8 *dst) { int i; if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) { - WL_ERR(("Mask invalid format. Needs to start with 0x\n")); + WL_ERR("Mask invalid format. Needs to start with 0x\n"); return -1; } src = src + 2; /* Skip past 0x */ if (strlen(src) % 2 != 0) { - WL_ERR(("Mask invalid format. Needs to be of even length\n")); + WL_ERR("Mask invalid format. Needs to be of even length\n"); return -1; } for (i = 0; *src != '\0'; i++) { @@ -3684,7 +3678,7 @@ static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode) mask_and_pattern[mask_size])); if (mask_size != pattern_size) { - WL_ERR(("Mask and pattern not the same size\n")); + WL_ERR("Mask and pattern not the same size\n"); err = -EINVAL; goto dongle_filter_out; } @@ -3704,9 +3698,9 @@ static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode) err = wl_dev_ioctl(ndev, WLC_SET_VAR, buf, buf_len); if (err) { if (err == -EOPNOTSUPP) { - WL_INFO(("filter not supported\n")); + WL_INFO("filter not supported\n"); } else { - WL_ERR(("filter (%d)\n", err)); + WL_ERR("filter (%d)\n", err); } goto dongle_filter_out; } @@ -3717,9 +3711,9 @@ static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode) err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); if (err) { if (err == -EOPNOTSUPP) { - WL_INFO(("filter_mode not supported\n")); + WL_INFO("filter_mode not supported\n"); } else { - WL_ERR(("filter_mode (%d)\n", err)); + WL_ERR("filter_mode (%d)\n", err); } goto dongle_filter_out; } @@ -3800,12 +3794,12 @@ static s32 wl_update_wiphybands(struct wl_priv *wl) err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_PHYLIST, &phy_list, sizeof(phy_list)); if (unlikely(err)) { - WL_ERR(("error (%d)\n", err)); + WL_ERR("error (%d)\n", err); return err; } phy = ((char *)&phy_list)[1]; - WL_DBG(("%c phy\n", phy)); + WL_DBG("%c phy\n", phy); if (phy == 'n' || phy == 'a') { wiphy = wl_to_wiphy(wl); wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n; @@ -3911,7 +3905,7 @@ static void *wl_read_prof(struct wl_priv *wl, s32 item) case WL_PROF_SSID: return &wl->profile->ssid; } - WL_ERR(("invalid item (%d)\n", item)); + WL_ERR("invalid item (%d)\n", item); return NULL; } @@ -3932,9 +3926,9 @@ wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e, void *data, break; case WL_PROF_BSSID: if (data) - memcpy(wl->profile->bssid, data, ETHER_ADDR_LEN); + memcpy(wl->profile->bssid, data, ETH_ALEN); else - memset(wl->profile->bssid, 0, ETHER_ADDR_LEN); + memset(wl->profile->bssid, 0, ETH_ALEN); break; case WL_PROF_SEC: memcpy(&wl->profile->sec, data, sizeof(wl->profile->sec)); @@ -3949,7 +3943,7 @@ wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e, void *data, wl->profile->dtim_period = *(u8 *)data; break; default: - WL_ERR(("unsupported item (%d)\n", item)); + WL_ERR("unsupported item (%d)\n", item); err = -EOPNOTSUPP; break; } @@ -3991,7 +3985,7 @@ static __used s32 wl_add_ie(struct wl_priv *wl, u8 t, u8 l, u8 *v) s32 err = 0; if (unlikely(ie->offset + l + 2 > WL_TLV_INFO_MAX)) { - WL_ERR(("ei crosses buffer boundary\n")); + WL_ERR("ei crosses buffer boundary\n"); return -ENOSPC; } ie->buf[ie->offset] = t; @@ -4008,7 +4002,7 @@ static s32 wl_mrg_ie(struct wl_priv *wl, u8 *ie_stream, u16 ie_size) s32 err = 0; if (unlikely(ie->offset + ie_size > WL_TLV_INFO_MAX)) { - WL_ERR(("ei_stream crosses buffer boundary\n")); + WL_ERR("ei_stream crosses buffer boundary\n"); return -ENOSPC; } memcpy(&ie->buf[ie->offset], ie_stream, ie_size); @@ -4023,7 +4017,7 @@ static s32 wl_cp_ie(struct wl_priv *wl, u8 *dst, u16 dst_size) s32 err = 0; if (unlikely(ie->offset > dst_size)) { - WL_ERR(("dst_size is not enough\n")); + WL_ERR("dst_size is not enough\n"); return -ENOSPC; } memcpy(dst, &ie->buf[0], ie->offset); @@ -4123,37 +4117,37 @@ void *wl_cfg80211_request_fw(s8 *file_name) const struct firmware *fw_entry = NULL; s32 err = 0; - WL_DBG(("file name : \"%s\"\n", file_name)); + WL_DBG("file name : \"%s\"\n", file_name); wl = WL_PRIV_GET(); if (!test_bit(WL_FW_LOADING_DONE, &wl->fw->status)) { err = request_firmware(&wl->fw->fw_entry, file_name, &wl_cfg80211_get_sdio_func()->dev); if (unlikely(err)) { - WL_ERR(("Could not download fw (%d)\n", err)); + WL_ERR("Could not download fw (%d)\n", err); goto req_fw_out; } set_bit(WL_FW_LOADING_DONE, &wl->fw->status); fw_entry = wl->fw->fw_entry; if (fw_entry) { - WL_DBG(("fw size (%zd), data (%p)\n", fw_entry->size, - fw_entry->data)); + WL_DBG("fw size (%zd), data (%p)\n", + fw_entry->size, fw_entry->data); } } else if (!test_bit(WL_NVRAM_LOADING_DONE, &wl->fw->status)) { err = request_firmware(&wl->fw->fw_entry, file_name, &wl_cfg80211_get_sdio_func()->dev); if (unlikely(err)) { - WL_ERR(("Could not download nvram (%d)\n", err)); + WL_ERR("Could not download nvram (%d)\n", err); goto req_fw_out; } set_bit(WL_NVRAM_LOADING_DONE, &wl->fw->status); fw_entry = wl->fw->fw_entry; if (fw_entry) { - WL_DBG(("nvram size (%zd), data (%p)\n", fw_entry->size, - fw_entry->data)); + WL_DBG("nvram size (%zd), data (%p)\n", + fw_entry->size, fw_entry->data); } } else { - WL_DBG(("Downloading already done. Nothing to do more\n")); + WL_DBG("Downloading already done. Nothing to do more\n"); err = -EPERM; } @@ -4189,10 +4183,10 @@ static void wl_set_mpc(struct net_device *ndev, int mpc) err = wl_dev_intvar_set(ndev, "mpc", mpc); if (unlikely(err)) { - WL_ERR(("fail to set mpc\n")); + WL_ERR("fail to set mpc\n"); return; } - WL_DBG(("MPC : %d\n", mpc)); + WL_DBG("MPC : %d\n", mpc); } static int wl_debugfs_add_netdev_params(struct wl_priv *wl) diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h index 770e63f..482691b 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h @@ -54,34 +54,36 @@ struct wl_ibss; #define WL_DBG_LEVEL 1 /* 0 invalidates all debug messages. default is 1 */ -#define WL_ERR(args) \ -do { \ - if (wl_dbg_level & WL_DBG_ERR) { \ - if (net_ratelimit()) { \ - printk(KERN_ERR "ERROR @%s : ", __func__); \ - printk args; \ - } \ - } \ +#define WL_ERR(fmt, args...) \ +do { \ + if (wl_dbg_level & WL_DBG_ERR) { \ + if (net_ratelimit()) { \ + printk(KERN_ERR "ERROR @%s : " fmt, \ + __func__, ##args); \ + } \ + } \ } while (0) -#define WL_INFO(args) \ -do { \ - if (wl_dbg_level & WL_DBG_INFO) { \ - if (net_ratelimit()) { \ - printk(KERN_ERR "INFO @%s : ", __func__); \ - printk args; \ - } \ - } \ + +#define WL_INFO(fmt, args...) \ +do { \ + if (wl_dbg_level & WL_DBG_INFO) { \ + if (net_ratelimit()) { \ + printk(KERN_ERR "INFO @%s : " fmt, \ + __func__, ##args); \ + } \ + } \ } while (0) + #if (WL_DBG_LEVEL > 0) -#define WL_DBG(args) \ -do { \ +#define WL_DBG(fmt, args...) \ +do { \ if (wl_dbg_level & WL_DBG_DBG) { \ - printk(KERN_ERR "DEBUG @%s :", __func__); \ - printk args; \ - } \ + printk(KERN_ERR "DEBUG @%s :" fmt, \ + __func__, ##args); \ + } \ } while (0) #else /* !(WL_DBG_LEVEL > 0) */ -#define WL_DBG(args) +#define WL_DBG(fmt, args...) noprintk(fmt, ##args) #endif /* (WL_DBG_LEVEL > 0) */ #define WL_SCAN_RETRY_MAX 3 /* used for ibss scan */ @@ -237,7 +239,7 @@ struct wl_ibss { struct wl_profile { u32 mode; struct wlc_ssid ssid; - u8 bssid[ETHER_ADDR_LEN]; + u8 bssid[ETH_ALEN]; u16 beacon_interval; u8 dtim_period; struct wl_security sec; diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c index 979a494..db6e68e 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c @@ -15,8 +15,9 @@ */ #include <linux/kthread.h> +#include <linux/semaphore.h> #include <bcmdefs.h> -#include <linuxver.h> +#include <linux/netdevice.h> #include <osl.h> #include <wlioctl.h> @@ -31,20 +32,18 @@ #include <dhd.h> #include <dhdioctl.h> -typedef void wlc_info_t; -typedef void wl_info_t; typedef const struct si_pub si_t; #include <wlioctl.h> #include <proto/ethernet.h> #include <dngl_stats.h> #include <dhd.h> -#define WL_ERROR(x) printf x -#define WL_TRACE(x) -#define WL_ASSOC(x) -#define WL_INFORM(x) -#define WL_WSEC(x) -#define WL_SCAN(x) + +#define WL_ERROR(fmt, args...) printk(fmt, ##args) +#define WL_TRACE(fmt, args...) no_printk(fmt, ##args) +#define WL_INFORM(fmt, args...) no_printk(fmt, ##args) +#define WL_WSEC(fmt, args...) no_printk(fmt, ##args) +#define WL_SCAN(fmt, args...) no_printk(fmt, ##args) #include <wl_iw.h> @@ -187,12 +186,12 @@ static int dev_wlc_ioctl(struct net_device *dev, int cmd, void *arg, int len) int ret = -EINVAL; if (!dev) { - WL_ERROR(("%s: dev is null\n", __func__)); + WL_ERROR("%s: dev is null\n", __func__); return ret; } - WL_INFORM(("\n%s, PID:%x: send Local IOCTL -> dhd: cmd:0x%x, buf:%p, " - "len:%d ,\n", __func__, current->pid, cmd, arg, len)); + WL_INFORM("\n%s, PID:%x: send Local IOCTL -> dhd: cmd:0x%x, buf:%p, len:%d\n", + __func__, current->pid, cmd, arg, len); if (g_onoff == G_WLAN_SET_ON) { memset(&ioc, 0, sizeof(ioc)); @@ -205,7 +204,7 @@ static int dev_wlc_ioctl(struct net_device *dev, int cmd, void *arg, int len) ret = dev_open(dev); if (ret) { - WL_ERROR(("%s: Error dev_open: %d\n", __func__, ret)); + WL_ERROR("%s: Error dev_open: %d\n", __func__, ret); return ret; } @@ -214,7 +213,7 @@ static int dev_wlc_ioctl(struct net_device *dev, int cmd, void *arg, int len) ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE); set_fs(fs); } else { - WL_TRACE(("%s: call after driver stop : ignored\n", __func__)); + WL_TRACE("%s: call after driver stop : ignored\n", __func__); } return ret; } @@ -335,7 +334,7 @@ wl_iw_config_commit(struct net_device *dev, int error; struct sockaddr bssid; - WL_TRACE(("%s: SIOCSIWCOMMIT\n", dev->name)); + WL_TRACE("%s: SIOCSIWCOMMIT\n", dev->name); error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid)); if (error) @@ -346,11 +345,11 @@ wl_iw_config_commit(struct net_device *dev, if (!ssid.SSID_len) return 0; - bzero(&bssid, sizeof(struct sockaddr)); - error = dev_wlc_ioctl(dev, WLC_REASSOC, &bssid, ETHER_ADDR_LEN); + memset(&bssid, 0, sizeof(struct sockaddr)); + error = dev_wlc_ioctl(dev, WLC_REASSOC, &bssid, ETH_ALEN); if (error) { - WL_ERROR(("%s: WLC_REASSOC to %s failed \n", __func__, - ssid.SSID)); + WL_ERROR("%s: WLC_REASSOC to %s failed\n", + __func__, ssid.SSID); return error; } @@ -361,7 +360,7 @@ static int wl_iw_get_name(struct net_device *dev, struct iw_request_info *info, char *cwrq, char *extra) { - WL_TRACE(("%s: SIOCGIWNAME\n", dev->name)); + WL_TRACE("%s: SIOCGIWNAME\n", dev->name); strcpy(cwrq, "IEEE 802.11-DS"); @@ -375,7 +374,7 @@ wl_iw_set_freq(struct net_device *dev, int error, chan; uint sf = 0; - WL_TRACE(("\n %s %s: SIOCSIWFREQ\n", __func__, dev->name)); + WL_TRACE("\n %s %s: SIOCSIWFREQ\n", __func__, dev->name); if (fwrq->e == 0 && fwrq->m < MAXCHANNEL) { chan = fwrq->m; @@ -410,7 +409,7 @@ wl_iw_get_freq(struct net_device *dev, channel_info_t ci; int error; - WL_TRACE(("%s: SIOCGIWFREQ\n", dev->name)); + WL_TRACE("%s: SIOCGIWFREQ\n", dev->name); error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci)); if (error) @@ -427,7 +426,7 @@ wl_iw_set_mode(struct net_device *dev, { int infra = 0, ap = 0, error = 0; - WL_TRACE(("%s: SIOCSIWMODE\n", dev->name)); + WL_TRACE("%s: SIOCSIWMODE\n", dev->name); switch (*uwrq) { case IW_MODE_MASTER: @@ -462,7 +461,7 @@ wl_iw_get_mode(struct net_device *dev, { int error, infra = 0, ap = 0; - WL_TRACE(("%s: SIOCGIWMODE\n", dev->name)); + WL_TRACE("%s: SIOCGIWMODE\n", dev->name); error = dev_wlc_ioctl(dev, WLC_GET_INFRA, &infra, sizeof(infra)); if (error) @@ -501,14 +500,14 @@ wl_iw_get_range(struct net_device *dev, {30, 60, 90, 120, 180, 240, 270, 300} }; - WL_TRACE(("%s: SIOCGIWRANGE\n", dev->name)); + WL_TRACE("%s: SIOCGIWRANGE\n", dev->name); if (!extra) return -EINVAL; channels = kmalloc((MAXCHANNEL + 1) * 4, GFP_KERNEL); if (!channels) { - WL_ERROR(("Could not alloc channels\n")); + WL_ERROR("Could not alloc channels\n"); return -ENOMEM; } list = (wl_u32_list_t *) channels; @@ -684,14 +683,14 @@ wl_iw_set_spy(struct net_device *dev, struct sockaddr *addr = (struct sockaddr *)extra; int i; - WL_TRACE(("%s: SIOCSIWSPY\n", dev->name)); + WL_TRACE("%s: SIOCSIWSPY\n", dev->name); if (!extra) return -EINVAL; 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, ETHER_ADDR_LEN); + memcpy(&iw->spy_addr[i], addr[i].sa_data, ETH_ALEN); memset(iw->spy_qual, 0, sizeof(iw->spy_qual)); return 0; @@ -706,14 +705,14 @@ wl_iw_get_spy(struct net_device *dev, struct iw_quality *qual = (struct iw_quality *)&addr[iw->spy_num]; int i; - WL_TRACE(("%s: SIOCGIWSPY\n", dev->name)); + WL_TRACE("%s: SIOCGIWSPY\n", dev->name); if (!extra) return -EINVAL; dwrq->length = iw->spy_num; for (i = 0; i < iw->spy_num; i++) { - memcpy(addr[i].sa_data, &iw->spy_addr[i], ETHER_ADDR_LEN); + 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; @@ -751,8 +750,8 @@ wl_iw_ch_to_chanspec(int ch, wl_join_params_t *join_params, join_params->params.chanspec_num = htod32(join_params->params.chanspec_num); - WL_TRACE(("%s join_params->params.chanspec_list[0]= %X\n", - __func__, join_params->params.chanspec_list[0])); + WL_TRACE("%s join_params->params.chanspec_list[0]= %X\n", + __func__, join_params->params.chanspec_list[0]); } return 1; } @@ -765,16 +764,17 @@ wl_iw_set_wap(struct net_device *dev, wl_join_params_t join_params; int join_params_size; - WL_TRACE(("%s: SIOCSIWAP\n", dev->name)); + WL_TRACE("%s: SIOCSIWAP\n", dev->name); if (awrq->sa_family != ARPHRD_ETHER) { - WL_ERROR(("Invalid Header...sa_family\n")); + WL_ERROR("Invalid Header...sa_family\n"); return -EINVAL; } - if (ETHER_ISBCAST(awrq->sa_data) || ETHER_ISNULLADDR(awrq->sa_data)) { + if (is_broadcast_ether_addr(awrq->sa_data) || + is_zero_ether_addr(awrq->sa_data)) { scb_val_t scbval; - bzero(&scbval, sizeof(scb_val_t)); + memset(&scbval, 0, sizeof(scb_val_t)); (void)dev_wlc_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t)); return 0; @@ -785,23 +785,23 @@ wl_iw_set_wap(struct net_device *dev, 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, awrq->sa_data, ETHER_ADDR_LEN); + memcpy(&join_params.params.bssid, awrq->sa_data, ETH_ALEN); - WL_TRACE(("%s target_channel=%d\n", __func__, - g_wl_iw_params.target_channel)); + WL_TRACE("%s target_channel=%d\n", + __func__, g_wl_iw_params.target_channel); wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params, &join_params_size); error = dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size); if (error) { - WL_ERROR(("%s Invalid ioctl data=%d\n", __func__, error)); + WL_ERROR("%s Invalid ioctl data=%d\n", __func__, error); } if (g_ssid.SSID_len) { - WL_TRACE(("%s: join SSID=%s BSSID=%pM ch=%d\n", - __func__, g_ssid.SSID, awrq->sa_data, - g_wl_iw_params.target_channel)); + WL_TRACE("%s: join SSID=%s BSSID=%pM ch=%d\n", + __func__, g_ssid.SSID, awrq->sa_data, + g_wl_iw_params.target_channel); } memset(&g_ssid, 0, sizeof(g_ssid)); @@ -812,12 +812,12 @@ static int wl_iw_get_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { - WL_TRACE(("%s: SIOCGIWAP\n", dev->name)); + WL_TRACE("%s: SIOCGIWAP\n", dev->name); awrq->sa_family = ARPHRD_ETHER; - memset(awrq->sa_data, 0, ETHER_ADDR_LEN); + memset(awrq->sa_data, 0, ETH_ALEN); - (void)dev_wlc_ioctl(dev, WLC_GET_BSSID, awrq->sa_data, ETHER_ADDR_LEN); + (void)dev_wlc_ioctl(dev, WLC_GET_BSSID, awrq->sa_data, ETH_ALEN); return 0; } @@ -831,16 +831,16 @@ wl_iw_mlme(struct net_device *dev, scb_val_t scbval; int error = -EINVAL; - WL_TRACE(("%s: SIOCSIWMLME DISASSOC/DEAUTH\n", dev->name)); + WL_TRACE("%s: SIOCSIWMLME DISASSOC/DEAUTH\n", dev->name); mlme = (struct iw_mlme *)extra; if (mlme == NULL) { - WL_ERROR(("Invalid ioctl data.\n")); + WL_ERROR("Invalid ioctl data\n"); return error; } scbval.val = mlme->reason_code; - bcopy(&mlme->addr.sa_data, &scbval.ea, ETHER_ADDR_LEN); + bcopy(&mlme->addr.sa_data, &scbval.ea, ETH_ALEN); if (mlme->cmd == IW_MLME_DISASSOC) { scbval.val = htod32(scbval.val); @@ -853,7 +853,7 @@ wl_iw_mlme(struct net_device *dev, dev_wlc_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval, sizeof(scb_val_t)); } else { - WL_ERROR(("Invalid ioctl data.\n")); + WL_ERROR("Invalid ioctl data\n"); return error; } @@ -874,7 +874,7 @@ wl_iw_get_aplist(struct net_device *dev, int error, i; uint buflen = dwrq->length; - WL_TRACE(("%s: SIOCGIWAPLIST\n", dev->name)); + WL_TRACE("%s: SIOCGIWAPLIST\n", dev->name); if (!extra) return -EINVAL; @@ -886,7 +886,7 @@ wl_iw_get_aplist(struct net_device *dev, list->buflen = htod32(buflen); error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, buflen); if (error) { - WL_ERROR(("%d: Scan results error %d\n", __LINE__, error)); + WL_ERROR("%d: Scan results error %d\n", __LINE__, error); kfree(list); return error; } @@ -894,8 +894,8 @@ wl_iw_get_aplist(struct net_device *dev, list->version = dtoh32(list->version); list->count = dtoh32(list->count); if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", - __func__, list->version)); + WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n", + __func__, list->version); kfree(list); return -EINVAL; } @@ -911,7 +911,7 @@ wl_iw_get_aplist(struct net_device *dev, if (!(dtoh16(bi->capability) & DOT11_CAP_ESS)) continue; - memcpy(addr[dwrq->length].sa_data, &bi->BSSID, ETHER_ADDR_LEN); + 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); @@ -952,13 +952,13 @@ wl_iw_iscan_get_aplist(struct net_device *dev, wl_bss_info_t *bi = NULL; int i; - WL_TRACE(("%s: SIOCGIWAPLIST\n", dev->name)); + WL_TRACE("%s: SIOCGIWAPLIST\n", dev->name); if (!extra) return -EINVAL; if ((!iscan) || (!iscan->sysioc_tsk)) { - WL_ERROR(("%s error\n", __func__)); + WL_ERROR("%s error\n", __func__); return 0; } @@ -966,9 +966,8 @@ wl_iw_iscan_get_aplist(struct net_device *dev, while (buf) { list = &((wl_iscan_results_t *) buf->iscan_buf)->results; if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != " - "WL_BSS_INFO_VERSION\n", - __func__, list->version)); + WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n", + __func__, list->version); return -EINVAL; } @@ -985,7 +984,7 @@ wl_iw_iscan_get_aplist(struct net_device *dev, continue; memcpy(addr[dwrq->length].sa_data, &bi->BSSID, - ETHER_ADDR_LEN); + ETH_ALEN); addr[dwrq->length].sa_family = ARPHRD_ETHER; qual[dwrq->length].qual = rssi_to_qual(dtoh16(bi->RSSI)); @@ -1016,7 +1015,7 @@ static int wl_iw_iscan_prep(wl_scan_params_t *params, wlc_ssid_t *ssid) { int err = 0; - memcpy(¶ms->bssid, ðer_bcast, ETHER_ADDR_LEN); + memcpy(¶ms->bssid, ðer_bcast, ETH_ALEN); params->bss_type = DOT11_BSSTYPE_ANY; params->scan_type = 0; params->nprobes = -1; @@ -1043,15 +1042,15 @@ static int wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, u16 action) iscan->iscan_ex_params_p->action = htod16(action); iscan->iscan_ex_params_p->scan_duration = htod16(0); - WL_SCAN(("%s : nprobes=%d\n", __func__, - iscan->iscan_ex_params_p->params.nprobes)); - WL_SCAN(("active_time=%d\n", - iscan->iscan_ex_params_p->params.active_time)); - WL_SCAN(("passive_time=%d\n", - iscan->iscan_ex_params_p->params.passive_time)); - WL_SCAN(("home_time=%d\n", iscan->iscan_ex_params_p->params.home_time)); - WL_SCAN(("scan_type=%d\n", iscan->iscan_ex_params_p->params.scan_type)); - WL_SCAN(("bss_type=%d\n", iscan->iscan_ex_params_p->params.bss_type)); + WL_SCAN("%s : nprobes=%d\n", + __func__, iscan->iscan_ex_params_p->params.nprobes); + WL_SCAN("active_time=%d\n", + iscan->iscan_ex_params_p->params.active_time); + WL_SCAN("passive_time=%d\n", + iscan->iscan_ex_params_p->params.passive_time); + WL_SCAN("home_time=%d\n", iscan->iscan_ex_params_p->params.home_time); + WL_SCAN("scan_type=%d\n", iscan->iscan_ex_params_p->params.scan_type); + WL_SCAN("bss_type=%d\n", iscan->iscan_ex_params_p->params.bss_type); (void)dev_iw_iovar_setbuf(iscan->dev, "iscan", iscan->iscan_ex_params_p, iscan->iscan_ex_param_size, iscan->ioctlbuf, @@ -1066,7 +1065,7 @@ static void wl_iw_timerfunc(unsigned long data) if (iscan) { iscan->timer_on = 0; if (iscan->iscan_state != ISCAN_STATE_IDLE) { - WL_TRACE(("timer trigger\n")); + WL_TRACE("timer trigger\n"); up(&iscan->sysioc_sem); } } @@ -1101,8 +1100,8 @@ static u32 wl_iw_iscan_get(iscan_info_t *iscan) } else { buf = kmalloc(sizeof(iscan_buf_t), GFP_KERNEL); if (!buf) { - WL_ERROR(("%s can't alloc iscan_buf_t : going to abort " - "currect iscan\n", __func__)); + WL_ERROR("%s can't alloc iscan_buf_t : going to abort current iscan\n", + __func__); MUTEX_UNLOCK_WL_SCAN_SET(); return WL_SCAN_RESULTS_NO_MEM; } @@ -1135,11 +1134,11 @@ static u32 wl_iw_iscan_get(iscan_info_t *iscan) results->buflen = dtoh32(results->buflen); results->version = dtoh32(results->version); results->count = dtoh32(results->count); - WL_TRACE(("results->count = %d\n", results->count)); - WL_TRACE(("results->buflen = %d\n", results->buflen)); + WL_TRACE("results->count = %d\n", results->count); + WL_TRACE("results->buflen = %d\n", results->buflen); status = dtoh32(list_buf->status); } else { - WL_ERROR(("%s returns error %d\n", __func__, res)); + WL_ERROR("%s returns error %d\n", __func__, res); status = WL_SCAN_RESULTS_NO_MEM; } MUTEX_UNLOCK_WL_SCAN_SET(); @@ -1148,8 +1147,8 @@ static u32 wl_iw_iscan_get(iscan_info_t *iscan) static void wl_iw_force_specific_scan(iscan_info_t *iscan) { - WL_TRACE(("%s force Specific SCAN for %s\n", __func__, - g_specific_ssid.SSID)); + WL_TRACE("%s force Specific SCAN for %s\n", + __func__, g_specific_ssid.SSID); rtnl_lock(); (void)dev_wlc_ioctl(iscan->dev, WLC_SCAN, &g_specific_ssid, @@ -1166,7 +1165,7 @@ static void wl_iw_send_scan_complete(iscan_info_t *iscan) memset(&wrqu, 0, sizeof(wrqu)); wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, NULL); - WL_TRACE(("Send Event ISCAN complete\n")); + WL_TRACE("Send Event ISCAN complete\n"); #endif } @@ -1190,8 +1189,8 @@ static int _iscan_sysioc_thread(void *data) status = wl_iw_iscan_get(iscan); rtnl_unlock(); if (g_scan_specified_ssid && (iscan_pass_abort == true)) { - WL_TRACE(("%s Get results from specific scan " - "status = %d\n", __func__, status)); + WL_TRACE("%s Get results from specific scan status = %d\n", + __func__, status); wl_iw_send_scan_complete(iscan); iscan_pass_abort = false; status = -1; @@ -1199,7 +1198,7 @@ static int _iscan_sysioc_thread(void *data) switch (status) { case WL_SCAN_RESULTS_PARTIAL: - WL_TRACE(("iscanresults incomplete\n")); + WL_TRACE("iscanresults incomplete\n"); rtnl_lock(); wl_iw_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE); rtnl_unlock(); @@ -1208,18 +1207,18 @@ static int _iscan_sysioc_thread(void *data) iscan->timer_on = 1; break; case WL_SCAN_RESULTS_SUCCESS: - WL_TRACE(("iscanresults complete\n")); + WL_TRACE("iscanresults complete\n"); iscan->iscan_state = ISCAN_STATE_IDLE; wl_iw_send_scan_complete(iscan); break; case WL_SCAN_RESULTS_PENDING: - WL_TRACE(("iscanresults pending\n")); + WL_TRACE("iscanresults pending\n"); mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000); iscan->timer_on = 1; break; case WL_SCAN_RESULTS_ABORTED: - WL_TRACE(("iscanresults aborted\n")); + WL_TRACE("iscanresults aborted\n"); iscan->iscan_state = ISCAN_STATE_IDLE; if (g_scan_specified_ssid == 0) wl_iw_send_scan_complete(iscan); @@ -1229,12 +1228,12 @@ static int _iscan_sysioc_thread(void *data) } break; case WL_SCAN_RESULTS_NO_MEM: - WL_TRACE(("iscanresults can't alloc memory: skip\n")); + WL_TRACE("iscanresults can't alloc memory: skip\n"); iscan->iscan_state = ISCAN_STATE_IDLE; break; default: - WL_TRACE(("iscanresults returned unknown status %d\n", - status)); + WL_TRACE("iscanresults returned unknown status %d\n", + status); break; } } @@ -1253,11 +1252,11 @@ wl_iw_set_scan(struct net_device *dev, union iwreq_data *wrqu, char *extra) { int error; - WL_TRACE(("\n:%s dev:%s: SIOCSIWSCAN : SCAN\n", __func__, dev->name)); + WL_TRACE("\n:%s dev:%s: SIOCSIWSCAN : SCAN\n", __func__, dev->name); g_set_essid_before_scan = false; #if defined(CSCAN) - WL_ERROR(("%s: Scan from SIOCGIWSCAN not supported\n", __func__)); + WL_ERROR("%s: Scan from SIOCGIWSCAN not supported\n", __func__); return -EINVAL; #endif @@ -1274,9 +1273,8 @@ wl_iw_set_scan(struct net_device *dev, if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { struct iw_scan_req *req = (struct iw_scan_req *)extra; if (g_scan_specified_ssid) { - WL_TRACE(("%s Specific SCAN is not done ignore " - "scan for = %s\n", - __func__, req->essid)); + WL_TRACE("%s Specific SCAN is not done ignore scan for = %s\n", + __func__, req->essid); return -EBUSY; } else { g_specific_ssid.SSID_len = min_t(size_t, @@ -1287,9 +1285,9 @@ wl_iw_set_scan(struct net_device *dev, g_specific_ssid.SSID_len = htod32(g_specific_ssid.SSID_len); g_scan_specified_ssid = 1; - WL_TRACE(("### Specific scan ssid=%s len=%d\n", - g_specific_ssid.SSID, - g_specific_ssid.SSID_len)); + WL_TRACE("### Specific scan ssid=%s len=%d\n", + g_specific_ssid.SSID, + g_specific_ssid.SSID_len); } } } @@ -1297,8 +1295,8 @@ wl_iw_set_scan(struct net_device *dev, error = dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid)); if (error) { - WL_TRACE(("#### Set SCAN for %s failed with %d\n", - g_specific_ssid.SSID, error)); + WL_TRACE("#### Set SCAN for %s failed with %d\n", + g_specific_ssid.SSID, error); g_scan_specified_ssid = 0; return -EBUSY; } @@ -1317,7 +1315,7 @@ int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag) wl_iw_set_event_mask(dev); - WL_TRACE(("+++: Set Broadcast ISCAN\n")); + WL_TRACE("+++: Set Broadcast ISCAN\n"); memset(&ssid, 0, sizeof(ssid)); iscan->list_cur = iscan->list_hdr; @@ -1346,20 +1344,20 @@ wl_iw_iscan_set_scan(struct net_device *dev, wlc_ssid_t ssid; iscan_info_t *iscan = g_iscan; - WL_TRACE(("%s: SIOCSIWSCAN : ISCAN\n", dev->name)); + WL_TRACE("%s: SIOCSIWSCAN : ISCAN\n", dev->name); #if defined(CSCAN) - WL_ERROR(("%s: Scan from SIOCGIWSCAN not supported\n", __func__)); + WL_ERROR("%s: Scan from SIOCGIWSCAN not supported\n", __func__); return -EINVAL; #endif if (g_onoff == G_WLAN_SET_OFF) { - WL_TRACE(("%s: driver is not up yet after START\n", __func__)); + WL_TRACE("%s: driver is not up yet after START\n", __func__); return 0; } #ifdef PNO_SUPPORT if (dhd_dev_get_pno_status(dev)) { - WL_ERROR(("%s: Scan called when PNO is active\n", __func__)); + WL_ERROR("%s: Scan called when PNO is active\n", __func__); } #endif @@ -1367,8 +1365,8 @@ wl_iw_iscan_set_scan(struct net_device *dev, return wl_iw_set_scan(dev, info, wrqu, extra); if (g_scan_specified_ssid) { - WL_TRACE(("%s Specific SCAN already running ignoring BC scan\n", - __func__)); + WL_TRACE("%s Specific SCAN already running ignoring BC scan\n", + __func__); return EBUSY; } @@ -1386,8 +1384,8 @@ wl_iw_iscan_set_scan(struct net_device *dev, g_scan_specified_ssid = 0; if (iscan->iscan_state == ISCAN_STATE_SCANING) { - WL_TRACE(("%s ISCAN already in progress \n", - __func__)); + WL_TRACE("%s ISCAN already in progress\n", + __func__); return 0; } } @@ -1406,7 +1404,7 @@ static bool ie_is_wpa_ie(u8 **wpaie, u8 **tlvs, int *tlvs_len) u8 *ie = *wpaie; if ((ie[1] >= 6) && - !bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x01"), 4)) { + !memcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x01"), 4)) { return true; } @@ -1422,7 +1420,7 @@ static bool ie_is_wps_ie(u8 **wpsie, u8 **tlvs, int *tlvs_len) u8 *ie = *wpsie; if ((ie[1] >= 4) && - !bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x04"), 4)) { + !memcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x04"), 4)) { return true; } @@ -1501,9 +1499,8 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, for (i = 0; i < list->count && i < IW_MAX_AP; i++) { if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != " - "WL_BSS_INFO_VERSION\n", - __func__, list->version)); + WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n", + __func__, list->version); return ret; } @@ -1511,11 +1508,11 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, dtoh32(bi->length)) : list-> bss_info; - WL_TRACE(("%s : %s\n", __func__, bi->SSID)); + WL_TRACE("%s : %s\n", __func__, bi->SSID); iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETHER_ADDR_LEN); + memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETH_ALEN); event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_ADDR_LEN); @@ -1590,11 +1587,11 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, ret = event - extra; if (ret < 0) { - WL_ERROR(("==> Wrong size\n")); + WL_ERROR("==> Wrong size\n"); ret = 0; } - WL_TRACE(("%s: size=%d bytes prepared\n", __func__, - (unsigned int)(event - extra))); + WL_TRACE("%s: size=%d bytes prepared\n", + __func__, (unsigned int)(event - extra)); return (uint)ret; } @@ -1614,10 +1611,10 @@ wl_iw_get_scan(struct net_device *dev, iscan_buf_t *p_buf; #endif - WL_TRACE(("%s: buflen_from_user %d: \n", dev->name, buflen_from_user)); + WL_TRACE("%s: buflen_from_user %d:\n", dev->name, buflen_from_user); if (!extra) { - WL_TRACE(("%s: wl_iw_get_scan return -EINVAL\n", dev->name)); + WL_TRACE("%s: wl_iw_get_scan return -EINVAL\n", dev->name); return -EINVAL; } @@ -1631,8 +1628,8 @@ wl_iw_get_scan(struct net_device *dev, if (g_scan_specified_ssid) { list = kmalloc(len, GFP_KERNEL); if (!list) { - WL_TRACE(("%s: wl_iw_get_scan return -ENOMEM\n", - dev->name)); + WL_TRACE("%s: wl_iw_get_scan return -ENOMEM\n", + dev->name); g_scan_specified_ssid = 0; return -ENOMEM; } @@ -1642,8 +1639,8 @@ wl_iw_get_scan(struct net_device *dev, list->buflen = htod32(len); error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, len); if (error) { - WL_ERROR(("%s: %s : Scan_results ERROR %d\n", dev->name, - __func__, error)); + WL_ERROR("%s: %s : Scan_results ERROR %d\n", + dev->name, __func__, error); dwrq->length = len; if (g_scan_specified_ssid) { g_scan_specified_ssid = 0; @@ -1656,8 +1653,8 @@ wl_iw_get_scan(struct net_device *dev, list->count = dtoh32(list->count); if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", - __func__, list->version)); + WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n", + __func__, list->version); if (g_scan_specified_ssid) { g_scan_specified_ssid = 0; kfree(list); @@ -1666,8 +1663,8 @@ wl_iw_get_scan(struct net_device *dev, } if (g_scan_specified_ssid) { - WL_TRACE(("%s: Specified scan APs in the list =%d\n", - __func__, list->count)); + WL_TRACE("%s: Specified scan APs in the list =%d\n", + __func__, list->count); len_ret = (__u16) wl_iw_get_scan_prep(list, info, extra, buflen_from_user); @@ -1678,8 +1675,8 @@ wl_iw_get_scan(struct net_device *dev, while (p_buf != iscan->list_cur) { list_merge = &((wl_iscan_results_t *) p_buf->iscan_buf)->results; - WL_TRACE(("%s: Bcast APs list=%d\n", __func__, - list_merge->count)); + WL_TRACE("%s: Bcast APs list=%d\n", + __func__, list_merge->count); if (list_merge->count > 0) len_ret += (__u16) wl_iw_get_scan_prep(list_merge, @@ -1689,8 +1686,8 @@ wl_iw_get_scan(struct net_device *dev, } #else list_merge = (wl_scan_results_t *) g_scan; - WL_TRACE(("%s: Bcast APs list=%d\n", __func__, - list_merge->count)); + WL_TRACE("%s: Bcast APs list=%d\n", + __func__, list_merge->count); if (list_merge->count > 0) len_ret += (__u16) wl_iw_get_scan_prep(list_merge, info, @@ -1714,8 +1711,8 @@ wl_iw_get_scan(struct net_device *dev, dwrq->length = len; dwrq->flags = 0; - WL_TRACE(("%s return to WE %d bytes APs=%d\n", __func__, - dwrq->length, list->count)); + WL_TRACE("%s return to WE %d bytes APs=%d\n", + __func__, dwrq->length, list->count); return 0; } @@ -1736,26 +1733,26 @@ wl_iw_iscan_get_scan(struct net_device *dev, u32 counter = 0; u8 channel; - WL_TRACE(("%s %s buflen_from_user %d:\n", dev->name, __func__, - dwrq->length)); + WL_TRACE("%s %s buflen_from_user %d:\n", + dev->name, __func__, dwrq->length); if (!extra) { - WL_TRACE(("%s: INVALID SIOCGIWSCAN GET bad parameter\n", - dev->name)); + WL_TRACE("%s: INVALID SIOCGIWSCAN GET bad parameter\n", + dev->name); return -EINVAL; } if ((!iscan) || (!iscan->sysioc_tsk)) { - WL_ERROR(("%ssysioc_tsk\n", __func__)); + WL_ERROR("%ssysioc_tsk\n", __func__); return wl_iw_get_scan(dev, info, dwrq, extra); } if (iscan->iscan_state == ISCAN_STATE_SCANING) { - WL_TRACE(("%s: SIOCGIWSCAN GET still scanning\n", dev->name)); + WL_TRACE("%s: SIOCGIWSCAN GET still scanning\n", dev->name); return -EAGAIN; } - WL_TRACE(("%s: SIOCGIWSCAN GET broadcast results\n", dev->name)); + WL_TRACE("%s: SIOCGIWSCAN GET broadcast results\n", dev->name); apcnt = 0; p_buf = iscan->list_hdr; while (p_buf != iscan->list_cur) { @@ -1764,9 +1761,8 @@ wl_iw_iscan_get_scan(struct net_device *dev, counter += list->count; if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != " - "WL_BSS_INFO_VERSION\n", - __func__, list->version)); + WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n", + __func__, list->version); return -EINVAL; } @@ -1779,14 +1775,14 @@ wl_iw_iscan_get_scan(struct net_device *dev, ASSERT(((unsigned long)bi + dtoh32(bi->length)) <= ((unsigned long)list + WLC_IW_ISCAN_MAXLEN)); - if (event + ETHER_ADDR_LEN + bi->SSID_len + + if (event + ETH_ALEN + bi->SSID_len + IW_EV_UINT_LEN + IW_EV_FREQ_LEN + IW_EV_QUAL_LEN >= end) return -E2BIG; iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, - ETHER_ADDR_LEN); + ETH_ALEN); event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_ADDR_LEN); @@ -1876,8 +1872,8 @@ wl_iw_iscan_get_scan(struct net_device *dev, dwrq->length = event - extra; dwrq->flags = 0; - WL_TRACE(("%s return to WE %d bytes APs=%d\n", __func__, - dwrq->length, counter)); + WL_TRACE("%s return to WE %d bytes APs=%d\n", + __func__, dwrq->length, counter); if (!dwrq->length) return -EAGAIN; @@ -1895,7 +1891,7 @@ wl_iw_set_essid(struct net_device *dev, wl_join_params_t join_params; int join_params_size; - WL_TRACE(("%s: SIOCSIWESSID\n", dev->name)); + WL_TRACE("%s: SIOCSIWESSID\n", dev->name); if (g_set_essid_before_scan) return -EAGAIN; @@ -1923,7 +1919,7 @@ wl_iw_set_essid(struct net_device *dev, 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, ðer_bcast, ETHER_ADDR_LEN); + memcpy(&join_params.params.bssid, ðer_bcast, ETH_ALEN); wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params, &join_params_size); @@ -1931,11 +1927,11 @@ wl_iw_set_essid(struct net_device *dev, error = dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size); if (error) - WL_ERROR(("Invalid ioctl data=%d\n", error)); + WL_ERROR("Invalid ioctl data=%d\n", error); if (g_ssid.SSID_len) { - WL_TRACE(("%s: join SSID=%s ch=%d\n", __func__, - g_ssid.SSID, g_wl_iw_params.target_channel)); + WL_TRACE("%s: join SSID=%s ch=%d\n", + __func__, g_ssid.SSID, g_wl_iw_params.target_channel); } return 0; } @@ -1948,14 +1944,14 @@ wl_iw_get_essid(struct net_device *dev, wlc_ssid_t ssid; int error; - WL_TRACE(("%s: SIOCGIWESSID\n", dev->name)); + WL_TRACE("%s: SIOCGIWESSID\n", dev->name); if (!extra) return -EINVAL; error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid)); if (error) { - WL_ERROR(("Error getting the SSID\n")); + WL_ERROR("Error getting the SSID\n"); return error; } @@ -1976,7 +1972,7 @@ wl_iw_set_nick(struct net_device *dev, { wl_iw_t *iw = *(wl_iw_t **) netdev_priv(dev); - WL_TRACE(("%s: SIOCSIWNICKN\n", dev->name)); + WL_TRACE("%s: SIOCSIWNICKN\n", dev->name); if (!extra) return -EINVAL; @@ -1996,7 +1992,7 @@ wl_iw_get_nick(struct net_device *dev, { wl_iw_t *iw = *(wl_iw_t **) netdev_priv(dev); - WL_TRACE(("%s: SIOCGIWNICKN\n", dev->name)); + WL_TRACE("%s: SIOCGIWNICKN\n", dev->name); if (!extra) return -EINVAL; @@ -2014,7 +2010,7 @@ wl_iw_set_rate(struct net_device *dev, wl_rateset_t rateset; int error, rate, i, error_bg, error_a; - WL_TRACE(("%s: SIOCSIWRATE\n", dev->name)); + WL_TRACE("%s: SIOCSIWRATE\n", dev->name); error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset)); @@ -2063,7 +2059,7 @@ wl_iw_get_rate(struct net_device *dev, { int error, rate; - WL_TRACE(("%s: SIOCGIWRATE\n", dev->name)); + WL_TRACE("%s: SIOCGIWRATE\n", dev->name); error = dev_wlc_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)); if (error) @@ -2080,7 +2076,7 @@ wl_iw_set_rts(struct net_device *dev, { int error, rts; - WL_TRACE(("%s: SIOCSIWRTS\n", dev->name)); + WL_TRACE("%s: SIOCSIWRTS\n", dev->name); if (vwrq->disabled) rts = DOT11_DEFAULT_RTS_LEN; @@ -2102,7 +2098,7 @@ wl_iw_get_rts(struct net_device *dev, { int error, rts; - WL_TRACE(("%s: SIOCGIWRTS\n", dev->name)); + WL_TRACE("%s: SIOCGIWRTS\n", dev->name); error = dev_wlc_intvar_get(dev, "rtsthresh", &rts); if (error) @@ -2121,7 +2117,7 @@ wl_iw_set_frag(struct net_device *dev, { int error, frag; - WL_TRACE(("%s: SIOCSIWFRAG\n", dev->name)); + WL_TRACE("%s: SIOCSIWFRAG\n", dev->name); if (vwrq->disabled) frag = DOT11_DEFAULT_FRAG_LEN; @@ -2143,7 +2139,7 @@ wl_iw_get_frag(struct net_device *dev, { int error, fragthreshold; - WL_TRACE(("%s: SIOCGIWFRAG\n", dev->name)); + WL_TRACE("%s: SIOCGIWFRAG\n", dev->name); error = dev_wlc_intvar_get(dev, "fragthresh", &fragthreshold); if (error) @@ -2163,7 +2159,7 @@ wl_iw_set_txpow(struct net_device *dev, { int error, disable; u16 txpwrmw; - WL_TRACE(("%s: SIOCSIWTXPOW\n", dev->name)); + WL_TRACE("%s: SIOCSIWTXPOW\n", dev->name); disable = vwrq->disabled ? WL_RADIO_SW_DISABLE : 0; disable += WL_RADIO_SW_DISABLE << 16; @@ -2200,7 +2196,7 @@ wl_iw_get_txpow(struct net_device *dev, int error, disable, txpwrdbm; u8 result; - WL_TRACE(("%s: SIOCGIWTXPOW\n", dev->name)); + WL_TRACE("%s: SIOCGIWTXPOW\n", dev->name); error = dev_wlc_ioctl(dev, WLC_GET_RADIO, &disable, sizeof(disable)); if (error) @@ -2229,7 +2225,7 @@ wl_iw_set_retry(struct net_device *dev, { int error, lrl, srl; - WL_TRACE(("%s: SIOCSIWRETRY\n", dev->name)); + WL_TRACE("%s: SIOCSIWRETRY\n", dev->name); if (vwrq->disabled || (vwrq->flags & IW_RETRY_LIFETIME)) return -EINVAL; @@ -2277,7 +2273,7 @@ wl_iw_get_retry(struct net_device *dev, { int error, lrl, srl; - WL_TRACE(("%s: SIOCGIWRETRY\n", dev->name)); + WL_TRACE("%s: SIOCGIWRETRY\n", dev->name); vwrq->disabled = 0; @@ -2317,7 +2313,7 @@ wl_iw_set_encode(struct net_device *dev, wl_wsec_key_t key; int error, val, wsec; - WL_TRACE(("%s: SIOCSIWENCODE\n", dev->name)); + WL_TRACE("%s: SIOCSIWENCODE\n", dev->name); memset(&key, 0, sizeof(key)); @@ -2409,9 +2405,9 @@ wl_iw_get_encode(struct net_device *dev, wl_wsec_key_t key; int error, val, wsec, auth; - WL_TRACE(("%s: SIOCGIWENCODE\n", dev->name)); + WL_TRACE("%s: SIOCGIWENCODE\n", dev->name); - bzero(&key, sizeof(wl_wsec_key_t)); + memset(&key, 0, sizeof(wl_wsec_key_t)); if ((dwrq->flags & IW_ENCODE_INDEX) == 0) { for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS; @@ -2465,7 +2461,7 @@ wl_iw_set_power(struct net_device *dev, { int error, pm; - WL_TRACE(("%s: SIOCSIWPOWER\n", dev->name)); + WL_TRACE("%s: SIOCSIWPOWER\n", dev->name); pm = vwrq->disabled ? PM_OFF : PM_MAX; @@ -2484,7 +2480,7 @@ wl_iw_get_power(struct net_device *dev, { int error, pm; - WL_TRACE(("%s: SIOCGIWPOWER\n", dev->name)); + WL_TRACE("%s: SIOCGIWPOWER\n", dev->name); error = dev_wlc_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm)); if (error) @@ -2503,7 +2499,7 @@ wl_iw_set_wpaie(struct net_device *dev, struct iw_request_info *info, struct iw_point *iwp, char *extra) { - WL_TRACE(("%s: SIOCSIWGENIE\n", dev->name)); + WL_TRACE("%s: SIOCSIWGENIE\n", dev->name); CHECK_EXTRA_FOR_NULL(extra); @@ -2516,7 +2512,7 @@ static int wl_iw_get_wpaie(struct net_device *dev, struct iw_request_info *info, struct iw_point *iwp, char *extra) { - WL_TRACE(("%s: SIOCGIWGENIE\n", dev->name)); + WL_TRACE("%s: SIOCGIWGENIE\n", dev->name); iwp->length = 64; dev_wlc_bufvar_get(dev, "wpaie", extra, iwp->length); return 0; @@ -2531,7 +2527,7 @@ wl_iw_set_encodeext(struct net_device *dev, int error; struct iw_encode_ext *iwe; - WL_TRACE(("%s: SIOCSIWENCODEEXT\n", dev->name)); + WL_TRACE("%s: SIOCSIWENCODEEXT\n", dev->name); CHECK_EXTRA_FOR_NULL(extra); @@ -2548,14 +2544,14 @@ wl_iw_set_encodeext(struct net_device *dev, key.len = iwe->key_len; - if (!ETHER_ISMULTI(iwe->addr.sa_data)) + if (!is_multicast_ether_addr(iwe->addr.sa_data)) bcopy((void *)&iwe->addr.sa_data, (char *)&key.ea, - ETHER_ADDR_LEN); + 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)); + WL_WSEC("Changing the the primary Key to %d\n", + key.index); key.index = htod32(key.index); error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &key.index, sizeof(key.index)); @@ -2569,9 +2565,9 @@ wl_iw_set_encodeext(struct net_device *dev, if (iwe->key_len > sizeof(key.data)) return -EINVAL; - WL_WSEC(("Setting the key index %d\n", key.index)); + WL_WSEC("Setting the key index %d\n", key.index); if (iwe->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - WL_WSEC(("key is a Primary Key\n")); + WL_WSEC("key is a Primary Key\n"); key.flags = WL_PRIMARY_KEY; } @@ -2638,15 +2634,15 @@ wl_iw_set_pmksa(struct net_device *dev, uint i; int ret = 0; - WL_WSEC(("%s: SIOCSIWPMKSA\n", dev->name)); + WL_WSEC("%s: SIOCSIWPMKSA\n", dev->name); CHECK_EXTRA_FOR_NULL(extra); iwpmksa = (struct iw_pmksa *)extra; if (iwpmksa->cmd == IW_PMKSA_FLUSH) { - WL_WSEC(("wl_iw_set_pmksa - IW_PMKSA_FLUSH\n")); - bzero((char *)&pmkid_list, sizeof(pmkid_list)); + WL_WSEC("wl_iw_set_pmksa - IW_PMKSA_FLUSH\n"); + memset((char *)&pmkid_list, 0, sizeof(pmkid_list)); } else if (iwpmksa->cmd == IW_PMKSA_REMOVE) { @@ -2656,30 +2652,30 @@ wl_iw_set_pmksa(struct net_device *dev, pmkidptr = &pmkid; bcopy(&iwpmksa->bssid.sa_data[0], - &pmkidptr->pmkid[0].BSSID, ETHER_ADDR_LEN); + &pmkidptr->pmkid[0].BSSID, ETH_ALEN); bcopy(&iwpmksa->pmkid[0], &pmkidptr->pmkid[0].PMKID, WPA2_PMKID_LEN); - WL_WSEC(("wl_iw_set_pmksa:IW_PMKSA_REMOVE:PMKID: " - "%pM = ", &pmkidptr->pmkid[0].BSSID)); + 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(("%02x ", pmkidptr->pmkid[0].PMKID[j])); - WL_WSEC(("\n")); + WL_WSEC("%02x ", pmkidptr->pmkid[0].PMKID[j]); + WL_WSEC("\n"); } for (i = 0; i < pmkid_list.pmkids.npmkid; i++) - if (!bcmp + if (!memcmp (&iwpmksa->bssid.sa_data[0], - &pmkid_list.pmkids.pmkid[i].BSSID, ETHER_ADDR_LEN)) + &pmkid_list.pmkids.pmkid[i].BSSID, ETH_ALEN)) break; if ((pmkid_list.pmkids.npmkid > 0) && (i < pmkid_list.pmkids.npmkid)) { - bzero(&pmkid_list.pmkids.pmkid[i], sizeof(pmkid_t)); + 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, - ETHER_ADDR_LEN); + ETH_ALEN); bcopy(&pmkid_list.pmkids.pmkid[i + 1].PMKID, &pmkid_list.pmkids.pmkid[i].PMKID, WPA2_PMKID_LEN); @@ -2691,14 +2687,14 @@ wl_iw_set_pmksa(struct net_device *dev, else if (iwpmksa->cmd == IW_PMKSA_ADD) { for (i = 0; i < pmkid_list.pmkids.npmkid; i++) - if (!bcmp + if (!memcmp (&iwpmksa->bssid.sa_data[0], - &pmkid_list.pmkids.pmkid[i].BSSID, ETHER_ADDR_LEN)) + &pmkid_list.pmkids.pmkid[i].BSSID, ETH_ALEN)) break; if (i < MAXPMKID) { bcopy(&iwpmksa->bssid.sa_data[0], &pmkid_list.pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN); + ETH_ALEN); bcopy(&iwpmksa->pmkid[0], &pmkid_list.pmkids.pmkid[i].PMKID, WPA2_PMKID_LEN); @@ -2710,25 +2706,25 @@ wl_iw_set_pmksa(struct net_device *dev, uint j; uint k; k = pmkid_list.pmkids.npmkid; - WL_WSEC(("wl_iw_set_pmksa,IW_PMKSA_ADD - PMKID: %pM = ", - &pmkid_list.pmkids.pmkid[k].BSSID)); + 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++) - WL_WSEC(("%02x ", - pmkid_list.pmkids.pmkid[k].PMKID[j])); - WL_WSEC(("\n")); + WL_WSEC("%02x ", + pmkid_list.pmkids.pmkid[k].PMKID[j]); + WL_WSEC("\n"); } } - WL_WSEC(("PRINTING pmkid LIST - No of elements %d\n", - pmkid_list.pmkids.npmkid)); + WL_WSEC("PRINTING pmkid LIST - No of elements %d\n", + pmkid_list.pmkids.npmkid); for (i = 0; i < pmkid_list.pmkids.npmkid; i++) { uint j; - WL_WSEC(("PMKID[%d]: %pM = ", i, - &pmkid_list.pmkids.pmkid[i].BSSID)); + WL_WSEC("PMKID[%d]: %pM = ", + i, &pmkid_list.pmkids.pmkid[i].BSSID); for (j = 0; j < WPA2_PMKID_LEN; j++) - WL_WSEC(("%02x ", pmkid_list.pmkids.pmkid[i].PMKID[j])); - WL_WSEC(("\n")); + WL_WSEC("%02x ", pmkid_list.pmkids.pmkid[i].PMKID[j]); + WL_WSEC("\n"); } - WL_WSEC(("\n")); + WL_WSEC("\n"); if (!ret) ret = dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, @@ -2742,7 +2738,7 @@ wl_iw_get_encodeext(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - WL_TRACE(("%s: SIOCGIWENCODEEXT\n", dev->name)); + WL_TRACE("%s: SIOCGIWENCODEEXT\n", dev->name); return 0; } @@ -2757,13 +2753,13 @@ wl_iw_set_wpaauth(struct net_device *dev, int val = 0; wl_iw_t *iw = *(wl_iw_t **) netdev_priv(dev); - WL_TRACE(("%s: SIOCSIWAUTH\n", dev->name)); + WL_TRACE("%s: SIOCSIWAUTH\n", dev->name); paramid = vwrq->flags & IW_AUTH_INDEX; paramval = vwrq->value; - WL_TRACE(("%s: SIOCSIWAUTH, paramid = 0x%0x, paramval = 0x%0x\n", - dev->name, paramid, paramval)); + WL_TRACE("%s: SIOCSIWAUTH, paramid = 0x%0x, paramval = 0x%0x\n", + dev->name, paramid, paramval); switch (paramid) { case IW_AUTH_WPA_VERSION: @@ -2773,8 +2769,8 @@ wl_iw_set_wpaauth(struct net_device *dev, val = WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED; else if (paramval & IW_AUTH_WPA_VERSION_WPA2) val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED; - WL_INFORM(("%s: %d: setting wpa_auth to 0x%0x\n", __func__, - __LINE__, val)); + WL_INFORM("%s: %d: setting wpa_auth to 0x%0x\n", + __func__, __LINE__, val); error = dev_wlc_intvar_set(dev, "wpa_auth", val); if (error) return error; @@ -2797,20 +2793,19 @@ wl_iw_set_wpaauth(struct net_device *dev, } if (iw->privacy_invoked && !val) { - WL_WSEC(("%s: %s: 'Privacy invoked' true but clearing " - "wsec, assuming " "we're a WPS enrollee\n", - dev->name, __func__)); + WL_WSEC("%s: %s: 'Privacy invoked' true but clearing wsec, assuming we're a WPS enrollee\n", + dev->name, __func__); error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", true); if (error) { - WL_WSEC(("Failed to set is_WPS_enrollee\n")); + WL_WSEC("Failed to set is_WPS_enrollee\n"); return error; } } else if (val) { error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", false); if (error) { - WL_WSEC(("Failed to clear is_WPS_enrollee\n")); + WL_WSEC("Failed to clear is_WPS_enrollee\n"); return error; } } @@ -2837,8 +2832,8 @@ wl_iw_set_wpaauth(struct net_device *dev, else val = WPA2_AUTH_UNSPECIFIED; } - WL_INFORM(("%s: %d: setting wpa_auth to %d\n", __func__, - __LINE__, val)); + WL_INFORM("%s: %d: setting wpa_auth to %d\n", + __func__, __LINE__, val); error = dev_wlc_intvar_set(dev, "wpa_auth", val); if (error) return error; @@ -2850,7 +2845,7 @@ wl_iw_set_wpaauth(struct net_device *dev, break; case IW_AUTH_80211_AUTH_ALG: - WL_INFORM(("Setting the D11auth %d\n", paramval)); + WL_INFORM("Setting the D11auth %d\n", paramval); if (paramval == IW_AUTH_ALG_OPEN_SYSTEM) val = 0; else if (paramval == IW_AUTH_ALG_SHARED_KEY) @@ -2879,8 +2874,8 @@ wl_iw_set_wpaauth(struct net_device *dev, dev_wlc_intvar_set(dev, "wsec", val); } val = 0; - WL_INFORM(("%s: %d: setting wpa_auth to %d\n", - __func__, __LINE__, val)); + WL_INFORM("%s: %d: setting wpa_auth to %d\n", + __func__, __LINE__, val); dev_wlc_intvar_set(dev, "wpa_auth", 0); return error; } @@ -2897,7 +2892,7 @@ wl_iw_set_wpaauth(struct net_device *dev, #if WIRELESS_EXT > 17 case IW_AUTH_ROAMING_CONTROL: - WL_INFORM(("%s: IW_AUTH_ROAMING_CONTROL\n", __func__)); + WL_INFORM("%s: IW_AUTH_ROAMING_CONTROL\n", __func__); break; case IW_AUTH_PRIVACY_INVOKED: { @@ -2908,8 +2903,7 @@ wl_iw_set_wpaauth(struct net_device *dev, error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", false); if (error) { - WL_WSEC(("Failed to clear iovar " - "is_WPS_enrollee\n")); + WL_WSEC("Failed to clear iovar is_WPS_enrollee\n"); return error; } } else { @@ -2923,8 +2917,7 @@ wl_iw_set_wpaauth(struct net_device *dev, "is_WPS_enrollee", true); if (error) { - WL_WSEC(("Failed to set iovar " - "is_WPS_enrollee\n")); + WL_WSEC("Failed to set iovar is_WPS_enrollee\n"); return error; } } else { @@ -2932,8 +2925,7 @@ wl_iw_set_wpaauth(struct net_device *dev, "is_WPS_enrollee", false); if (error) { - WL_WSEC(("Failed to clear " - "is_WPS_enrollee\n")); + WL_WSEC("Failed to clear is_WPS_enrollee\n"); return error; } } @@ -2960,7 +2952,7 @@ wl_iw_get_wpaauth(struct net_device *dev, int val; wl_iw_t *iw = *(wl_iw_t **) netdev_priv(dev); - WL_TRACE(("%s: SIOCGIWAUTH\n", dev->name)); + WL_TRACE("%s: SIOCGIWAUTH\n", dev->name); paramid = vwrq->flags & IW_AUTH_INDEX; @@ -3040,7 +3032,7 @@ wl_iw_get_wpaauth(struct net_device *dev, break; #if WIRELESS_EXT > 17 case IW_AUTH_ROAMING_CONTROL: - WL_ERROR(("%s: IW_AUTH_ROAMING_CONTROL\n", __func__)); + WL_ERROR("%s: IW_AUTH_ROAMING_CONTROL\n", __func__); break; case IW_AUTH_PRIVACY_INVOKED: paramval = iw->privacy_invoked; @@ -3157,19 +3149,19 @@ int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) char *extra = NULL; int token_size = 1, max_tokens = 0, ret = 0; - WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n", - __func__, cmd)); + WL_TRACE("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n", + __func__, cmd); if (cmd < SIOCIWFIRST || IW_IOCTL_IDX(cmd) >= ARRAY_SIZE(wl_iw_handler)) { - WL_ERROR(("%s: error in cmd=%x : out of range\n", __func__, - cmd)); + WL_ERROR("%s: error in cmd=%x : out of range\n", + __func__, cmd); return -EOPNOTSUPP; } handler = wl_iw_handler[IW_IOCTL_IDX(cmd)]; if (!handler) { - WL_ERROR(("%s: error in cmd=%x : not supported\n", - __func__, cmd)); + WL_ERROR("%s: error in cmd=%x : not supported\n", + __func__, cmd); return -EOPNOTSUPP; } @@ -3234,9 +3226,8 @@ int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) if (max_tokens && wrq->u.data.pointer) { if (wrq->u.data.length > max_tokens) { - WL_ERROR(("%s: error in cmd=%x wrq->u.data.length=%d " - "> max_tokens=%d\n", - __func__, cmd, wrq->u.data.length, max_tokens)); + WL_ERROR("%s: error in cmd=%x wrq->u.data.length=%d > max_tokens=%d\n", + __func__, cmd, wrq->u.data.length, max_tokens); return -E2BIG; } extra = kmalloc(max_tokens * token_size, GFP_KERNEL); @@ -3339,7 +3330,7 @@ wl_iw_conn_status_str(u32 event_type, u32 status, u32 reason, memset(stringBuf, 0, buflen); snprintf(stringBuf, buflen, "%s %s %02d %02d", name, cause, status, reason); - WL_INFORM(("Connection status: %s\n", stringBuf)); + WL_INFORM("Connection status: %s\n", stringBuf); return true; } else { return false; @@ -3383,46 +3374,46 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data) iw = 0; if (!dev) { - WL_ERROR(("%s: dev is null\n", __func__)); + WL_ERROR("%s: dev is null\n", __func__); return; } iw = *(wl_iw_t **) netdev_priv(dev); - WL_TRACE(("%s: dev=%s event=%d\n", __func__, dev->name, event_type)); + WL_TRACE("%s: dev=%s event=%d\n", __func__, dev->name, event_type); switch (event_type) { case WLC_E_TXFAIL: cmd = IWEVTXDROP; - memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN); + memcpy(wrqu.addr.sa_data, &e->addr, ETH_ALEN); wrqu.addr.sa_family = ARPHRD_ETHER; break; #if WIRELESS_EXT > 14 case WLC_E_JOIN: case WLC_E_ASSOC_IND: case WLC_E_REASSOC_IND: - memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN); + memcpy(wrqu.addr.sa_data, &e->addr, ETH_ALEN); wrqu.addr.sa_family = ARPHRD_ETHER; cmd = IWEVREGISTERED; break; case WLC_E_DEAUTH_IND: case WLC_E_DISASSOC_IND: cmd = SIOCGIWAP; - bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN); + memset(wrqu.addr.sa_data, 0, ETH_ALEN); wrqu.addr.sa_family = ARPHRD_ETHER; - bzero(&extra, ETHER_ADDR_LEN); + memset(&extra, 0, ETH_ALEN); break; case WLC_E_LINK: case WLC_E_NDIS_LINK: cmd = SIOCGIWAP; if (!(flags & WLC_EVENT_MSG_LINK)) { - bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN); - bzero(&extra, ETHER_ADDR_LEN); + 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, ETHER_ADDR_LEN); - WL_TRACE(("Link UP\n")); + memcpy(wrqu.addr.sa_data, &e->addr, ETH_ALEN); + WL_TRACE("Link UP\n"); } wrqu.addr.sa_family = ARPHRD_ETHER; @@ -3433,8 +3424,8 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data) wrqu.data.length = datalen + 1; extra[0] = WLC_E_ACTION_FRAME; memcpy(&extra[1], data, datalen); - WL_TRACE(("WLC_E_ACTION_FRAME len %d \n", - wrqu.data.length)); + WL_TRACE("WLC_E_ACTION_FRAME len %d\n", + wrqu.data.length); } break; @@ -3464,7 +3455,7 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data) else micerrevt->flags |= IW_MICFAILURE_PAIRWISE; memcpy(micerrevt->src_addr.sa_data, &e->addr, - ETHER_ADDR_LEN); + ETH_ALEN); micerrevt->src_addr.sa_family = ARPHRD_ETHER; break; @@ -3487,14 +3478,14 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data) wrqu.data.length = sizeof(struct iw_pmkid_cand); pmkidcand = pmkcandlist->pmkid_cand; while (count) { - bzero(iwpmkidcand, + memset(iwpmkidcand, 0, sizeof(struct iw_pmkid_cand)); if (pmkidcand->preauth) iwpmkidcand->flags |= IW_PMKID_CAND_PREAUTH; bcopy(&pmkidcand->BSSID, &iwpmkidcand->bssid.sa_data, - ETHER_ADDR_LEN); + ETH_ALEN); #ifndef SANDGATE2G wireless_send_event(dev, cmd, &wrqu, extra); @@ -3515,13 +3506,13 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data) } else { cmd = SIOCGIWSCAN; wrqu.data.length = strlen(extra); - WL_TRACE(("Event WLC_E_SCAN_COMPLETE from specific " - "scan %d\n", g_iscan->iscan_state)); + WL_TRACE("Event WLC_E_SCAN_COMPLETE from specific scan %d\n", + g_iscan->iscan_state); } #else cmd = SIOCGIWSCAN; wrqu.data.length = strlen(extra); - WL_TRACE(("Event WLC_E_SCAN_COMPLETE\n")); + WL_TRACE("Event WLC_E_SCAN_COMPLETE\n"); #endif break; @@ -3529,9 +3520,9 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data) { wlc_ssid_t *ssid; ssid = (wlc_ssid_t *) 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)); + 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; @@ -3542,7 +3533,7 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data) break; default: - WL_TRACE(("Unknown Event %d: ignoring\n", event_type)); + WL_TRACE("Unknown Event %d: ignoring\n", event_type); break; } #ifndef SANDGATE2G @@ -3583,15 +3574,15 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats) goto done; phy_noise = dtoh32(phy_noise); - WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise)); + WL_TRACE("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise); - bzero(&scb_val, sizeof(scb_val_t)); + memset(&scb_val, 0, sizeof(scb_val_t)); res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)); if (res) goto done; rssi = dtoh32(scb_val.val); - WL_TRACE(("wl_iw_get_wireless_stats rssi=%d\n", rssi)); + WL_TRACE("wl_iw_get_wireless_stats rssi=%d\n", rssi); if (rssi <= WL_IW_RSSI_NO_SIGNAL) wstats->qual.qual = 0; else if (rssi <= WL_IW_RSSI_VERY_LOW) @@ -3614,23 +3605,21 @@ 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=%d\n", - (int)sizeof(wl_cnt_t))); + WL_TRACE("wl_iw_get_wireless_stats counters=%zu\n", sizeof(wl_cnt_t)); memset(&cnt, 0, sizeof(wl_cnt_t)); res = dev_wlc_bufvar_get(dev, "counters", (char *)&cnt, sizeof(wl_cnt_t)); if (res) { - WL_ERROR(("wl_iw_get_wireless_stats counters failed error=%d\n", - res)); + WL_ERROR("wl_iw_get_wireless_stats counters failed error=%d\n", + res); goto done; } cnt.version = dtoh16(cnt.version); if (cnt.version != WL_CNT_T_VERSION) { - WL_TRACE(("\tIncorrect version of counters struct: expected " - "%d; got %d\n", - WL_CNT_T_VERSION, cnt.version)); + WL_TRACE("\tIncorrect version of counters struct: expected %d; got %d\n", + WL_CNT_T_VERSION, cnt.version); goto done; } @@ -3641,22 +3630,22 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats) wstats->discard.misc = dtoh32(cnt.rxrunt) + dtoh32(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))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxfrmtoolong=%d\n", - dtoh32(cnt.rxfrmtoolong))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxbadplcp=%d\n", - dtoh32(cnt.rxbadplcp))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxundec=%d\n", - dtoh32(cnt.rxundec))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxfragerr=%d\n", - dtoh32(cnt.rxfragerr))); - WL_TRACE(("wl_iw_get_wireless_stats counters txfail=%d\n", - dtoh32(cnt.txfail))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxrunt=%d\n", - dtoh32(cnt.rxrunt))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxgiant=%d\n", - dtoh32(cnt.rxgiant))); + WL_TRACE("wl_iw_get_wireless_stats counters txframe=%d txbyte=%d\n", + dtoh32(cnt.txframe), dtoh32(cnt.txbyte)); + WL_TRACE("wl_iw_get_wireless_stats counters rxfrmtoolong=%d\n", + dtoh32(cnt.rxfrmtoolong)); + WL_TRACE("wl_iw_get_wireless_stats counters rxbadplcp=%d\n", + dtoh32(cnt.rxbadplcp)); + WL_TRACE("wl_iw_get_wireless_stats counters rxundec=%d\n", + dtoh32(cnt.rxundec)); + WL_TRACE("wl_iw_get_wireless_stats counters rxfragerr=%d\n", + dtoh32(cnt.rxfragerr)); + WL_TRACE("wl_iw_get_wireless_stats counters txfail=%d\n", + dtoh32(cnt.txfail)); + WL_TRACE("wl_iw_get_wireless_stats counters rxrunt=%d\n", + dtoh32(cnt.rxrunt)); + WL_TRACE("wl_iw_get_wireless_stats counters rxgiant=%d\n", + dtoh32(cnt.rxgiant)); #endif /* WIRELESS_EXT > 11 */ done: @@ -3690,8 +3679,7 @@ int wl_iw_attach(struct net_device *dev, void *dhdp) return -ENOMEM; memset(iscan, 0, sizeof(iscan_info_t)); - iscan->iscan_ex_params_p = - (wl_iscan_params_t *) kmalloc(params_size, GFP_KERNEL); + iscan->iscan_ex_params_p = kmalloc(params_size, GFP_KERNEL); if (!iscan->iscan_ex_params_p) return -ENOMEM; iscan->iscan_ex_param_size = params_size; @@ -3723,9 +3711,7 @@ int wl_iw_attach(struct net_device *dev, void *dhdp) priv_dev = dev; MUTEX_LOCK_SOFTAP_SET_INIT(iw->pub); #endif - g_scan = NULL; - - g_scan = (void *)kmalloc(G_SCAN_RESULTS, GFP_KERNEL); + g_scan = kmalloc(G_SCAN_RESULTS, GFP_KERNEL); if (!g_scan) return -ENOMEM; diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.h b/drivers/staging/brcm80211/brcmfmac/wl_iw.h index edbf61f..c8637c5 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_iw.h +++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.h @@ -78,7 +78,7 @@ typedef struct wl_iw_extra_params { #define CHECK_EXTRA_FOR_NULL(extra) \ if (!extra) { \ - WL_ERROR(("%s: error : extra is null pointer\n", __func__)); \ + WL_ERROR("%s: error : extra is null pointer\n", __func__); \ return -EINVAL; \ } |