diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-12-11 16:24:55 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-12-11 16:24:55 -0500 |
commit | f9c4d420c12de65e58a1a14ccee03e8b5cf99f5b (patch) | |
tree | 7cfaf7e15f29c30919b1d4527862ce914619cbe2 /drivers/net/wireless/brcm80211/brcmfmac | |
parent | 75be437230b06fca87908a787f70de0ce7fbab8c (diff) | |
parent | c66cfd5325bb215a251f4685fac8718b1da33197 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac')
17 files changed, 848 insertions, 903 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c index 334ddab4a8c..be35a2f99b1 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c @@ -67,9 +67,8 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev) u8 data; unsigned long flags; - brcmf_dbg(TRACE, "Entering\n"); + brcmf_dbg(TRACE, "Entering: irq %d\n", sdiodev->irq); - brcmf_dbg(ERROR, "requesting irq %d\n", sdiodev->irq); ret = request_irq(sdiodev->irq, brcmf_sdio_irqhandler, sdiodev->irq_flags, "brcmf_oob_intr", &sdiodev->func[1]->dev); @@ -184,7 +183,7 @@ brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address) } while (err != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); if (err) { - brcmf_dbg(ERROR, "failed at addr:0x%0x\n", + brcmf_err("failed at addr:0x%0x\n", SBSDIO_FUNC1_SBADDRLOW + i); break; } @@ -246,7 +245,7 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, } while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); if (ret != 0) - brcmf_dbg(ERROR, "failed with %d\n", ret); + brcmf_err("failed with %d\n", ret); return ret; } @@ -340,7 +339,7 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, mypkt = brcmu_pkt_buf_get_skb(nbytes); if (!mypkt) { - brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed: len %d\n", + brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n", nbytes); return -EIO; } @@ -409,7 +408,7 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, mypkt = brcmu_pkt_buf_get_skb(nbytes); if (!mypkt) { - brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed: len %d\n", + brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n", nbytes); return -EIO; } @@ -472,7 +471,7 @@ int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr, mypkt = brcmu_pkt_buf_get_skb(nbytes); if (!mypkt) { - brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed: len %d\n", + brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n", nbytes); return -EIO; } @@ -519,7 +518,7 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) /* try to attach to the target device */ sdiodev->bus = brcmf_sdbrcm_probe(regs, sdiodev); if (!sdiodev->bus) { - brcmf_dbg(ERROR, "device attach failed\n"); + brcmf_err("device attach failed\n"); ret = -ENODEV; goto out; } diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index a8005022371..d33e5598611 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c @@ -107,15 +107,13 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, /* Enable Function 2 */ err_ret = sdio_enable_func(sdfunc); if (err_ret) - brcmf_dbg(ERROR, - "enable F2 failed:%d\n", + brcmf_err("enable F2 failed:%d\n", err_ret); } else { /* Disable Function 2 */ err_ret = sdio_disable_func(sdfunc); if (err_ret) - brcmf_dbg(ERROR, - "Disable F2 failed:%d\n", + brcmf_err("Disable F2 failed:%d\n", err_ret); } } @@ -129,7 +127,7 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, sdio_writeb(sdfunc, *byte, regaddr, &err_ret); kfree(sdfunc); } else if (regaddr < 0xF0) { - brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); + brcmf_err("F0 Wr:0x%02x: write disallowed\n", regaddr); err_ret = -EPERM; } else { sdio_f0_writeb(sdfunc, *byte, regaddr, &err_ret); @@ -166,7 +164,7 @@ int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func, } if (err_ret) - brcmf_dbg(ERROR, "Failed to %s byte F%d:@0x%05x=%02x, Err: %d\n", + brcmf_err("Failed to %s byte F%d:@0x%05x=%02x, Err: %d\n", rw ? "write" : "read", func, regaddr, *byte, err_ret); return err_ret; @@ -179,7 +177,7 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, int err_ret = -EIO; if (func == 0) { - brcmf_dbg(ERROR, "Only CMD52 allowed to F0\n"); + brcmf_err("Only CMD52 allowed to F0\n"); return -EINVAL; } @@ -198,7 +196,7 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, sdio_writew(sdiodev->func[func], (*word & 0xFFFF), addr, &err_ret); else - brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes); + brcmf_err("Invalid nbytes: %d\n", nbytes); } else { /* CMD52 Read */ if (nbytes == 4) *word = sdio_readl(sdiodev->func[func], addr, &err_ret); @@ -206,11 +204,11 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, *word = sdio_readw(sdiodev->func[func], addr, &err_ret) & 0xFFFF; else - brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes); + brcmf_err("Invalid nbytes: %d\n", nbytes); } if (err_ret) - brcmf_dbg(ERROR, "Failed to %s word, Err: 0x%08x\n", + brcmf_err("Failed to %s word, Err: 0x%08x\n", rw ? "write" : "read", err_ret); return err_ret; @@ -270,7 +268,7 @@ brcmf_sdioh_request_chain(struct brcmf_sdio_dev *sdiodev, uint fix_inc, err_ret = brcmf_sdioh_request_data(sdiodev, write, fifo, func, addr, pkt, pkt_len); if (err_ret) { - brcmf_dbg(ERROR, "%s FAILED %p[%d], addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", + brcmf_err("%s FAILED %p[%d], addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", write ? "TX" : "RX", pkt, SGCount, addr, pkt_len, err_ret); } else { @@ -315,7 +313,7 @@ int brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, status = brcmf_sdioh_request_data(sdiodev, write, fifo, func, addr, pkt, pkt_len); if (status) { - brcmf_dbg(ERROR, "%s FAILED %p, addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", + brcmf_err("%s FAILED %p, addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", write ? "TX" : "RX", pkt, addr, pkt_len, status); } else { brcmf_dbg(TRACE, "%s xfr'd %p, addr=0x%05x, len=%d\n", @@ -336,7 +334,7 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr) for (i = 0; i < 3; i++) { regdata = brcmf_sdio_regrl(sdiodev, regaddr, &ret); if (ret != 0) - brcmf_dbg(ERROR, "Can't read!\n"); + brcmf_err("Can't read!\n"); *ptr++ = (u8) regdata; regaddr++; @@ -374,7 +372,7 @@ static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev) /* Enable Function 1 */ err_ret = sdio_enable_func(sdiodev->func[1]); if (err_ret) - brcmf_dbg(ERROR, "Failed to enable F1 Err: 0x%08x\n", err_ret); + brcmf_err("Failed to enable F1 Err: 0x%08x\n", err_ret); return false; } @@ -394,13 +392,13 @@ int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev) err_ret = sdio_set_block_size(sdiodev->func[1], SDIO_FUNC1_BLOCKSIZE); if (err_ret) { - brcmf_dbg(ERROR, "Failed to set F1 blocksize\n"); + brcmf_err("Failed to set F1 blocksize\n"); goto out; } err_ret = sdio_set_block_size(sdiodev->func[2], SDIO_FUNC2_BLOCKSIZE); if (err_ret) { - brcmf_dbg(ERROR, "Failed to set F2 blocksize\n"); + brcmf_err("Failed to set F2 blocksize\n"); goto out; } @@ -434,7 +432,7 @@ static int brcmf_sdio_getintrcfg(struct brcmf_sdio_dev *sdiodev) struct brcmf_sdio_oobirq *oobirq_entry; if (list_empty(&oobirq_lh)) { - brcmf_dbg(ERROR, "no valid oob irq resource\n"); + brcmf_err("no valid oob irq resource\n"); return -ENXIO; } @@ -508,7 +506,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, brcmf_dbg(TRACE, "F2 found, calling brcmf_sdio_probe...\n"); err = brcmf_sdio_probe(sdiodev); if (err) { - brcmf_dbg(ERROR, "F2 error, probe failed %d...\n", err); + brcmf_err("F2 error, probe failed %d...\n", err); goto fail; } brcmf_dbg(TRACE, "F2 init completed...\n"); @@ -564,13 +562,13 @@ static int brcmf_sdio_suspend(struct device *dev) sdio_flags = sdio_get_host_pm_caps(sdiodev->func[1]); if (!(sdio_flags & MMC_PM_KEEP_POWER)) { - brcmf_dbg(ERROR, "Host can't keep power while suspended\n"); + brcmf_err("Host can't keep power while suspended\n"); return -EINVAL; } ret = sdio_set_host_pm_flags(sdiodev->func[1], MMC_PM_KEEP_POWER); if (ret) { - brcmf_dbg(ERROR, "Failed to set pm_flags\n"); + brcmf_err("Failed to set pm_flags\n"); return ret; } @@ -635,7 +633,7 @@ static int brcmf_sdio_pd_probe(struct platform_device *pdev) ret = sdio_register_driver(&brcmf_sdmmc_driver); if (ret) - brcmf_dbg(ERROR, "sdio_register_driver failed: %d\n", ret); + brcmf_err("sdio_register_driver failed: %d\n", ret); return ret; } @@ -665,7 +663,7 @@ void brcmf_sdio_init(void) ret = platform_driver_register(&brcmf_sdio_pd); if (ret) - brcmf_dbg(ERROR, "platform_driver_register failed: %d\n", ret); + brcmf_err("platform_driver_register failed: %d\n", ret); } #else void brcmf_sdio_exit(void) @@ -684,6 +682,6 @@ void brcmf_sdio_init(void) ret = sdio_register_driver(&brcmf_sdmmc_driver); if (ret) - brcmf_dbg(ERROR, "sdio_register_driver failed: %d\n", ret); + brcmf_err("sdio_register_driver failed: %d\n", ret); } #endif /* CONFIG_BRCMFMAC_SDIO_OOB */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h index 24bc4e3e162..fd672bf5386 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h @@ -470,7 +470,6 @@ struct brcmf_pub { struct brcmf_bus *bus_if; struct brcmf_proto *prot; struct brcmf_cfg80211_info *config; - struct device *dev; /* fullmac dongle device pointer */ /* Internal brcmf items */ uint hdrlen; /* Total BRCMF header length (proto + bus) */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h index b8f248797f6..dd38b78a972 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h @@ -43,36 +43,90 @@ struct brcmf_bus_dcmd { struct list_head list; }; -/* interface structure between common and bus layer */ +/** + * struct brcmf_bus_ops - bus callback operations. + * + * @init: prepare for communication with dongle. + * @stop: clear pending frames, disable data flow. + * @txdata: send a data frame to the dongle (callee disposes skb). + * @txctl: transmit a control request message to dongle. + * @rxctl: receive a control response message from dongle. + * + * This structure provides an abstract interface towards the + * bus specific driver. For control messages to common driver + * will assure there is only one active transaction. + */ +struct brcmf_bus_ops { + int (*init)(struct device *dev); + void (*stop)(struct device *dev); + int (*txdata)(struct device *dev, struct sk_buff *skb); + int (*txctl)(struct device *dev, unsigned char *msg, uint len); + int (*rxctl)(struct device *dev, unsigned char *msg, uint len); +}; + +/** + * struct brcmf_bus - interface structure between common and bus layer + * + * @bus_priv: pointer to private bus device. + * @dev: device pointer of bus device. + * @drvr: public driver information. + * @state: operational state of the bus interface. + * @maxctl: maximum size for rxctl request message. + * @drvr_up: indicates driver up/down status. + * @tx_realloc: number of tx packets realloced for headroom. + * @dstats: dongle-based statistical data. + * @align: alignment requirement for the bus. + * @dcmd_list: bus/device specific dongle initialization commands. + */ struct brcmf_bus { union { struct brcmf_sdio_dev *sdio; struct brcmf_usbdev *usb; } bus_priv; - struct brcmf_pub *drvr; /* pointer to driver pub structure brcmf_pub */ + struct device *dev; + struct brcmf_pub *drvr; enum brcmf_bus_state state; - uint maxctl; /* Max size rxctl request from proto to bus */ - bool drvr_up; /* Status flag of driver up/down */ - unsigned long tx_realloc; /* Tx packets realloced for headroom */ - struct dngl_stats dstats; /* Stats for dongle-based data */ - u8 align; /* bus alignment requirement */ + uint maxctl; + bool drvr_up; + unsigned long tx_realloc; + struct dngl_stats dstats; + u8 align; struct list_head dcmd_list; - /* interface functions pointers */ - /* Stop bus module: clear pending frames, disable data flow */ - void (*brcmf_bus_stop)(struct device *); - /* Initialize bus module: prepare for communication w/dongle */ - int (*brcmf_bus_init)(struct device *); - /* Send a data frame to the dongle. Callee disposes of txp. */ - int (*brcmf_bus_txdata)(struct device *, struct sk_buff *); - /* Send/receive a control message to/from the dongle. - * Expects caller to enforce a single outstanding transaction. - */ - int (*brcmf_bus_txctl)(struct device *, unsigned char *, uint); - int (*brcmf_bus_rxctl)(struct device *, unsigned char *, uint); + struct brcmf_bus_ops *ops; }; /* + * callback wrappers + */ +static inline int brcmf_bus_init(struct brcmf_bus *bus) +{ + return bus->ops->init(bus->dev); +} + +static inline void brcmf_bus_stop(struct brcmf_bus *bus) +{ + bus->ops->stop(bus->dev); +} + +static inline int brcmf_bus_txdata(struct brcmf_bus *bus, struct sk_buff *skb) +{ + return bus->ops->txdata(bus->dev, skb); +} + +static inline +int brcmf_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint len) +{ + return bus->ops->txctl(bus->dev, msg, len); +} + +static inline +int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len) +{ + return bus->ops->rxctl(bus->dev, msg, len); +} + +/* * interface functions from common layer */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c index 87536d38a4c..83923553f1a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c @@ -117,9 +117,7 @@ static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr) len = CDC_MAX_MSG_SIZE; /* Send request */ - return drvr->bus_if->brcmf_bus_txctl(drvr->dev, - (unsigned char *)&prot->msg, - len); + return brcmf_bus_txctl(drvr->bus_if, (unsigned char *)&prot->msg, len); } static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) @@ -128,11 +126,10 @@ static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) struct brcmf_proto *prot = drvr->prot; brcmf_dbg(TRACE, "Enter\n"); - + len += sizeof(struct brcmf_proto_cdc_dcmd); do { - ret = drvr->bus_if->brcmf_bus_rxctl(drvr->dev, - (unsigned char *)&prot->msg, - len + sizeof(struct brcmf_proto_cdc_dcmd)); + ret = brcmf_bus_rxctl(drvr->bus_if, (unsigned char *)&prot->msg, + len); if (ret < 0) break; } while (CDC_DCMD_ID(le32_to_cpu(prot->msg.flags)) != id); @@ -179,7 +176,7 @@ brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, ret = brcmf_proto_cdc_msg(drvr); if (ret < 0) { - brcmf_dbg(ERROR, "brcmf_proto_cdc_msg failed w/status %d\n", + brcmf_err("brcmf_proto_cdc_msg failed w/status %d\n", ret); goto done; } @@ -196,7 +193,7 @@ retry: if ((id < prot->reqid) && (++retries < RETRIES)) goto retry; if (id != prot->reqid) { - brcmf_dbg(ERROR, "%s: unexpected request id %d (expected %d)\n", + brcmf_err("%s: unexpected request id %d (expected %d)\n", brcmf_ifname(drvr, ifidx), id, prot->reqid); ret = -EINVAL; goto done; @@ -258,7 +255,7 @@ int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, id = (flags & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT; if (id != prot->reqid) { - brcmf_dbg(ERROR, "%s: unexpected request id %d (expected %d)\n", + brcmf_err("%s: unexpected request id %d (expected %d)\n", brcmf_ifname(drvr, ifidx), id, prot->reqid); ret = -EINVAL; goto done; @@ -320,7 +317,7 @@ int brcmf_proto_hdrpull(struct device *dev, int *ifidx, /* Pop BDC header used to convey priority for buses that don't */ if (pktbuf->len < BDC_HEADER_LEN) { - brcmf_dbg(ERROR, "rx data too short (%d < %d)\n", + brcmf_err("rx data too short (%d < %d)\n", pktbuf->len, BDC_HEADER_LEN); return -EBADE; } @@ -329,13 +326,13 @@ int brcmf_proto_hdrpull(struct device *dev, int *ifidx, *ifidx = BDC_GET_IF_IDX(h); if (*ifidx >= BRCMF_MAX_IFS) { - brcmf_dbg(ERROR, "rx data ifnum out of range (%d)\n", *ifidx); + brcmf_err("rx data ifnum out of range (%d)\n", *ifidx); return -EBADE; } if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != BDC_PROTO_VER) { - brcmf_dbg(ERROR, "%s: non-BDC packet received, flags 0x%x\n", + brcmf_err("%s: non-BDC packet received, flags 0x%x\n", brcmf_ifname(drvr, *ifidx), h->flags); return -EBADE; } @@ -364,7 +361,7 @@ int brcmf_proto_attach(struct brcmf_pub *drvr) /* ensure that the msg buf directly follows the cdc msg struct */ if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) { - brcmf_dbg(ERROR, "struct brcmf_proto is not correctly defined\n"); + brcmf_err("struct brcmf_proto is not correctly defined\n"); goto fail; } diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index eee7175f151..f8b52e5b941 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c @@ -80,7 +80,7 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) : brcmu_pktq_pdeq_tail(q, eprec); if (p == NULL) - brcmf_dbg(ERROR, "brcmu_pktq_penq() failed, oldest %d\n", + brcmf_err("brcmu_pktq_penq() failed, oldest %d\n", discard_oldest); brcmu_pkt_buf_free_skb(p); @@ -89,7 +89,7 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, /* Enqueue */ p = brcmu_pktq_penq(q, prec, pkt); if (p == NULL) - brcmf_dbg(ERROR, "brcmu_pktq_penq() failed\n"); + brcmf_err("brcmu_pktq_penq() failed\n"); return p != NULL; } @@ -99,12 +99,12 @@ static int brcmf_c_pattern_atoh(char *src, char *dst) { int i; if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) { - brcmf_dbg(ERROR, "Mask invalid format. Needs to start with 0x\n"); + brcmf_err("Mask invalid format. Needs to start with 0x\n"); return -EINVAL; } src = src + 2; /* Skip past 0x */ if (strlen(src) % 2 != 0) { - brcmf_dbg(ERROR, "Mask invalid format. Length must be even.\n"); + brcmf_err("Mask invalid format. Length must be even.\n"); return -EINVAL; } for (i = 0; *src != '\0'; i++) { @@ -139,7 +139,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_if *ifp, char *arg, int enable, argv = strsep(&arg_save, " "); if (argv == NULL) { - brcmf_dbg(ERROR, "No args provided\n"); + brcmf_err("No args provided\n"); goto fail; } @@ -154,12 +154,12 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_if *ifp, char *arg, int enable, err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_enable", &enable_parm, sizeof(enable_parm)); if (err) - brcmf_dbg(ERROR, "Set pkt_filter_enable error (%d)\n", err); + brcmf_err("Set pkt_filter_enable error (%d)\n", err); /* Control the master mode */ err = brcmf_fil_iovar_int_set(ifp, "pkt_filter_mode", master_mode); if (err) - brcmf_dbg(ERROR, "Set pkt_filter_mode error (%d)\n", err); + brcmf_err("Set pkt_filter_mode error (%d)\n", err); fail: kfree(arg_org); @@ -191,14 +191,14 @@ static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg) while (argv[i]) { i++; if (i >= 8) { - brcmf_dbg(ERROR, "Too many parameters\n"); + brcmf_err("Too many parameters\n"); goto fail; } argv[i] = strsep(&arg_save, " "); } if (i != 6) { - brcmf_dbg(ERROR, "Not enough args provided %d\n", i); + brcmf_err("Not enough args provided %d\n", i); goto fail; } @@ -233,7 +233,7 @@ static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg) (char *)&pkt_filter->u.pattern.mask_and_pattern[mask_size]); if (mask_size != pattern_size) { - brcmf_dbg(ERROR, "Mask and pattern not the same size\n"); + brcmf_err("Mask and pattern not the same size\n"); goto fail; } @@ -245,7 +245,7 @@ static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg) err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_add", pkt_filter, buf_len); if (err) - brcmf_dbg(ERROR, "Set pkt_filter_add error (%d)\n", err); + brcmf_err("Set pkt_filter_add error (%d)\n", err); fail: kfree(arg_org); @@ -266,7 +266,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, sizeof(ifp->mac_addr)); if (err < 0) { - brcmf_dbg(ERROR, "Retreiving cur_etheraddr failed, %d\n", + brcmf_err("Retreiving cur_etheraddr failed, %d\n", err); goto done; } @@ -277,14 +277,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) strcpy(buf, "ver"); err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); if (err < 0) { - brcmf_dbg(ERROR, "Retreiving version information failed, %d\n", + brcmf_err("Retreiving version information failed, %d\n", err); goto done; } ptr = (char *)buf; strsep(&ptr, "\n"); /* Print fw version info */ - brcmf_dbg(ERROR, "Firmware version = %s\n", buf); + brcmf_err("Firmware version = %s\n", buf); /* * Setup timeout if Beacons are lost and roam is off to report @@ -293,7 +293,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", BRCMF_DEFAULT_BCN_TIMEOUT); if (err) { - brcmf_dbg(ERROR, "bcn_timeout error (%d)\n", err); + brcmf_err("bcn_timeout error (%d)\n", err); goto done; } @@ -302,7 +302,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) */ err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1); if (err) { - brcmf_dbg(ERROR, "roam_off error (%d)\n", err); + brcmf_err("roam_off error (%d)\n", err); goto done; } @@ -310,14 +310,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, BRCMF_EVENTING_MASK_LEN); if (err) { - brcmf_dbg(ERROR, "Get event_msgs error (%d)\n", err); + brcmf_err("Get event_msgs error (%d)\n", err); goto done; } setbit(eventmask, BRCMF_E_IF); err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask, BRCMF_EVENTING_MASK_LEN); if (err) { - brcmf_dbg(ERROR, "Set event_msgs error (%d)\n", err); + brcmf_err("Set event_msgs error (%d)\n", err); goto done; } @@ -325,7 +325,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, BRCMF_DEFAULT_SCAN_CHANNEL_TIME); if (err) { - brcmf_dbg(ERROR, "BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", + brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", err); goto done; } @@ -334,7 +334,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, BRCMF_DEFAULT_SCAN_UNASSOC_TIME); if (err) { - brcmf_dbg(ERROR, "BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", + brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", err); goto done; } diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c index 7e58e8ce9ab..57671eddf79 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c @@ -20,6 +20,7 @@ #include <brcmu_wifi.h> #include <brcmu_utils.h> #include "dhd.h" +#include "dhd_bus.h" #include "dhd_dbg.h" static struct dentry *root_folder; @@ -42,10 +43,12 @@ void brcmf_debugfs_exit(void) int brcmf_debugfs_attach(struct brcmf_pub *drvr) { + struct device *dev = drvr->bus_if->dev; + if (!root_folder) return -ENODEV; - drvr->dbgfs_dir = debugfs_create_dir(dev_name(drvr->dev), root_folder); + drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder); return PTR_RET(drvr->dbgfs_dir); } diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h index a0e18a1ceb4..f2ab01cd796 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h @@ -18,7 +18,6 @@ #define _BRCMF_DBG_H_ /* message levels */ -#define BRCMF_ERROR_VAL 0x0001 #define BRCMF_TRACE_VAL 0x0002 #define BRCMF_INFO_VAL 0x0004 #define BRCMF_DATA_VAL 0x0008 @@ -32,23 +31,29 @@ #define BRCMF_BTA_VAL 0x0800 #define BRCMF_FIL_VAL 0x1000 #define BRCMF_USB_VAL 0x2000 +#define BRCMF_SCAN_VAL 0x4000 +#define BRCMF_CONN_VAL 0x8000 + +/* Macro for error messages. net_ratelimit() is used when driver + * debugging is not selected. When debugging the driver error + * messages are as important as other tracing or even more so. + */ +#ifdef CONFIG_BRCMDBG +#define brcmf_err(fmt, ...) pr_err("%s: " fmt, __func__, ##__VA_ARGS__) +#else +#define brcmf_err(fmt, ...) \ + do { \ + if (net_ratelimit()) \ + pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \ + } while (0) +#endif #if defined(DEBUG) -#define brcmf_dbg(level, fmt, ...) \ -do { \ - if (BRCMF_ERROR_VAL == BRCMF_##level##_VAL) { \ - if (brcmf_msg_level & BRCMF_##level##_VAL) { \ - if (net_ratelimit()) \ - pr_debug("%s: " fmt, \ - __func__, ##__VA_ARGS__); \ - } \ - } else { \ - if (brcmf_msg_level & BRCMF_##level##_VAL) { \ - pr_debug("%s: " fmt, \ - __func__, ##__VA_ARGS__); \ - } \ - } \ +#define brcmf_dbg(level, fmt, ...) \ +do { \ + if (brcmf_msg_level & BRCMF_##level##_VAL) \ + pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) #define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index b6c86b046c1..74a616b4de8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c @@ -39,19 +39,19 @@ MODULE_LICENSE("Dual BSD/GPL"); #define MAX_WAIT_FOR_8021X_TX 50 /* msecs */ /* Error bits */ -int brcmf_msg_level = BRCMF_ERROR_VAL; +int brcmf_msg_level; module_param(brcmf_msg_level, int, 0); char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx) { if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) { - brcmf_dbg(ERROR, "ifidx %d out of range\n", ifidx); + brcmf_err("ifidx %d out of range\n", ifidx); return "<if_bad>"; } if (drvr->iflist[ifidx] == NULL) { - brcmf_dbg(ERROR, "null i/f %d\n", ifidx); + brcmf_err("null i/f %d\n", ifidx); return "<if_null>"; } @@ -102,7 +102,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work) err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen); if (err < 0) { - brcmf_dbg(ERROR, "Setting mcast_list failed, %d\n", err); + brcmf_err("Setting mcast_list failed, %d\n", err); cmd_value = cnt ? true : cmd_value; } @@ -115,13 +115,13 @@ static void _brcmf_set_multicast_list(struct work_struct *work) */ err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value); if (err < 0) - brcmf_dbg(ERROR, "Setting allmulti failed, %d\n", err); + brcmf_err("Setting allmulti failed, %d\n", err); /*Finally, pick up the PROMISC flag */ cmd_value = (ndev->flags & IFF_PROMISC) ? true : false; err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value); if (err < 0) - brcmf_dbg(ERROR, "Setting BRCMF_C_SET_PROMISC failed, %d\n", + brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", err); } @@ -137,7 +137,7 @@ _brcmf_set_mac_address(struct work_struct *work) err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr, ETH_ALEN); if (err < 0) { - brcmf_dbg(ERROR, "Setting cur_etheraddr failed, %d\n", err); + brcmf_err("Setting cur_etheraddr failed, %d\n", err); } else { brcmf_dbg(TRACE, "MAC address updated to %pM\n", ifp->mac_addr); @@ -173,7 +173,7 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev) /* Reject if down */ if (!drvr->bus_if->drvr_up || (drvr->bus_if->state != BRCMF_BUS_DATA)) { - brcmf_dbg(ERROR, "xmit rejected drvup=%d state=%d\n", + brcmf_err("xmit rejected drvup=%d state=%d\n", drvr->bus_if->drvr_up, drvr->bus_if->state); netif_stop_queue(ndev); @@ -181,7 +181,7 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev) } if (!drvr->iflist[ifp->idx]) { - brcmf_dbg(ERROR, "bad ifidx %d\n", ifp->idx); + brcmf_err("bad ifidx %d\n", ifp->idx); netif_stop_queue(ndev); return -ENODEV; } @@ -197,7 +197,7 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev) dev_kfree_skb(skb); skb = skb2; if (skb == NULL) { - brcmf_dbg(ERROR, "%s: skb_realloc_headroom failed\n", + brcmf_err("%s: skb_realloc_headroom failed\n", brcmf_ifname(drvr, ifp->idx)); ret = -ENOMEM; goto done; @@ -219,7 +219,7 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev) brcmf_proto_hdrpush(drvr, ifp->idx, skb); /* Use bus module to send data frame */ - ret = drvr->bus_if->brcmf_bus_txdata(drvr->dev, skb); + ret = brcmf_bus_txdata(drvr->bus_if, skb); done: if (ret) @@ -377,13 +377,13 @@ static int brcmf_toe_set(struct brcmf_if *ifp, u32 toe_ol) err = brcmf_fil_iovar_int_set(ifp, "toe_ol", toe_ol); if (err < 0) { - brcmf_dbg(ERROR, "Setting toe_ol failed, %d\n", err); + brcmf_err("Setting toe_ol failed, %d\n", err); return err; } err = brcmf_fil_iovar_int_set(ifp, "toe", (toe_ol != 0)); if (err < 0) - brcmf_dbg(ERROR, "Setting toe failed, %d\n", err); + brcmf_err("Setting toe failed, %d\n", err); return err; @@ -397,7 +397,7 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev, sprintf(info->driver, KBUILD_MODNAME); sprintf(info->version, "%lu", drvr->drv_version); - sprintf(info->bus_info, "%s", dev_name(drvr->dev)); + sprintf(info->bus_info, "%s", dev_name(drvr->bus_if->dev)); } static const struct ethtool_ops brcmf_ethtool_ops = { @@ -440,7 +440,7 @@ static int brcmf_ethtool(struct brcmf_if *ifp, void __user *uaddr) /* otherwise, require dongle to be up */ else if (!drvr->bus_if->drvr_up) { - brcmf_dbg(ERROR, "dongle is not up\n"); + brcmf_err("dongle is not up\n"); return -ENODEV; } /* finally, report dongle driver type */ @@ -559,7 +559,7 @@ static int brcmf_netdev_open(struct net_device *ndev) /* If bus is not ready, can't continue */ if (bus_if->state != BRCMF_BUS_DATA) { - brcmf_dbg(ERROR, "failed bus is not ready\n"); + brcmf_err("failed bus is not ready\n"); return -EAGAIN; } @@ -583,7 +583,7 @@ static int brcmf_netdev_open(struct net_device *ndev) netif_start_queue(ndev); drvr->bus_if->drvr_up = true; if (brcmf_cfg80211_up(ndev)) { - brcmf_dbg(ERROR, "failed to bring up cfg80211\n"); + brcmf_err("failed to bring up cfg80211\n"); return -1; } @@ -634,7 +634,7 @@ int brcmf_net_attach(struct brcmf_if *ifp) memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); if (register_netdev(ndev) != 0) { - brcmf_dbg(ERROR, "couldn't register the net device\n"); + brcmf_err("couldn't register the net device\n"); goto fail; } @@ -662,7 +662,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, s32 bssidx, * in case we missed the BRCMF_E_IF_DEL event. */ if (ifp) { - brcmf_dbg(ERROR, "ERROR: netdev:%s already exists\n", + brcmf_err("ERROR: netdev:%s already exists\n", ifp->ndev->name); if (ifidx) { netif_stop_queue(ifp->ndev); @@ -670,7 +670,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, s32 bssidx, free_netdev(ifp->ndev); drvr->iflist[ifidx] = NULL; } else { - brcmf_dbg(ERROR, "ignore IF event\n"); + brcmf_err("ignore IF event\n"); return ERR_PTR(-EINVAL); } } @@ -678,7 +678,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, s32 bssidx, /* Allocate netdev, including space for private structure */ ndev = alloc_netdev(sizeof(struct brcmf_if), name, ether_setup); if (!ndev) { - brcmf_dbg(ERROR, "OOM - alloc_netdev\n"); + brcmf_err("OOM - alloc_netdev\n"); return ERR_PTR(-ENOMEM); } @@ -710,7 +710,7 @@ void brcmf_del_if(struct brcmf_pub *drvr, int ifidx) ifp = drvr->iflist[ifidx]; if (!ifp) { - brcmf_dbg(ERROR, "Null interface\n"); + brcmf_err("Null interface\n"); return; } if (ifp->ndev) { @@ -753,7 +753,6 @@ int brcmf_attach(uint bus_hdrlen, struct device *dev) drvr->hdrlen = bus_hdrlen; drvr->bus_if = dev_get_drvdata(dev); drvr->bus_if->drvr = drvr; - drvr->dev = dev; /* create device debugfs folder */ brcmf_debugfs_attach(drvr); @@ -761,7 +760,7 @@ int brcmf_attach(uint bus_hdrlen, struct device *dev) /* Attach and link in the protocol */ ret = brcmf_proto_attach(drvr); if (ret != 0) { - brcmf_dbg(ERROR, "brcmf_prot_attach failed\n"); + brcmf_err("brcmf_prot_attach failed\n"); goto fail; } @@ -790,9 +789,9 @@ int brcmf_bus_start(struct device *dev) brcmf_dbg(TRACE, "\n"); /* Bring up the bus */ - ret = bus_if->brcmf_bus_init(dev); + ret = brcmf_bus_init(bus_if); if (ret != 0) { - brcmf_dbg(ERROR, "brcmf_sdbrcm_bus_init failed %d\n", ret); + brcmf_err("brcmf_sdbrcm_bus_init failed %d\n", ret); return ret; } @@ -809,7 +808,7 @@ int brcmf_bus_start(struct device *dev) if (ret < 0) goto fail; - drvr->config = brcmf_cfg80211_attach(drvr); + drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev); if (drvr->config == NULL) { ret = -ENOMEM; goto fail; @@ -822,7 +821,7 @@ int brcmf_bus_start(struct device *dev) ret = brcmf_net_attach(ifp); fail: if (ret < 0) { - brcmf_dbg(ERROR, "failed: %d\n", ret); + brcmf_err("failed: %d\n", ret); if (drvr->config) brcmf_cfg80211_detach(drvr->config); free_netdev(drvr->iflist[0]->ndev); @@ -842,7 +841,7 @@ static void brcmf_bus_detach(struct brcmf_pub *drvr) brcmf_proto_stop(drvr); /* Stop the bus module */ - drvr->bus_if->brcmf_bus_stop(drvr->dev); + brcmf_bus_stop(drvr->bus_if); } } diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 45725454714..cf857f1edf8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c @@ -689,7 +689,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); if (err) { - brcmf_dbg(ERROR, "HT Avail request error: %d\n", err); + brcmf_err("HT Avail request error: %d\n", err); return -EBADE; } @@ -697,7 +697,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) clkctl = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err); if (err) { - brcmf_dbg(ERROR, "HT Avail read error: %d\n", err); + brcmf_err("HT Avail read error: %d\n", err); return -EBADE; } @@ -707,7 +707,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) devctl = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_DEVICE_CTL, &err); if (err) { - brcmf_dbg(ERROR, "Devctl error setting CA: %d\n", + brcmf_err("Devctl error setting CA: %d\n", err); return -EBADE; } @@ -741,11 +741,11 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) usleep_range(5000, 10000); } if (err) { - brcmf_dbg(ERROR, "HT Avail request error: %d\n", err); + brcmf_err("HT Avail request error: %d\n", err); return -EBADE; } if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { - brcmf_dbg(ERROR, "HT Avail timeout (%d): clkctl 0x%02x\n", + brcmf_err("HT Avail timeout (%d): clkctl 0x%02x\n", PMU_MAX_TRANSITION_DLY, clkctl); return -EBADE; } @@ -757,7 +757,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) #if defined(DEBUG) if (!bus->alp_only) { if (SBSDIO_ALPONLY(clkctl)) - brcmf_dbg(ERROR, "HT Clock should be on\n"); + brcmf_err("HT Clock should be on\n"); } #endif /* defined (DEBUG) */ @@ -779,7 +779,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) clkreq, &err); brcmf_dbg(INFO, "CLKCTL: turned OFF\n"); if (err) { - brcmf_dbg(ERROR, "Failed access turning clock off: %d\n", + brcmf_err("Failed access turning clock off: %d\n", err); return -EBADE; } @@ -836,7 +836,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok) else if (bus->clkstate == CLK_AVAIL) brcmf_sdbrcm_htclk(bus, false, false); else - brcmf_dbg(ERROR, "request for %d -> %d\n", + brcmf_err("request for %d -> %d\n", bus->clkstate, target); brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); break; @@ -880,7 +880,7 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus) brcmf_dbg(INFO, "Dongle reports NAK handled, expect rtx of %d\n", bus->rx_seq); if (!bus->rxskip) - brcmf_dbg(ERROR, "unexpected NAKHANDLED!\n"); + brcmf_err("unexpected NAKHANDLED!\n"); bus->rxskip = false; intstatus |= I_HMB_FRAME_IND; @@ -894,7 +894,7 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus) (hmb_data & HMB_DATA_VERSION_MASK) >> HMB_DATA_VERSION_SHIFT; if (bus->sdpcm_ver != SDPCM_PROT_VERSION) - brcmf_dbg(ERROR, "Version mismatch, dongle reports %d, " + brcmf_err("Version mismatch, dongle reports %d, " "expecting %d\n", bus->sdpcm_ver, SDPCM_PROT_VERSION); else @@ -927,7 +927,7 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus) HMB_DATA_FC | HMB_DATA_FWREADY | HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK)) - brcmf_dbg(ERROR, "Unknown mailbox data content: 0x%02x\n", + brcmf_err("Unknown mailbox data content: 0x%02x\n", hmb_data); return intstatus; @@ -940,7 +940,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) u8 hi, lo; int err; - brcmf_dbg(ERROR, "%sterminate frame%s\n", + brcmf_err("%sterminate frame%s\n", abort ? "abort command, " : "", rtx ? ", send NAK" : ""); @@ -963,14 +963,14 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) break; if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) { - brcmf_dbg(ERROR, "count growing: last 0x%04x now 0x%04x\n", + brcmf_err("count growing: last 0x%04x now 0x%04x\n", lastrbc, (hi << 8) + lo); } lastrbc = (hi << 8) + lo; } if (!retries) - brcmf_dbg(ERROR, "count never zeroed: last 0x%04x\n", lastrbc); + brcmf_err("count never zeroed: last 0x%04x\n", lastrbc); else brcmf_dbg(INFO, "flush took %d iterations\n", 0xffff - retries); @@ -1057,22 +1057,22 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, return -ENODATA; } if ((u16)(~(len ^ checksum))) { - brcmf_dbg(ERROR, "HW header checksum error\n"); + brcmf_err("HW header checksum error\n"); bus->sdcnt.rx_badhdr++; brcmf_sdbrcm_rxfail(bus, false, false); return -EIO; } if (len < SDPCM_HDRLEN) { - brcmf_dbg(ERROR, "HW header length error\n"); + brcmf_err("HW header length error\n"); return -EPROTO; } if (type == BRCMF_SDIO_FT_SUPER && (roundup(len, bus->blocksize) != rd->len)) { - brcmf_dbg(ERROR, "HW superframe header length error\n"); + brcmf_err("HW superframe header length error\n"); return -EPROTO; } if (type == BRCMF_SDIO_FT_SUB && len > rd->len) { - brcmf_dbg(ERROR, "HW subframe header length error\n"); + brcmf_err("HW subframe header length error\n"); return -EPROTO; } rd->len = len; @@ -1089,7 +1089,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, */ if (type == BRCMF_SDIO_FT_SUPER && SDPCM_GLOMDESC(&header[SDPCM_FRAMETAG_LEN])) { - brcmf_dbg(ERROR, "Glom descriptor found in superframe head\n"); + brcmf_err("Glom descriptor found in superframe head\n"); rd->len = 0; return -EINVAL; } @@ -1097,7 +1097,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, rd->channel = SDPCM_PACKET_CHANNEL(&header[SDPCM_FRAMETAG_LEN]); if (len > MAX_RX_DATASZ && rd->channel != SDPCM_CONTROL_CHANNEL && type != BRCMF_SDIO_FT_SUPER) { - brcmf_dbg(ERROR, "HW header length too long\n"); + brcmf_err("HW header length too long\n"); bus->sdiodev->bus_if->dstats.rx_errors++; bus->sdcnt.rx_toolong++; brcmf_sdbrcm_rxfail(bus, false, false); @@ -1105,26 +1105,26 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, return -EPROTO; } if (type == BRCMF_SDIO_FT_SUPER && rd->channel != SDPCM_GLOM_CHANNEL) { - brcmf_dbg(ERROR, "Wrong channel for superframe\n"); + brcmf_err("Wrong channel for superframe\n"); rd->len = 0; return -EINVAL; } if (type == BRCMF_SDIO_FT_SUB && rd->channel != SDPCM_DATA_CHANNEL && rd->channel != SDPCM_EVENT_CHANNEL) { - brcmf_dbg(ERROR, "Wrong channel for subframe\n"); + brcmf_err("Wrong channel for subframe\n"); rd->len = 0; return -EINVAL; } rd->dat_offset = SDPCM_DOFFSET_VALUE(&header[SDPCM_FRAMETAG_LEN]); if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) { - brcmf_dbg(ERROR, "seq %d: bad data offset\n", rx_seq); + brcmf_err("seq %d: bad data offset\n", rx_seq); bus->sdcnt.rx_badhdr++; brcmf_sdbrcm_rxfail(bus, false, false); rd->len = 0; return -ENXIO; } if (rd->seq_num != rx_seq) { - brcmf_dbg(ERROR, "seq %d: sequence number error, expect %d\n", + brcmf_err("seq %d: sequence number error, expect %d\n", rx_seq, rd->seq_num); bus->sdcnt.rx_badseq++; rd->seq_num = rx_seq; @@ -1136,7 +1136,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, if (rd->len_nxtfrm << 4 > MAX_RX_DATASZ) { /* only warm for NON glom packet */ if (rd->channel != SDPCM_GLOM_CHANNEL) - brcmf_dbg(ERROR, "seq %d: next length error\n", rx_seq); + brcmf_err("seq %d: next length error\n", rx_seq); rd->len_nxtfrm = 0; } fc = SDPCM_FCMASK_VALUE(&header[SDPCM_FRAMETAG_LEN]); @@ -1150,7 +1150,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, } tx_seq_max = SDPCM_WINDOW_VALUE(&header[SDPCM_FRAMETAG_LEN]); if ((u8)(tx_seq_max - bus->tx_seq) > 0x40) { - brcmf_dbg(ERROR, "seq %d: max tx seq number error\n", rx_seq); + brcmf_err("seq %d: max tx seq number error\n", rx_seq); tx_seq_max = bus->tx_seq + 2; } bus->tx_max = tx_seq_max; @@ -1186,7 +1186,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) dlen = (u16) (bus->glomd->len); dptr = bus->glomd->data; if (!dlen || (dlen & 1)) { - brcmf_dbg(ERROR, "bad glomd len(%d), ignore descriptor\n", + brcmf_err("bad glomd len(%d), ignore descriptor\n", dlen); dlen = 0; } @@ -1198,13 +1198,13 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) dptr += sizeof(u16); if ((sublen < SDPCM_HDRLEN) || ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) { - brcmf_dbg(ERROR, "descriptor len %d bad: %d\n", + brcmf_err("descriptor len %d bad: %d\n", num, sublen); pnext = NULL; break; } if (sublen % BRCMF_SDALIGN) { - brcmf_dbg(ERROR, "sublen %d not multiple of %d\n", + brcmf_err("sublen %d not multiple of %d\n", sublen, BRCMF_SDALIGN); usechain = false; } @@ -1221,7 +1221,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) /* Allocate/chain packet for next subframe */ pnext = brcmu_pkt_buf_get_skb(sublen + BRCMF_SDALIGN); if (pnext == NULL) { - brcmf_dbg(ERROR, "bcm_pkt_buf_get_skb failed, num %d len %d\n", + brcmf_err("bcm_pkt_buf_get_skb failed, num %d len %d\n", num, sublen); break; } @@ -1284,13 +1284,13 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) bus->dataptr, dlen); sublen = (u16) brcmf_sdbrcm_glom_from_buf(bus, dlen); if (sublen != dlen) { - brcmf_dbg(ERROR, "FAILED TO COPY, dlen %d sublen %d\n", + brcmf_err("FAILED TO COPY, dlen %d sublen %d\n", dlen, sublen); errcode = -1; } pnext = NULL; } else { - brcmf_dbg(ERROR, "COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n", + brcmf_err("COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n", dlen); errcode = -1; } @@ -1299,7 +1299,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) /* On failure, kill the superframe, allow a couple retries */ if (errcode < 0) { - brcmf_dbg(ERROR, "glom read of %d bytes failed: %d\n", + brcmf_err("glom read of %d bytes failed: %d\n", dlen, errcode); bus->sdiodev->bus_if->dstats.rx_errors++; @@ -1390,7 +1390,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) continue; } else if (brcmf_proto_hdrpull(bus->sdiodev->dev, &ifidx, pfirst) != 0) { - brcmf_dbg(ERROR, "rx protocol error\n"); + brcmf_err("rx protocol error\n"); bus->sdiodev->bus_if->dstats.rx_errors++; skb_unlink(pfirst, &bus->glom); brcmu_pkt_buf_free_skb(pfirst); @@ -1456,7 +1456,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) if (bus->rxblen) buf = vzalloc(bus->rxblen); if (!buf) { - brcmf_dbg(ERROR, "no memory for control frame\n"); + brcmf_err("no memory for control frame\n"); goto done; } rbuf = bus->rxbuf; @@ -1486,7 +1486,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) /* Drop if the read is too big or it exceeds our maximum */ if ((rdlen + BRCMF_FIRSTREAD) > bus->sdiodev->bus_if->maxctl) { - brcmf_dbg(ERROR, "%d-byte control read exceeds %d-byte buffer\n", + brcmf_err("%d-byte control read exceeds %d-byte buffer\n", rdlen, bus->sdiodev->bus_if->maxctl); bus->sdiodev->bus_if->dstats.rx_errors++; brcmf_sdbrcm_rxfail(bus, false, false); @@ -1494,7 +1494,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) } if ((len - doff) > bus->sdiodev->bus_if->maxctl) { - brcmf_dbg(ERROR, "%d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n", + brcmf_err("%d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n", len, len - doff, bus->sdiodev->bus_if->maxctl); bus->sdiodev->bus_if->dstats.rx_errors++; bus->sdcnt.rx_toolong++; @@ -1511,7 +1511,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) /* Control frame failures need retransmission */ if (sdret < 0) { - brcmf_dbg(ERROR, "read %d control bytes failed: %d\n", + brcmf_err("read %d control bytes failed: %d\n", rdlen, sdret); bus->sdcnt.rxc_errors++; brcmf_sdbrcm_rxfail(bus, true, true); @@ -1527,7 +1527,7 @@ gotpkt: /* Point to valid data and indicate its length */ spin_lock_bh(&bus->rxctl_lock); if (bus->rxctl) { - brcmf_dbg(ERROR, "last control frame is being processed.\n"); + brcmf_err("last control frame is being processed.\n"); spin_unlock_bh(&bus->rxctl_lock); vfree(buf); goto done; @@ -1599,7 +1599,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) BRCMF_FIRSTREAD); bus->sdcnt.f2rxhdrs++; if (sdret < 0) { - brcmf_dbg(ERROR, "RXHEADER FAILED: %d\n", + brcmf_err("RXHEADER FAILED: %d\n", sdret); bus->sdcnt.rx_hdrfail++; brcmf_sdbrcm_rxfail(bus, true, true); @@ -1643,7 +1643,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) BRCMF_SDALIGN); if (!pkt) { /* Give up on data, request rtx of events */ - brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed\n"); + brcmf_err("brcmu_pkt_buf_get_skb failed\n"); bus->sdiodev->bus_if->dstats.rx_dropped++; brcmf_sdbrcm_rxfail(bus, false, RETRYCHAN(rd->channel)); @@ -1659,7 +1659,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) sdio_release_host(bus->sdiodev->func[1]); if (sdret < 0) { - brcmf_dbg(ERROR, "read %d bytes from channel %d failed: %d\n", + brcmf_err("read %d bytes from channel %d failed: %d\n", rd->len, rd->channel, sdret); brcmu_pkt_buf_free_skb(pkt); bus->sdiodev->bus_if->dstats.rx_errors++; @@ -1685,7 +1685,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) } bus->sdcnt.rx_readahead_cnt++; if (rd->len != roundup(rd_new.len, 16)) { - brcmf_dbg(ERROR, "frame length mismatch:read %d, should be %d\n", + brcmf_err("frame length mismatch:read %d, should be %d\n", rd->len, roundup(rd_new.len, 16) >> 4); rd->len = 0; @@ -1706,7 +1706,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) "RxHdr:\n"); if (rd_new.channel == SDPCM_CONTROL_CHANNEL) { - brcmf_dbg(ERROR, "readahead on control packet %d?\n", + brcmf_err("readahead on control packet %d?\n", rd_new.seq_num); /* Force retry w/normal header read */ rd->len = 0; @@ -1733,7 +1733,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) skb_pull(pkt, SDPCM_HDRLEN); bus->glomd = pkt; } else { - brcmf_dbg(ERROR, "%s: glom superframe w/o " + brcmf_err("%s: glom superframe w/o " "descriptor!\n", __func__); sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdbrcm_rxfail(bus, false, false); @@ -1762,7 +1762,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) continue; } else if (brcmf_proto_hdrpull(bus->sdiodev->dev, &ifidx, pkt) != 0) { - brcmf_dbg(ERROR, "rx protocol error\n"); + brcmf_err("rx protocol error\n"); brcmu_pkt_buf_free_skb(pkt); bus->sdiodev->bus_if->dstats.rx_errors++; continue; @@ -1818,7 +1818,7 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt, bus->sdiodev->bus_if->tx_realloc++; new = brcmu_pkt_buf_get_skb(pkt->len + BRCMF_SDALIGN); if (!new) { - brcmf_dbg(ERROR, "couldn't allocate new %d-byte packet\n", + brcmf_err("couldn't allocate new %d-byte packet\n", pkt->len + BRCMF_SDALIGN); ret = -ENOMEM; goto done; @@ -2024,7 +2024,7 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev) (saveclk | SBSDIO_FORCE_HT), &err); } if (err) - brcmf_dbg(ERROR, "Failed to force clock for F2: err %d\n", err); + brcmf_err("Failed to force clock for F2: err %d\n", err); /* Turn off the bus (F2), free any pending packets */ brcmf_dbg(INTR, "disable SDIO interrupts\n"); @@ -2150,7 +2150,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) devctl = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_DEVICE_CTL, &err); if (err) { - brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", err); + brcmf_err("error reading DEVCTL: %d\n", err); bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; } #endif /* DEBUG */ @@ -2159,7 +2159,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) clkctl = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err); if (err) { - brcmf_dbg(ERROR, "error reading CSR: %d\n", + brcmf_err("error reading CSR: %d\n", err); bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; } @@ -2171,7 +2171,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) devctl = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_DEVICE_CTL, &err); if (err) { - brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", + brcmf_err("error reading DEVCTL: %d\n", err); bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; } @@ -2179,7 +2179,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, devctl, &err); if (err) { - brcmf_dbg(ERROR, "error writing DEVCTL: %d\n", + brcmf_err("error writing DEVCTL: %d\n", err); bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; } @@ -2226,17 +2226,17 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) /* Generally don't ask for these, can get CRC errors... */ if (intstatus & I_WR_OOSYNC) { - brcmf_dbg(ERROR, "Dongle reports WR_OOSYNC\n"); + brcmf_err("Dongle reports WR_OOSYNC\n"); intstatus &= ~I_WR_OOSYNC; } if (intstatus & I_RD_OOSYNC) { - brcmf_dbg(ERROR, "Dongle reports RD_OOSYNC\n"); + brcmf_err("Dongle reports RD_OOSYNC\n"); intstatus &= ~I_RD_OOSYNC; } if (intstatus & I_SBINT) { - brcmf_dbg(ERROR, "Dongle reports SBINT\n"); + brcmf_err("Dongle reports SBINT\n"); intstatus &= ~I_SBINT; } @@ -2319,7 +2319,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) } if ((bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) || (err != 0)) { - brcmf_dbg(ERROR, "failed backplane access over SDIO, halting operation\n"); + brcmf_err("failed backplane access over SDIO, halting operation\n"); bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; atomic_set(&bus->intstatus, 0); } else if (atomic_read(&bus->intstatus) || @@ -2370,7 +2370,7 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) skb_pull(pkt, SDPCM_HDRLEN); brcmf_txcomplete(bus->sdiodev->dev, pkt, false); brcmu_pkt_buf_free_skb(pkt); - brcmf_dbg(ERROR, "out of bus->txq !!!\n"); + brcmf_err("out of bus->txq !!!\n"); ret = -ENOSR; } else { ret = 0; @@ -2420,7 +2420,7 @@ brcmf_sdbrcm_membytes(struct brcmf_sdio *bus, bool write, u32 address, u8 *data, /* Set the backplane window to include the start address */ bcmerror = brcmf_sdcard_set_sbaddr_window(bus->sdiodev, address); if (bcmerror) { - brcmf_dbg(ERROR, "window change failed\n"); + brcmf_err("window change failed\n"); goto xfer_done; } @@ -2432,7 +2432,7 @@ brcmf_sdbrcm_membytes(struct brcmf_sdio *bus, bool write, u32 address, u8 *data, bcmerror = brcmf_sdcard_rwdata(bus->sdiodev, write, sdaddr, data, dsize); if (bcmerror) { - brcmf_dbg(ERROR, "membytes transfer failed\n"); + brcmf_err("membytes transfer failed\n"); break; } @@ -2444,7 +2444,7 @@ brcmf_sdbrcm_membytes(struct brcmf_sdio *bus, bool write, u32 address, u8 *data, bcmerror = brcmf_sdcard_set_sbaddr_window(bus->sdiodev, address); if (bcmerror) { - brcmf_dbg(ERROR, "window change failed\n"); + brcmf_err("window change failed\n"); break; } sdaddr = 0; @@ -2455,7 +2455,7 @@ brcmf_sdbrcm_membytes(struct brcmf_sdio *bus, bool write, u32 address, u8 *data, xfer_done: /* Return the window to backplane enumeration space for core access */ if (brcmf_sdcard_set_sbaddr_window(bus->sdiodev, bus->sdiodev->sbwad)) - brcmf_dbg(ERROR, "FAILED to set window back to 0x%x\n", + brcmf_err("FAILED to set window back to 0x%x\n", bus->sdiodev->sbwad); sdio_release_host(bus->sdiodev->func[1]); @@ -2739,7 +2739,7 @@ static int brcmf_sdio_readshared(struct brcmf_sdio *bus, * NVRAM length at the end of memory should have been overwritten. */ if (!brcmf_sdio_valid_shared_address(addr)) { - brcmf_dbg(ERROR, "invalid sdpcm_shared address 0x%08X\n", + brcmf_err("invalid sdpcm_shared address 0x%08X\n", addr); return -EINVAL; } @@ -2762,8 +2762,7 @@ static int brcmf_sdio_readshared(struct brcmf_sdio *bus, sh->msgtrace_addr = le32_to_cpu(sh_le.msgtrace_addr); if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) { - brcmf_dbg(ERROR, - "sdpcm_shared version mismatch: dhd %d dongle %d\n", + brcmf_err("sdpcm_shared version mismatch: dhd %d dongle %d\n", SDPCM_SHARED_VERSION, sh->flags & SDPCM_SHARED_VERSION_MASK); return -EPROTO; @@ -2938,10 +2937,10 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus) if ((sh.flags & SDPCM_SHARED_ASSERT_BUILT) == 0) brcmf_dbg(INFO, "firmware not built with -assert\n"); else if (sh.flags & SDPCM_SHARED_ASSERT) - brcmf_dbg(ERROR, "assertion in dongle\n"); + brcmf_err("assertion in dongle\n"); if (sh.flags & SDPCM_SHARED_TRAP) - brcmf_dbg(ERROR, "firmware trap in dongle\n"); + brcmf_err("firmware trap in dongle\n"); return 0; } @@ -3047,7 +3046,7 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen) brcmf_dbg(CTL, "resumed on rxctl frame, got %d expected %d\n", rxlen, msglen); } else if (timeleft == 0) { - brcmf_dbg(ERROR, "resumed on timeout\n"); + brcmf_err("resumed on timeout\n"); brcmf_sdbrcm_checkdied(bus); } else if (pending) { brcmf_dbg(CTL, "cancelled\n"); @@ -3098,14 +3097,14 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus) bcmerror = brcmf_sdbrcm_membytes(bus, false, varaddr, nvram_ularray, bus->varsz); if (bcmerror) { - brcmf_dbg(ERROR, "error %d on reading %d nvram bytes at 0x%08x\n", + brcmf_err("error %d on reading %d nvram bytes at 0x%08x\n", bcmerror, bus->varsz, varaddr); } /* Compare the org NVRAM with the one read from RAM */ if (memcmp(bus->vars, nvram_ularray, bus->varsz)) - brcmf_dbg(ERROR, "Downloaded NVRAM image is corrupted\n"); + brcmf_err("Downloaded NVRAM image is corrupted\n"); else - brcmf_dbg(ERROR, "Download/Upload/Compare of NVRAM ok\n"); + brcmf_err("Download/Upload/Compare of NVRAM ok\n"); kfree(nvram_ularray); #endif /* DEBUG */ @@ -3163,14 +3162,14 @@ static int brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter) } } else { if (!ci->iscoreup(bus->sdiodev, ci, BCMA_CORE_INTERNAL_MEM)) { - brcmf_dbg(ERROR, "SOCRAM core is down after reset?\n"); + brcmf_err("SOCRAM core is down after reset?\n"); bcmerror = -EBADE; goto fail; } bcmerror = brcmf_sdbrcm_write_vars(bus); if (bcmerror) { - brcmf_dbg(ERROR, "no vars written to RAM\n"); + brcmf_err("no vars written to RAM\n"); bcmerror = 0; } @@ -3210,7 +3209,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus) ret = request_firmware(&bus->firmware, BRCMF_SDIO_FW_NAME, &bus->sdiodev->func[2]->dev); if (ret) { - brcmf_dbg(ERROR, "Fail to request firmware %d\n", ret); + brcmf_err("Fail to request firmware %d\n", ret); return ret; } bus->fw_ptr = 0; @@ -3229,7 +3228,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus) brcmf_sdbrcm_get_image((char *)memptr, MEMBLOCK, bus))) { ret = brcmf_sdbrcm_membytes(bus, true, offset, memptr, len); if (ret) { - brcmf_dbg(ERROR, "error %d on writing %d membytes at 0x%08x\n", + brcmf_err("error %d on writing %d membytes at 0x%08x\n", ret, MEMBLOCK, offset); goto err; } @@ -3329,7 +3328,7 @@ static int brcmf_sdbrcm_download_nvram(struct brcmf_sdio *bus) ret = request_firmware(&bus->firmware, BRCMF_SDIO_NV_NAME, &bus->sdiodev->func[2]->dev); if (ret) { - brcmf_dbg(ERROR, "Fail to request nvram %d\n", ret); + brcmf_err("Fail to request nvram %d\n", ret); return ret; } @@ -3346,23 +3345,23 @@ static int _brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus) /* Keep arm in reset */ if (brcmf_sdbrcm_download_state(bus, true)) { - brcmf_dbg(ERROR, "error placing ARM core in reset\n"); + brcmf_err("error placing ARM core in reset\n"); goto err; } /* External image takes precedence if specified */ if (brcmf_sdbrcm_download_code_file(bus)) { - brcmf_dbg(ERROR, "dongle image file download failed\n"); + brcmf_err("dongle image file download failed\n"); goto err; } /* External nvram takes precedence if specified */ if (brcmf_sdbrcm_download_nvram(bus)) - brcmf_dbg(ERROR, "dongle nvram file download failed\n"); + brcmf_err("dongle nvram file download failed\n"); /* Take arm out of reset */ if (brcmf_sdbrcm_download_state(bus, false)) { - brcmf_dbg(ERROR, "error getting out of ARM core reset\n"); + brcmf_err("error getting out of ARM core reset\n"); goto err; } @@ -3430,7 +3429,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev) (saveclk | SBSDIO_FORCE_HT), &err); } if (err) { - brcmf_dbg(ERROR, "Failed to force clock for F2: err %d\n", err); + brcmf_err("Failed to force clock for F2: err %d\n", err); goto exit; } @@ -3476,7 +3475,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev) if (ret == 0) { ret = brcmf_sdio_intr_register(bus->sdiodev); if (ret != 0) - brcmf_dbg(ERROR, "intr register failed:%d\n", ret); + brcmf_err("intr register failed:%d\n", ret); } /* If we didn't come up, turn off backplane clock */ @@ -3496,12 +3495,12 @@ void brcmf_sdbrcm_isr(void *arg) brcmf_dbg(TRACE, "Enter\n"); if (!bus) { - brcmf_dbg(ERROR, "bus is null pointer, exiting\n"); + brcmf_err("bus is null pointer, exiting\n"); return; } if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { - brcmf_dbg(ERROR, "bus is down. we have nothing to do\n"); + brcmf_err("bus is down. we have nothing to do\n"); return; } /* Count the interrupt call */ @@ -3510,13 +3509,13 @@ void brcmf_sdbrcm_isr(void *arg) atomic_set(&bus->ipend, 1); else if (brcmf_sdio_intr_rstatus(bus)) { - brcmf_dbg(ERROR, "failed backplane access\n"); + brcmf_err("failed backplane access\n"); bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; } /* Disable additional interrupts (is this needed now)? */ if (!bus->intr) - brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); + brcmf_err("isr w/o interrupt configured!\n"); brcmf_sdbrcm_adddpctsk(bus); queue_work(bus->brcmf_wq, &bus->datawork); @@ -3718,18 +3717,18 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus, u32 regsva) SBSDIO_FUNC1_CHIPCLKCSR, &err); if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) { - brcmf_dbg(ERROR, "ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n", + brcmf_err("ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n", err, BRCMF_INIT_CLKCTL1, clkctl); goto fail; } if (brcmf_sdio_chip_attach(bus->sdiodev, &bus->ci, regsva)) { - brcmf_dbg(ERROR, "brcmf_sdio_chip_attach failed!\n"); + brcmf_err("brcmf_sdio_chip_attach failed!\n"); goto fail; } if (!brcmf_sdbrcm_chipmatch((u16) bus->ci->chip)) { - brcmf_dbg(ERROR, "unsupported chip: 0x%04x\n", bus->ci->chip); + brcmf_err("unsupported chip: 0x%04x\n", bus->ci->chip); goto fail; } @@ -3739,7 +3738,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus, u32 regsva) /* Get info on the SOCRAM cores... */ bus->ramsize = bus->ci->ramsize; if (!(bus->ramsize)) { - brcmf_dbg(ERROR, "failed to find SOCRAM memory!\n"); + brcmf_err("failed to find SOCRAM memory!\n"); goto fail; } @@ -3883,6 +3882,14 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) brcmf_dbg(TRACE, "Disconnected\n"); } +static struct brcmf_bus_ops brcmf_sdio_bus_ops = { + .stop = brcmf_sdbrcm_bus_stop, + .init = brcmf_sdbrcm_bus_init, + .txdata = brcmf_sdbrcm_bus_txdata, + .txctl = brcmf_sdbrcm_bus_txctl, + .rxctl = brcmf_sdbrcm_bus_rxctl, +}; + void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) { int ret; @@ -3913,13 +3920,13 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) INIT_WORK(&bus->datawork, brcmf_sdio_dataworker); bus->brcmf_wq = create_singlethread_workqueue("brcmf_wq"); if (bus->brcmf_wq == NULL) { - brcmf_dbg(ERROR, "insufficient memory to create txworkqueue\n"); + brcmf_err("insufficient memory to create txworkqueue\n"); goto fail; } /* attempt to attach to the dongle */ if (!(brcmf_sdbrcm_probe_attach(bus, regsva))) { - brcmf_dbg(ERROR, "brcmf_sdbrcm_probe_attach failed\n"); + brcmf_err("brcmf_sdbrcm_probe_attach failed\n"); goto fail; } @@ -3946,26 +3953,24 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) spin_lock_init(&bus->dpc_tl_lock); /* Assign bus interface call back */ - bus->sdiodev->bus_if->brcmf_bus_stop = brcmf_sdbrcm_bus_stop; - bus->sdiodev->bus_if->brcmf_bus_init = brcmf_sdbrcm_bus_init; - bus->sdiodev->bus_if->brcmf_bus_txdata = brcmf_sdbrcm_bus_txdata; - bus->sdiodev->bus_if->brcmf_bus_txctl = brcmf_sdbrcm_bus_txctl; - bus->sdiodev->bus_if->brcmf_bus_rxctl = brcmf_sdbrcm_bus_rxctl; + bus->sdiodev->bus_if->dev = bus->sdiodev->dev; + bus->sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; + /* Attach to the brcmf/OS/network interface */ ret = brcmf_attach(SDPCM_RESERVE, bus->sdiodev->dev); if (ret != 0) { - brcmf_dbg(ERROR, "brcmf_attach failed\n"); + brcmf_err("brcmf_attach failed\n"); goto fail; } /* Allocate buffers */ if (!(brcmf_sdbrcm_probe_malloc(bus))) { - brcmf_dbg(ERROR, "brcmf_sdbrcm_probe_malloc failed\n"); + brcmf_err("brcmf_sdbrcm_probe_malloc failed\n"); goto fail; } if (!(brcmf_sdbrcm_probe_init(bus))) { - brcmf_dbg(ERROR, "brcmf_sdbrcm_probe_init failed\n"); + brcmf_err("brcmf_sdbrcm_probe_init failed\n"); goto fail; } @@ -3995,7 +4000,7 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) /* if firmware path present try to download and bring up bus */ ret = brcmf_bus_start(bus->sdiodev->dev); if (ret != 0) { - brcmf_dbg(ERROR, "dongle is not responding\n"); + brcmf_err("dongle is not responding\n"); goto fail; } diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index 7a00c4614ba..ba0b22512f1 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c @@ -95,76 +95,14 @@ struct brcmf_fweh_event_name { }; #ifdef DEBUG +#define BRCMF_ENUM_DEF(id, val) \ + { val, #id }, + /* array for mapping code to event name */ static struct brcmf_fweh_event_name fweh_event_names[] = { - { BRCMF_E_SET_SSID, "SET_SSID" }, - { BRCMF_E_JOIN, "JOIN" }, - { BRCMF_E_START, "START" }, - { BRCMF_E_AUTH, "AUTH" }, - { BRCMF_E_AUTH_IND, "AUTH_IND" }, - { BRCMF_E_DEAUTH, "DEAUTH" }, - { BRCMF_E_DEAUTH_IND, "DEAUTH_IND" }, - { BRCMF_E_ASSOC, "ASSOC" }, - { BRCMF_E_ASSOC_IND, "ASSOC_IND" }, - { BRCMF_E_REASSOC, "REASSOC" }, - { BRCMF_E_REASSOC_IND, "REASSOC_IND" }, - { BRCMF_E_DISASSOC, "DISASSOC" }, - { BRCMF_E_DISASSOC_IND, "DISASSOC_IND" }, - { BRCMF_E_QUIET_START, "START_QUIET" }, - { BRCMF_E_QUIET_END, "END_QUIET" }, - { BRCMF_E_BEACON_RX, "BEACON_RX" }, - { BRCMF_E_LINK, "LINK" }, - { BRCMF_E_MIC_ERROR, "MIC_ERROR" }, - { BRCMF_E_NDIS_LINK, "NDIS_LINK" }, - { BRCMF_E_ROAM, "ROAM" }, - { BRCMF_E_TXFAIL, "TXFAIL" }, - { BRCMF_E_PMKID_CACHE, "PMKID_CACHE" }, - { BRCMF_E_RETROGRADE_TSF, "RETROGRADE_TSF" }, - { BRCMF_E_PRUNE, "PRUNE" }, - { BRCMF_E_AUTOAUTH, "AUTOAUTH" }, - { BRCMF_E_EAPOL_MSG, "EAPOL_MSG" }, - { BRCMF_E_SCAN_COMPLETE, "SCAN_COMPLETE" }, - { BRCMF_E_ADDTS_IND, "ADDTS_IND" }, - { BRCMF_E_DELTS_IND, "DELTS_IND" }, - { BRCMF_E_BCNSENT_IND, "BCNSENT_IND" }, - { BRCMF_E_BCNRX_MSG, "BCNRX_MSG" }, - { BRCMF_E_BCNLOST_MSG, "BCNLOST_MSG" }, - { BRCMF_E_ROAM_PREP, "ROAM_PREP" }, - { BRCMF_E_PFN_NET_FOUND, "PNO_NET_FOUND" }, - { BRCMF_E_PFN_NET_LOST, "PNO_NET_LOST" }, - { BRCMF_E_RESET_COMPLETE, "RESET_COMPLETE" }, - { BRCMF_E_JOIN_START, "JOIN_START" }, - { BRCMF_E_ROAM_START, "ROAM_START" }, - { BRCMF_E_ASSOC_START, "ASSOC_START" }, - { BRCMF_E_IBSS_ASSOC, "IBSS_ASSOC" }, - { BRCMF_E_RADIO, "RADIO" }, - { BRCMF_E_PSM_WATCHDOG, "PSM_WATCHDOG" }, - { BRCMF_E_PROBREQ_MSG, "PROBREQ_MSG" }, - { BRCMF_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND" }, - { BRCMF_E_PSK_SUP, "PSK_SUP" }, - { BRCMF_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED" }, - { BRCMF_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME" }, - { BRCMF_E_ICV_ERROR, "ICV_ERROR" }, - { BRCMF_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR" }, - { BRCMF_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR" }, - { BRCMF_E_TRACE, "TRACE" }, - { BRCMF_E_IF, "IF" }, - { BRCMF_E_RSSI, "RSSI" }, - { BRCMF_E_PFN_SCAN_COMPLETE, "PFN_SCAN_COMPLETE" }, - { BRCMF_E_EXTLOG_MSG, "EXTLOG_MSG" }, - { BRCMF_E_ACTION_FRAME, "ACTION_FRAME" }, - { BRCMF_E_ACTION_FRAME_COMPLETE, "ACTION_FRAME_COMPLETE" }, - { BRCMF_E_PRE_ASSOC_IND, "PRE_ASSOC_IND" }, - { BRCMF_E_PRE_REASSOC_IND, "PRE_REASSOC_IND" }, - { BRCMF_E_CHANNEL_ADOPTED, "CHANNEL_ADOPTED" }, - { BRCMF_E_AP_STARTED, "AP_STARTED" }, - { BRCMF_E_DFS_AP_STOP, "DFS_AP_STOP" }, - { BRCMF_E_DFS_AP_RESUME, "DFS_AP_RESUME" }, - { BRCMF_E_ESCAN_RESULT, "ESCAN_RESULT" }, - { BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE, "ACTION_FRM_OFF_CHAN_CMPLT" }, - { BRCMF_E_DCS_REQUEST, "DCS_REQUEST" }, - { BRCMF_E_FIFO_CREDIT_MAP, "FIFO_CREDIT_MAP"} + BRCMF_FWEH_EVENT_ENUM_DEFLIST }; +#undef BRCMF_ENUM_DEF /** * brcmf_fweh_event_name() - returns name for given event code. @@ -219,9 +157,9 @@ static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp, if (ifp->ndev && fweh->evt_handler[code]) err = fweh->evt_handler[code](ifp, emsg, data); else - brcmf_dbg(ERROR, "unhandled event %d ignored\n", code); + brcmf_err("unhandled event %d ignored\n", code); } else { - brcmf_dbg(ERROR, "no interface object\n"); + brcmf_err("no interface object\n"); } return err; } @@ -246,7 +184,7 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, ifevent->bssidx, ifevent->flags); if (ifevent->ifidx >= BRCMF_MAX_IFS) { - brcmf_dbg(ERROR, "invalid interface index: %u\n", + brcmf_err("invalid interface index: %u\n", ifevent->ifidx); return; } @@ -348,7 +286,7 @@ static void brcmf_fweh_event_worker(struct work_struct *work) err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg, event->data); if (err) { - brcmf_dbg(ERROR, "event handler failed (%d)\n", + brcmf_err("event handler failed (%d)\n", event->code); err = 0; } @@ -405,7 +343,7 @@ int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code, brcmf_fweh_handler_t handler) { if (drvr->fweh.evt_handler[code]) { - brcmf_dbg(ERROR, "event code %d already registered\n", code); + brcmf_err("event code %d already registered\n", code); return -ENOSPC; } drvr->fweh.evt_handler[code] = handler; @@ -453,7 +391,7 @@ int brcmf_fweh_activate_events(struct brcmf_if *ifp) err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask, BRCMF_EVENTING_MASK_LEN); if (err) - brcmf_dbg(ERROR, "Set event_msgs error (%d)\n", err); + brcmf_err("Set event_msgs error (%d)\n", err); return err; } diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h index 240a2eafead..36901f76a3b 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h @@ -29,77 +29,85 @@ struct brcmf_if; struct brcmf_cfg80211_info; struct brcmf_event; +/* list of firmware events */ +#define BRCMF_FWEH_EVENT_ENUM_DEFLIST \ + BRCMF_ENUM_DEF(SET_SSID, 0) \ + BRCMF_ENUM_DEF(JOIN, 1) \ + BRCMF_ENUM_DEF(START, 2) \ + BRCMF_ENUM_DEF(AUTH, 3) \ + BRCMF_ENUM_DEF(AUTH_IND, 4) \ + BRCMF_ENUM_DEF(DEAUTH, 5) \ + BRCMF_ENUM_DEF(DEAUTH_IND, 6) \ + BRCMF_ENUM_DEF(ASSOC, 7) \ + BRCMF_ENUM_DEF(ASSOC_IND, 8) \ + BRCMF_ENUM_DEF(REASSOC, 9) \ + BRCMF_ENUM_DEF(REASSOC_IND, 10) \ + BRCMF_ENUM_DEF(DISASSOC, 11) \ + BRCMF_ENUM_DEF(DISASSOC_IND, 12) \ + BRCMF_ENUM_DEF(QUIET_START, 13) \ + BRCMF_ENUM_DEF(QUIET_END, 14) \ + BRCMF_ENUM_DEF(BEACON_RX, 15) \ + BRCMF_ENUM_DEF(LINK, 16) \ + BRCMF_ENUM_DEF(MIC_ERROR, 17) \ + BRCMF_ENUM_DEF(NDIS_LINK, 18) \ + BRCMF_ENUM_DEF(ROAM, 19) \ + BRCMF_ENUM_DEF(TXFAIL, 20) \ + BRCMF_ENUM_DEF(PMKID_CACHE, 21) \ + BRCMF_ENUM_DEF(RETROGRADE_TSF, 22) \ + BRCMF_ENUM_DEF(PRUNE, 23) \ + BRCMF_ENUM_DEF(AUTOAUTH, 24) \ + BRCMF_ENUM_DEF(EAPOL_MSG, 25) \ + BRCMF_ENUM_DEF(SCAN_COMPLETE, 26) \ + BRCMF_ENUM_DEF(ADDTS_IND, 27) \ + BRCMF_ENUM_DEF(DELTS_IND, 28) \ + BRCMF_ENUM_DEF(BCNSENT_IND, 29) \ + BRCMF_ENUM_DEF(BCNRX_MSG, 30) \ + BRCMF_ENUM_DEF(BCNLOST_MSG, 31) \ + BRCMF_ENUM_DEF(ROAM_PREP, 32) \ + BRCMF_ENUM_DEF(PFN_NET_FOUND, 33) \ + BRCMF_ENUM_DEF(PFN_NET_LOST, 34) \ + BRCMF_ENUM_DEF(RESET_COMPLETE, 35) \ + BRCMF_ENUM_DEF(JOIN_START, 36) \ + BRCMF_ENUM_DEF(ROAM_START, 37) \ + BRCMF_ENUM_DEF(ASSOC_START, 38) \ + BRCMF_ENUM_DEF(IBSS_ASSOC, 39) \ + BRCMF_ENUM_DEF(RADIO, 40) \ + BRCMF_ENUM_DEF(PSM_WATCHDOG, 41) \ + BRCMF_ENUM_DEF(PROBREQ_MSG, 44) \ + BRCMF_ENUM_DEF(SCAN_CONFIRM_IND, 45) \ + BRCMF_ENUM_DEF(PSK_SUP, 46) \ + BRCMF_ENUM_DEF(COUNTRY_CODE_CHANGED, 47) \ + BRCMF_ENUM_DEF(EXCEEDED_MEDIUM_TIME, 48) \ + BRCMF_ENUM_DEF(ICV_ERROR, 49) \ + BRCMF_ENUM_DEF(UNICAST_DECODE_ERROR, 50) \ + BRCMF_ENUM_DEF(MULTICAST_DECODE_ERROR, 51) \ + BRCMF_ENUM_DEF(TRACE, 52) \ + BRCMF_ENUM_DEF(IF, 54) \ + BRCMF_ENUM_DEF(RSSI, 56) \ + BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \ + BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \ + BRCMF_ENUM_DEF(ACTION_FRAME, 59) \ + BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \ + BRCMF_ENUM_DEF(PRE_ASSOC_IND, 61) \ + BRCMF_ENUM_DEF(PRE_REASSOC_IND, 62) \ + BRCMF_ENUM_DEF(CHANNEL_ADOPTED, 63) \ + BRCMF_ENUM_DEF(AP_STARTED, 64) \ + BRCMF_ENUM_DEF(DFS_AP_STOP, 65) \ + BRCMF_ENUM_DEF(DFS_AP_RESUME, 66) \ + BRCMF_ENUM_DEF(ESCAN_RESULT, 69) \ + BRCMF_ENUM_DEF(ACTION_FRAME_OFF_CHAN_COMPLETE, 70) \ + BRCMF_ENUM_DEF(DCS_REQUEST, 73) \ + BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) + +#define BRCMF_ENUM_DEF(id, val) \ + BRCMF_E_##id = (val), + /* firmware event codes sent by the dongle */ enum brcmf_fweh_event_code { - BRCMF_E_SET_SSID = 0, - BRCMF_E_JOIN = 1, - BRCMF_E_START = 2, - BRCMF_E_AUTH = 3, - BRCMF_E_AUTH_IND = 4, - BRCMF_E_DEAUTH = 5, - BRCMF_E_DEAUTH_IND = 6, - BRCMF_E_ASSOC = 7, - BRCMF_E_ASSOC_IND = 8, - BRCMF_E_REASSOC = 9, - BRCMF_E_REASSOC_IND = 10, - BRCMF_E_DISASSOC = 11, - BRCMF_E_DISASSOC_IND = 12, - BRCMF_E_QUIET_START = 13, - BRCMF_E_QUIET_END = 14, - BRCMF_E_BEACON_RX = 15, - BRCMF_E_LINK = 16, - BRCMF_E_MIC_ERROR = 17, - BRCMF_E_NDIS_LINK = 18, - BRCMF_E_ROAM = 19, - BRCMF_E_TXFAIL = 20, - BRCMF_E_PMKID_CACHE = 21, - BRCMF_E_RETROGRADE_TSF = 22, - BRCMF_E_PRUNE = 23, - BRCMF_E_AUTOAUTH = 24, - BRCMF_E_EAPOL_MSG = 25, - BRCMF_E_SCAN_COMPLETE = 26, - BRCMF_E_ADDTS_IND = 27, - BRCMF_E_DELTS_IND = 28, - BRCMF_E_BCNSENT_IND = 29, - BRCMF_E_BCNRX_MSG = 30, - BRCMF_E_BCNLOST_MSG = 31, - BRCMF_E_ROAM_PREP = 32, - BRCMF_E_PFN_NET_FOUND = 33, - BRCMF_E_PFN_NET_LOST = 34, - BRCMF_E_RESET_COMPLETE = 35, - BRCMF_E_JOIN_START = 36, - BRCMF_E_ROAM_START = 37, - BRCMF_E_ASSOC_START = 38, - BRCMF_E_IBSS_ASSOC = 39, - BRCMF_E_RADIO = 40, - BRCMF_E_PSM_WATCHDOG = 41, - BRCMF_E_PROBREQ_MSG = 44, - BRCMF_E_SCAN_CONFIRM_IND = 45, - BRCMF_E_PSK_SUP = 46, - BRCMF_E_COUNTRY_CODE_CHANGED = 47, - BRCMF_E_EXCEEDED_MEDIUM_TIME = 48, - BRCMF_E_ICV_ERROR = 49, - BRCMF_E_UNICAST_DECODE_ERROR = 50, - BRCMF_E_MULTICAST_DECODE_ERROR = 51, - BRCMF_E_TRACE = 52, - BRCMF_E_IF = 54, - BRCMF_E_RSSI = 56, - BRCMF_E_PFN_SCAN_COMPLETE = 57, - BRCMF_E_EXTLOG_MSG = 58, - BRCMF_E_ACTION_FRAME = 59, - BRCMF_E_ACTION_FRAME_COMPLETE = 60, - BRCMF_E_PRE_ASSOC_IND = 61, - BRCMF_E_PRE_REASSOC_IND = 62, - BRCMF_E_CHANNEL_ADOPTED = 63, - BRCMF_E_AP_STARTED = 64, - BRCMF_E_DFS_AP_STOP = 65, - BRCMF_E_DFS_AP_RESUME = 66, - BRCMF_E_ESCAN_RESULT = 69, - BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE = 70, - BRCMF_E_DCS_REQUEST = 73, - BRCMF_E_FIFO_CREDIT_MAP = 74, + BRCMF_FWEH_EVENT_ENUM_DEFLIST BRCMF_E_LAST }; +#undef BRCMF_ENUM_DEF /* flags field values in struct brcmf_event_msg */ #define BRCMF_EVENT_MSG_LINK 0x01 diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c index 51a14505197..d8d8b6549dc 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c @@ -38,7 +38,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set) s32 err; if (drvr->bus_if->state != BRCMF_BUS_DATA) { - brcmf_dbg(ERROR, "bus is down. we have nothing to do.\n"); + brcmf_err("bus is down. we have nothing to do.\n"); return -EIO; } @@ -53,7 +53,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set) if (err >= 0) err = 0; else - brcmf_dbg(ERROR, "Failed err=%d\n", err); + brcmf_err("Failed err=%d\n", err); return err; } @@ -161,7 +161,7 @@ brcmf_fil_iovar_data_set(struct brcmf_if *ifp, char *name, void *data, buflen, true); } else { err = -EPERM; - brcmf_dbg(ERROR, "Creating iovar failed\n"); + brcmf_err("Creating iovar failed\n"); } mutex_unlock(&drvr->proto_block); @@ -187,7 +187,7 @@ brcmf_fil_iovar_data_get(struct brcmf_if *ifp, char *name, void *data, memcpy(data, drvr->proto_buf, len); } else { err = -EPERM; - brcmf_dbg(ERROR, "Creating iovar failed\n"); + brcmf_err("Creating iovar failed\n"); } brcmf_dbg(FIL, "name=%s, len=%d\n", name, len); @@ -237,7 +237,7 @@ brcmf_create_bsscfg(s32 bssidx, char *name, char *data, u32 datalen, char *buf, iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen; if (buflen < iolen) { - brcmf_dbg(ERROR, "buffer is too short\n"); + brcmf_err("buffer is too short\n"); return 0; } @@ -284,7 +284,7 @@ brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, char *name, buflen, true); } else { err = -EPERM; - brcmf_dbg(ERROR, "Creating bsscfg failed\n"); + brcmf_err("Creating bsscfg failed\n"); } mutex_unlock(&drvr->proto_block); @@ -310,7 +310,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, char *name, memcpy(data, drvr->proto_buf, len); } else { err = -EPERM; - brcmf_dbg(ERROR, "Creating bsscfg failed\n"); + brcmf_err("Creating bsscfg failed\n"); } brcmf_dbg(FIL, "bssidx=%d, name=%s, len=%d\n", ifp->bssidx, name, len); brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data, diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c index 9434440bbc6..b1bb46c4979 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c @@ -186,7 +186,7 @@ brcmf_sdio_sb_coredisable(struct brcmf_sdio_dev *sdiodev, CORE_SB(base, sbtmstatehigh), NULL); if (regdata & SSB_TMSHIGH_BUSY) - brcmf_dbg(ERROR, "core state still busy\n"); + brcmf_err("core state still busy\n"); regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbidlow), NULL); @@ -438,7 +438,7 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, ci->ramsize = 0x80000; break; default: - brcmf_dbg(ERROR, "chipid 0x%x is not supported\n", ci->chip); + brcmf_err("chipid 0x%x is not supported\n", ci->chip); return -ENODEV; } @@ -456,7 +456,7 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, ci->resetcore = brcmf_sdio_ai_resetcore; break; default: - brcmf_dbg(ERROR, "socitype %u not supported\n", ci->socitype); + brcmf_err("socitype %u not supported\n", ci->socitype); return -ENODEV; } @@ -473,7 +473,7 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev) clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ; brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); if (err) { - brcmf_dbg(ERROR, "error writing for HT off\n"); + brcmf_err("error writing for HT off\n"); return err; } @@ -483,7 +483,7 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev) SBSDIO_FUNC1_CHIPCLKCSR, NULL); if ((clkval & ~SBSDIO_AVBITS) != clkset) { - brcmf_dbg(ERROR, "ChipClkCSR access: wrote 0x%02x read 0x%02x\n", + brcmf_err("ChipClkCSR access: wrote 0x%02x read 0x%02x\n", clkset, clkval); return -EACCES; } @@ -493,7 +493,7 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev) !SBSDIO_ALPAV(clkval)), PMU_MAX_TRANSITION_DLY); if (!SBSDIO_ALPAV(clkval)) { - brcmf_dbg(ERROR, "timeout on ALPAV wait, clkval 0x%02x\n", + brcmf_err("timeout on ALPAV wait, clkval 0x%02x\n", clkval); return -EBUSY; } @@ -618,7 +618,7 @@ brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev, str_shift = 11; break; default: - brcmf_dbg(ERROR, "No SDIO Drive strength init done for chip %s rev %d pmurev %d\n", + brcmf_err("No SDIO Drive strength init done for chip %s rev %d pmurev %d\n", brcmf_sdio_chip_name(ci->chip, chn, 8), ci->chiprev, ci->pmurev); break; diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 39a5baa92f2..914c56fe6c5 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c @@ -216,7 +216,7 @@ brcmf_usb_send_ctl(struct brcmf_usbdev_info *devinfo, u8 *buf, int len) ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); if (ret < 0) - brcmf_dbg(ERROR, "usb_submit_urb failed %d\n", ret); + brcmf_err("usb_submit_urb failed %d\n", ret); return ret; } @@ -250,7 +250,7 @@ brcmf_usb_recv_ctl(struct brcmf_usbdev_info *devinfo, u8 *buf, int len) ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); if (ret < 0) - brcmf_dbg(ERROR, "usb_submit_urb failed %d\n", ret); + brcmf_err("usb_submit_urb failed %d\n", ret); return ret; } @@ -271,14 +271,14 @@ static int brcmf_usb_tx_ctlpkt(struct device *dev, u8 *buf, u32 len) devinfo->ctl_completed = false; err = brcmf_usb_send_ctl(devinfo, buf, len); if (err) { - brcmf_dbg(ERROR, "fail %d bytes: %d\n", err, len); + brcmf_err("fail %d bytes: %d\n", err, len); clear_bit(0, &devinfo->ctl_op); return err; } timeout = brcmf_usb_ioctl_resp_wait(devinfo); clear_bit(0, &devinfo->ctl_op); if (!timeout) { - brcmf_dbg(ERROR, "Txctl wait timed out\n"); + brcmf_err("Txctl wait timed out\n"); err = -EIO; } return err; @@ -300,7 +300,7 @@ static int brcmf_usb_rx_ctlpkt(struct device *dev, u8 *buf, u32 len) devinfo->ctl_completed = false; err = brcmf_usb_recv_ctl(devinfo, buf, len); if (err) { - brcmf_dbg(ERROR, "fail %d bytes: %d\n", err, len); + brcmf_err("fail %d bytes: %d\n", err, len); clear_bit(0, &devinfo->ctl_op); return err; } @@ -308,7 +308,7 @@ static int brcmf_usb_rx_ctlpkt(struct device *dev, u8 *buf, u32 len) err = devinfo->ctl_urb_status; clear_bit(0, &devinfo->ctl_op); if (!timeout) { - brcmf_dbg(ERROR, "rxctl wait timed out\n"); + brcmf_err("rxctl wait timed out\n"); err = -EIO; } if (!err) @@ -356,7 +356,7 @@ brcmf_usbdev_qinit(struct list_head *q, int qsize) reqs = kzalloc(sizeof(struct brcmf_usbreq) * qsize, GFP_ATOMIC); if (reqs == NULL) { - brcmf_dbg(ERROR, "fail to allocate memory!\n"); + brcmf_err("fail to allocate memory!\n"); return NULL; } req = reqs; @@ -372,7 +372,7 @@ brcmf_usbdev_qinit(struct list_head *q, int qsize) } return reqs; fail: - brcmf_dbg(ERROR, "fail!\n"); + brcmf_err("fail!\n"); while (!list_empty(q)) { req = list_entry(q->next, struct brcmf_usbreq, list); if (req && req->urb) @@ -389,7 +389,7 @@ static void brcmf_usb_free_q(struct list_head *q, bool pending) int i = 0; list_for_each_entry_safe(req, next, q, list) { if (!req->urb) { - brcmf_dbg(ERROR, "bad req\n"); + brcmf_err("bad req\n"); break; } i++; @@ -462,7 +462,7 @@ static void brcmf_usb_rx_complete(struct urb *urb) if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) { skb_put(skb, urb->actual_length); if (brcmf_proto_hdrpull(devinfo->dev, &ifidx, skb) != 0) { - brcmf_dbg(ERROR, "rx protocol error\n"); + brcmf_err("rx protocol error\n"); brcmu_pkt_buf_free_skb(skb); devinfo->bus_pub.bus->dstats.rx_errors++; } else @@ -513,7 +513,7 @@ static void brcmf_usb_rx_fill_all(struct brcmf_usbdev_info *devinfo) struct brcmf_usbreq *req; if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) { - brcmf_dbg(ERROR, "bus is not up=%d\n", devinfo->bus_pub.state); + brcmf_err("bus is not up=%d\n", devinfo->bus_pub.state); return; } while ((req = brcmf_usb_deq(devinfo, &devinfo->rx_freeq, NULL)) != NULL) @@ -569,14 +569,14 @@ brcmf_usb_intr_complete(struct urb *urb) } if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_DOWN) { - brcmf_dbg(ERROR, "intr cb when DBUS down, ignoring\n"); + brcmf_err("intr cb when DBUS down, ignoring\n"); return; } if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) { err = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); if (err) - brcmf_dbg(ERROR, "usb_submit_urb, err=%d\n", err); + brcmf_err("usb_submit_urb, err=%d\n", err); } } @@ -594,7 +594,7 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) &devinfo->tx_freecount); if (!req) { brcmu_pkt_buf_free_skb(skb); - brcmf_dbg(ERROR, "no req to send\n"); + brcmf_err("no req to send\n"); return -ENOMEM; } @@ -606,7 +606,7 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) brcmf_usb_enq(devinfo, &devinfo->tx_postq, req, NULL); ret = usb_submit_urb(req->urb, GFP_ATOMIC); if (ret) { - brcmf_dbg(ERROR, "brcmf_usb_tx usb_submit_urb FAILED\n"); + brcmf_err("brcmf_usb_tx usb_submit_urb FAILED\n"); brcmf_usb_del_fromq(devinfo, req); brcmu_pkt_buf_free_skb(req->skb); req->skb = NULL; @@ -648,7 +648,7 @@ static int brcmf_usb_up(struct device *dev) ret = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); if (ret) { - brcmf_dbg(ERROR, "USB_SUBMIT_URB failed with status %d\n", + brcmf_err("USB_SUBMIT_URB failed with status %d\n", ret); return -EINVAL; } @@ -745,7 +745,7 @@ static bool brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd, devinfo->ctl_completed = false; ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); if (ret < 0) { - brcmf_dbg(ERROR, "usb_submit_urb failed %d\n", ret); + brcmf_err("usb_submit_urb failed %d\n", ret); kfree(tmpbuf); return false; } @@ -815,7 +815,7 @@ brcmf_usb_resetcfg(struct brcmf_usbdev_info *devinfo) brcmf_usb_dl_cmd(devinfo, DL_RESETCFG, &id, sizeof(id)); return 0; } else { - brcmf_dbg(ERROR, "Cannot talk to Dongle. Firmware is not UP, %d ms\n", + brcmf_err("Cannot talk to Dongle. Firmware is not UP, %d ms\n", BRCMF_USB_RESET_GETVER_SPINWAIT * loop_cnt); return -EINVAL; } @@ -840,7 +840,7 @@ brcmf_usb_dl_send_bulk(struct brcmf_usbdev_info *devinfo, void *buffer, int len) devinfo->ctl_completed = false; ret = usb_submit_urb(devinfo->bulk_urb, GFP_ATOMIC); if (ret) { - brcmf_dbg(ERROR, "usb_submit_urb failed %d\n", ret); + brcmf_err("usb_submit_urb failed %d\n", ret); return ret; } ret = brcmf_usb_ioctl_resp_wait(devinfo); @@ -873,7 +873,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen) /* 2) Check we are in the Waiting state */ if (rdlstate != DL_WAITING) { - brcmf_dbg(ERROR, "Failed to DL_START\n"); + brcmf_err("Failed to DL_START\n"); err = -EINVAL; goto fail; } @@ -902,7 +902,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen) memcpy(bulkchunk, dlpos, sendlen); if (brcmf_usb_dl_send_bulk(devinfo, bulkchunk, sendlen)) { - brcmf_dbg(ERROR, "send_bulk failed\n"); + brcmf_err("send_bulk failed\n"); err = -EINVAL; goto fail; } @@ -912,7 +912,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen) } if (!brcmf_usb_dl_cmd(devinfo, DL_GETSTATE, &state, sizeof(struct rdl_state_le))) { - brcmf_dbg(ERROR, "DL_GETSTATE Failed xxxx\n"); + brcmf_err("DL_GETSTATE Failed xxxx\n"); err = -EINVAL; goto fail; } @@ -922,7 +922,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen) /* restart if an error is reported */ if (rdlstate == DL_BAD_HDR || rdlstate == DL_BAD_CRC) { - brcmf_dbg(ERROR, "Bad Hdr or Bad CRC state %d\n", + brcmf_err("Bad Hdr or Bad CRC state %d\n", rdlstate); err = -EINVAL; goto fail; @@ -981,7 +981,7 @@ static int brcmf_usb_dlrun(struct brcmf_usbdev_info *devinfo) return -ENODEV; /* The Dongle may go for re-enumeration. */ } else { - brcmf_dbg(ERROR, "Dongle not runnable\n"); + brcmf_err("Dongle not runnable\n"); return -EINVAL; } brcmf_dbg(USB, "Exit\n"); @@ -1019,13 +1019,13 @@ brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo) chiprev = devinfo->bus_pub.chiprev; if (!brcmf_usb_chip_support(devid, chiprev)) { - brcmf_dbg(ERROR, "unsupported chip %d rev %d\n", + brcmf_err("unsupported chip %d rev %d\n", devid, chiprev); return -EINVAL; } if (!devinfo->image) { - brcmf_dbg(ERROR, "No firmware!\n"); + brcmf_err("No firmware!\n"); return -ENOENT; } @@ -1124,11 +1124,11 @@ static int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo) /* fw image not yet loaded. Load it now and add to list */ err = request_firmware(&fw, fwname, devinfo->dev); if (!fw) { - brcmf_dbg(ERROR, "fail to request firmware %s\n", fwname); + brcmf_err("fail to request firmware %s\n", fwname); return err; } if (check_file(fw->data) < 0) { - brcmf_dbg(ERROR, "invalid firmware %s\n", fwname); + brcmf_err("invalid firmware %s\n", fwname); return -EINVAL; } @@ -1196,17 +1196,17 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo, devinfo->intr_urb = usb_alloc_urb(0, GFP_ATOMIC); if (!devinfo->intr_urb) { - brcmf_dbg(ERROR, "usb_alloc_urb (intr) failed\n"); + brcmf_err("usb_alloc_urb (intr) failed\n"); goto error; } devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC); if (!devinfo->ctl_urb) { - brcmf_dbg(ERROR, "usb_alloc_urb (ctl) failed\n"); + brcmf_err("usb_alloc_urb (ctl) failed\n"); goto error; } devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC); if (!devinfo->bulk_urb) { - brcmf_dbg(ERROR, "usb_alloc_urb (bulk) failed\n"); + brcmf_err("usb_alloc_urb (bulk) failed\n"); goto error; } @@ -1223,11 +1223,19 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo, return &devinfo->bus_pub; error: - brcmf_dbg(ERROR, "failed!\n"); + brcmf_err("failed!\n"); brcmf_usb_detach(devinfo); return NULL; } +static struct brcmf_bus_ops brcmf_usb_bus_ops = { + .txdata = brcmf_usb_tx, + .init = brcmf_usb_up, + .stop = brcmf_usb_down, + .txctl = brcmf_usb_tx_ctlpkt, + .rxctl = brcmf_usb_rx_ctlpkt, +}; + static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) { struct brcmf_bus *bus = NULL; @@ -1246,25 +1254,22 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) goto fail; } + bus->dev = dev; bus_pub->bus = bus; - bus->brcmf_bus_txdata = brcmf_usb_tx; - bus->brcmf_bus_init = brcmf_usb_up; - bus->brcmf_bus_stop = brcmf_usb_down; - bus->brcmf_bus_txctl = brcmf_usb_tx_ctlpkt; - bus->brcmf_bus_rxctl = brcmf_usb_rx_ctlpkt; bus->bus_priv.usb = bus_pub; dev_set_drvdata(dev, bus); + bus->ops = &brcmf_usb_bus_ops; /* Attach to the common driver interface */ ret = brcmf_attach(0, dev); if (ret) { - brcmf_dbg(ERROR, "brcmf_attach failed\n"); + brcmf_err("brcmf_attach failed\n"); goto fail; } ret = brcmf_bus_start(dev); if (ret) { - brcmf_dbg(ERROR, "dongle is not responding\n"); + brcmf_err("dongle is not responding\n"); brcmf_detach(dev); goto fail; } @@ -1339,7 +1344,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) if (IFDESC(usb, CONTROL_IF).bInterfaceClass != USB_CLASS_VENDOR_SPEC || IFDESC(usb, CONTROL_IF).bInterfaceSubClass != 2 || IFDESC(usb, CONTROL_IF).bInterfaceProtocol != 0xff) { - brcmf_dbg(ERROR, "invalid control interface: class %d, subclass %d, proto %d\n", + brcmf_err("invalid control interface: class %d, subclass %d, proto %d\n", IFDESC(usb, CONTROL_IF).bInterfaceClass, IFDESC(usb, CONTROL_IF).bInterfaceSubClass, IFDESC(usb, CONTROL_IF).bInterfaceProtocol); @@ -1351,7 +1356,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) endpoint = &IFEPDESC(usb, CONTROL_IF, 0); if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) { - brcmf_dbg(ERROR, "invalid control endpoint %d\n", + brcmf_err("invalid control endpoint %d\n", endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK); ret = -1; goto fail; @@ -1370,7 +1375,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) endpoint = &IFEPDESC(usb, BULK_IF, ep); if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) { - brcmf_dbg(ERROR, "invalid data endpoint %d\n", ep); + brcmf_err("invalid data endpoint %d\n", ep); ret = -1; goto fail; } @@ -1413,7 +1418,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) return 0; fail: - brcmf_dbg(ERROR, "failed with errno %d\n", ret); + brcmf_err("failed with errno %d\n", ret); kfree(devinfo); usb_set_intfdata(intf, NULL); return ret; diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 96bc349d7f6..1261a9b84e0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -27,6 +27,7 @@ #include <defs.h> #include <brcmu_wifi.h> #include "dhd.h" +#include "dhd_dbg.h" #include "wl_cfg80211.h" #include "fwil.h" @@ -87,13 +88,11 @@ #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ (sizeof(struct brcmf_assoc_params_le) - sizeof(u16)) -static u32 brcmf_dbg_level = WL_DBG_ERR; - static bool check_vif_up(struct brcmf_cfg80211_vif *vif) { if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) { - WL_INFO("device is not ready : status (%lu)\n", - vif->sme_state); + brcmf_dbg(INFO, "device is not ready : status (%lu)\n", + vif->sme_state); return false; } return true; @@ -437,7 +436,7 @@ send_key_to_dongle(struct net_device *ndev, struct brcmf_wsec_key *key) sizeof(key_le)); if (err) - WL_ERR("wsec_key error (%d)\n", err); + brcmf_err("wsec_key error (%d)\n", err); return err; } @@ -452,13 +451,13 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, s32 ap = 0; s32 err = 0; - WL_TRACE("Enter, ndev=%p, type=%d\n", ndev, type); + brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type); switch (type) { case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_WDS: - WL_ERR("type (%d) : currently we do not support this type\n", - type); + brcmf_err("type (%d) : currently we do not support this type\n", + type); return -EOPNOTSUPP; case NL80211_IFTYPE_ADHOC: vif->mode = WL_MODE_IBSS; @@ -479,21 +478,21 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, if (ap) { set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state); - WL_INFO("IF Type = AP\n"); + brcmf_dbg(INFO, "IF Type = AP\n"); } else { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); if (err) { - WL_ERR("WLC_SET_INFRA error (%d)\n", err); + brcmf_err("WLC_SET_INFRA error (%d)\n", err); err = -EAGAIN; goto done; } - WL_INFO("IF Type = %s\n", (vif->mode == WL_MODE_IBSS) ? - "Adhoc" : "Infra"); + brcmf_dbg(INFO, "IF Type = %s\n", (vif->mode == WL_MODE_IBSS) ? + "Adhoc" : "Infra"); } ndev->ieee80211_ptr->iftype = type; done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -506,10 +505,10 @@ static void brcmf_set_mpc(struct net_device *ndev, int mpc) if (check_vif_up(ifp->vif)) { err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc); if (err) { - WL_ERR("fail to set mpc\n"); + brcmf_err("fail to set mpc\n"); return; } - WL_INFO("MPC : %d\n", mpc); + brcmf_dbg(INFO, "MPC : %d\n", mpc); } } @@ -541,19 +540,20 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le, n_ssids = request->n_ssids; n_channels = request->n_channels; /* Copy channel array if applicable */ - WL_SCAN("### List of channelspecs to scan ### %d\n", n_channels); + brcmf_dbg(SCAN, "### List of channelspecs to scan ### %d\n", + n_channels); if (n_channels > 0) { for (i = 0; i < n_channels; i++) { chanspec = channel_to_chanspec(request->channels[i]); - WL_SCAN("Chan : %d, Channel spec: %x\n", - request->channels[i]->hw_value, chanspec); + brcmf_dbg(SCAN, "Chan : %d, Channel spec: %x\n", + request->channels[i]->hw_value, chanspec); params_le->channel_list[i] = cpu_to_le16(chanspec); } } else { - WL_SCAN("Scanning all channels\n"); + brcmf_dbg(SCAN, "Scanning all channels\n"); } /* Copy ssid array if applicable */ - WL_SCAN("### List of SSIDs to scan ### %d\n", n_ssids); + brcmf_dbg(SCAN, "### List of SSIDs to scan ### %d\n", n_ssids); if (n_ssids > 0) { offset = offsetof(struct brcmf_scan_params_le, channel_list) + n_channels * sizeof(u16); @@ -566,18 +566,19 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le, memcpy(ssid_le.SSID, request->ssids[i].ssid, request->ssids[i].ssid_len); if (!ssid_le.SSID_len) - WL_SCAN("%d: Broadcast scan\n", i); + brcmf_dbg(SCAN, "%d: Broadcast scan\n", i); else - WL_SCAN("%d: scan for %s size =%d\n", i, - ssid_le.SSID, ssid_le.SSID_len); + brcmf_dbg(SCAN, "%d: scan for %s size =%d\n", + i, ssid_le.SSID, ssid_le.SSID_len); memcpy(ptr, &ssid_le, sizeof(ssid_le)); ptr += sizeof(ssid_le); } } else { - WL_SCAN("Broadcast scan %p\n", request->ssids); + brcmf_dbg(SCAN, "Broadcast scan %p\n", request->ssids); if ((request->ssids) && request->ssids->ssid_len) { - WL_SCAN("SSID %s len=%d\n", params_le->ssid_le.SSID, - request->ssids->ssid_len); + brcmf_dbg(SCAN, "SSID %s len=%d\n", + params_le->ssid_le.SSID, + request->ssids->ssid_len); params_le->ssid_le.SSID_len = cpu_to_le32(request->ssids->ssid_len); memcpy(¶ms_le->ssid_le.SSID, request->ssids->ssid, @@ -599,7 +600,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, struct cfg80211_scan_request *scan_request; s32 err = 0; - WL_SCAN("Enter\n"); + brcmf_dbg(SCAN, "Enter\n"); /* clear scan request, because the FW abort can cause a second call */ /* to this functon and might cause a double cfg80211_scan_done */ @@ -611,7 +612,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, if (fw_abort) { /* Do a scan abort to stop the driver's scan engine */ - WL_SCAN("ABORT scan in firmware\n"); + brcmf_dbg(SCAN, "ABORT scan in firmware\n"); memset(¶ms_le, 0, sizeof(params_le)); memset(params_le.bssid, 0xFF, ETH_ALEN); params_le.bss_type = DOT11_BSSTYPE_ANY; @@ -627,26 +628,26 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, err = brcmf_fil_cmd_data_set(netdev_priv(ndev), BRCMF_C_SCAN, ¶ms_le, sizeof(params_le)); if (err) - WL_ERR("Scan abort failed\n"); + brcmf_err("Scan abort failed\n"); } /* * e-scan can be initiated by scheduled scan * which takes precedence. */ if (cfg->sched_escan) { - WL_SCAN("scheduled scan completed\n"); + brcmf_dbg(SCAN, "scheduled scan completed\n"); cfg->sched_escan = false; if (!aborted) cfg80211_sched_scan_results(cfg_to_wiphy(cfg)); brcmf_set_mpc(ndev, 1); } else if (scan_request) { - WL_SCAN("ESCAN Completed scan: %s\n", - aborted ? "Aborted" : "Done"); + brcmf_dbg(SCAN, "ESCAN Completed scan: %s\n", + aborted ? "Aborted" : "Done"); cfg80211_scan_done(scan_request, aborted); brcmf_set_mpc(ndev, 1); } if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - WL_ERR("Scan complete while device not scanning\n"); + brcmf_err("Scan complete while device not scanning\n"); return -EPERM; } @@ -662,7 +663,7 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct net_device *ndev, struct brcmf_escan_params_le *params; s32 err = 0; - WL_SCAN("E-SCAN START\n"); + brcmf_dbg(SCAN, "E-SCAN START\n"); if (request != NULL) { /* Allocate space for populating ssids in struct */ @@ -687,9 +688,9 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct net_device *ndev, params, params_size); if (err) { if (err == -EBUSY) - WL_INFO("system busy : escan canceled\n"); + brcmf_dbg(INFO, "system busy : escan canceled\n"); else - WL_ERR("error (%d)\n", err); + brcmf_err("error (%d)\n", err); } kfree(params); @@ -705,7 +706,7 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy, u32 passive_scan; struct brcmf_scan_results *results; - WL_SCAN("Enter\n"); + brcmf_dbg(SCAN, "Enter\n"); cfg->escan_info.ndev = ndev; cfg->escan_info.wiphy = wiphy; cfg->escan_info.escan_state = WL_ESCAN_STATE_SCANNING; @@ -713,7 +714,7 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy, err = brcmf_fil_cmd_int_set(netdev_priv(ndev), BRCMF_C_SET_PASSIVE_SCAN, passive_scan); if (err) { - WL_ERR("error (%d)\n", err); + brcmf_err("error (%d)\n", err); return err; } brcmf_set_mpc(ndev, 0); @@ -743,19 +744,19 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, s32 err; u32 SSID_len; - WL_SCAN("START ESCAN\n"); + brcmf_dbg(SCAN, "START ESCAN\n"); if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - WL_ERR("Scanning already: status (%lu)\n", cfg->scan_status); + brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status); return -EAGAIN; } if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { - WL_ERR("Scanning being aborted: status (%lu)\n", - cfg->scan_status); + brcmf_err("Scanning being aborted: status (%lu)\n", + cfg->scan_status); return -EAGAIN; } if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) { - WL_ERR("Connecting: status (%lu)\n", ifp->vif->sme_state); + brcmf_err("Connecting: status (%lu)\n", ifp->vif->sme_state); return -EAGAIN; } @@ -781,8 +782,8 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, if (err) goto scan_out; } else { - WL_SCAN("ssid \"%s\", ssid_len (%d)\n", - ssids->ssid, ssids->ssid_len); + brcmf_dbg(SCAN, "ssid \"%s\", ssid_len (%d)\n", + ssids->ssid, ssids->ssid_len); memset(&sr->ssid_le, 0, sizeof(sr->ssid_le)); SSID_len = min_t(u8, sizeof(sr->ssid_le.SSID), ssids->ssid_len); sr->ssid_le.SSID_len = cpu_to_le32(0); @@ -792,13 +793,13 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, sr->ssid_le.SSID_len = cpu_to_le32(SSID_len); spec_scan = true; } else - WL_SCAN("Broadcast scan\n"); + brcmf_dbg(SCAN, "Broadcast scan\n"); passive_scan = cfg->active_scan ? 0 : 1; err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN, passive_scan); if (err) { - WL_ERR("WLC_SET_PASSIVE_SCAN error (%d)\n", err); + brcmf_err("WLC_SET_PASSIVE_SCAN error (%d)\n", err); goto scan_out; } brcmf_set_mpc(ndev, 0); @@ -806,10 +807,10 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, &sr->ssid_le, sizeof(sr->ssid_le)); if (err) { if (err == -EBUSY) - WL_INFO("BUSY: scan for \"%s\" canceled\n", - sr->ssid_le.SSID); + brcmf_dbg(INFO, "BUSY: scan for \"%s\" canceled\n", + sr->ssid_le.SSID); else - WL_ERR("WLC_SCAN error (%d)\n", err); + brcmf_err("WLC_SCAN error (%d)\n", err); brcmf_set_mpc(ndev, 1); goto scan_out; @@ -832,7 +833,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) struct net_device *ndev = request->wdev->netdev; s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(container_of(request->wdev, struct brcmf_cfg80211_vif, wdev))) @@ -841,9 +842,9 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) err = brcmf_cfg80211_escan(wiphy, ndev, request, NULL); if (err) - WL_ERR("scan error (%d)\n", err); + brcmf_err("scan error (%d)\n", err); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -854,7 +855,7 @@ static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold) err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh", rts_threshold); if (err) - WL_ERR("Error (%d)\n", err); + brcmf_err("Error (%d)\n", err); return err; } @@ -866,7 +867,7 @@ static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold) err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh", frag_threshold); if (err) - WL_ERR("Error (%d)\n", err); + brcmf_err("Error (%d)\n", err); return err; } @@ -878,7 +879,7 @@ static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l) err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry); if (err) { - WL_ERR("cmd (%d) , error (%d)\n", cmd, err); + brcmf_err("cmd (%d) , error (%d)\n", cmd, err); return err; } return err; @@ -891,7 +892,7 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) struct brcmf_if *ifp = netdev_priv(ndev); s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; @@ -925,7 +926,7 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) } done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -955,9 +956,7 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params, join_params->params_le.chanspec_list[0] = cpu_to_le16(chanspec); join_params->params_le.chanspec_num = cpu_to_le32(1); - WL_CONN("join_params->params.chanspec_list[0]= %#X," - "channel %d, chanspec %#X\n", - chanspec, ch, chanspec); + brcmf_dbg(CONN, "channel %d, chanspec %#X\n", ch, chanspec); } } @@ -965,18 +964,18 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif) { s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) { - WL_INFO("Call WLC_DISASSOC to stop excess roaming\n "); + brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n "); err = brcmf_fil_cmd_data_set(vif->ifp, BRCMF_C_DISASSOC, NULL, 0); if (err) - WL_ERR("WLC_DISASSOC failed (%d)\n", err); + brcmf_err("WLC_DISASSOC failed (%d)\n", err); clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); } clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); } static s32 @@ -992,53 +991,55 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, s32 wsec = 0; s32 bcnprd; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; if (params->ssid) - WL_CONN("SSID: %s\n", params->ssid); + brcmf_dbg(CONN, "SSID: %s\n", params->ssid); else { - WL_CONN("SSID: NULL, Not supported\n"); + brcmf_dbg(CONN, "SSID: NULL, Not supported\n"); return -EOPNOTSUPP; } set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); if (params->bssid) - WL_CONN("BSSID: %pM\n", params->bssid); + brcmf_dbg(CONN, "BSSID: %pM\n", params->bssid); else - WL_CONN("No BSSID specified\n"); + brcmf_dbg(CONN, "No BSSID specified\n"); if (params->chandef.chan) - WL_CONN("channel: %d\n", params->chandef.chan->center_freq); + brcmf_dbg(CONN, "channel: %d\n", + params->chandef.chan->center_freq); else - WL_CONN("no channel specified\n"); + brcmf_dbg(CONN, "no channel specified\n"); if (params->channel_fixed) - WL_CONN("fixed channel required\n"); + brcmf_dbg(CONN, "fixed channel required\n"); else - WL_CONN("no fixed channel required\n"); + brcmf_dbg(CONN, "no fixed channel required\n"); if (params->ie && params->ie_len) - WL_CONN("ie len: %d\n", params->ie_len); + brcmf_dbg(CONN, "ie len: %d\n", params->ie_len); else - WL_CONN("no ie specified\n"); + brcmf_dbg(CONN, "no ie specified\n"); if (params->beacon_interval) - WL_CONN("beacon interval: %d\n", params->beacon_interval); + brcmf_dbg(CONN, "beacon interval: %d\n", + params->beacon_interval); else - WL_CONN("no beacon interval specified\n"); + brcmf_dbg(CONN, "no beacon interval specified\n"); if (params->basic_rates) - WL_CONN("basic rates: %08X\n", params->basic_rates); + brcmf_dbg(CONN, "basic rates: %08X\n", params->basic_rates); else - WL_CONN("no basic rates specified\n"); + brcmf_dbg(CONN, "no basic rates specified\n"); if (params->privacy) - WL_CONN("privacy required\n"); + brcmf_dbg(CONN, "privacy required\n"); else - WL_CONN("no privacy required\n"); + brcmf_dbg(CONN, "no privacy required\n"); /* Configure Privacy for starter */ if (params->privacy) @@ -1046,7 +1047,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec); if (err) { - WL_ERR("wsec failed (%d)\n", err); + brcmf_err("wsec failed (%d)\n", err); goto done; } @@ -1058,7 +1059,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd); if (err) { - WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err); + brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err); goto done; } @@ -1101,7 +1102,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL, target_channel); if (err) { - WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err); + brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err); goto done; } } else @@ -1113,14 +1114,14 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, &join_params, join_params_size); if (err) { - WL_ERR("WLC_SET_SSID failed (%d)\n", err); + brcmf_err("WLC_SET_SSID failed (%d)\n", err); goto done; } done: if (err) clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1130,13 +1131,13 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) struct brcmf_if *ifp = netdev_priv(ndev); s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; brcmf_link_down(ifp->vif); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1155,10 +1156,10 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev, val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED; else val = WPA_AUTH_DISABLED; - WL_CONN("setting wpa_auth to 0x%0x\n", val); + brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val); err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "wpa_auth", val); if (err) { - WL_ERR("set wpa_auth failed (%d)\n", err); + brcmf_err("set wpa_auth failed (%d)\n", err); return err; } sec = &profile->sec; @@ -1177,27 +1178,27 @@ static s32 brcmf_set_auth_type(struct net_device *ndev, switch (sme->auth_type) { case NL80211_AUTHTYPE_OPEN_SYSTEM: val = 0; - WL_CONN("open system\n"); + brcmf_dbg(CONN, "open system\n"); break; case NL80211_AUTHTYPE_SHARED_KEY: val = 1; - WL_CONN("shared key\n"); + brcmf_dbg(CONN, "shared key\n"); break; case NL80211_AUTHTYPE_AUTOMATIC: val = 2; - WL_CONN("automatic\n"); + brcmf_dbg(CONN, "automatic\n"); break; case NL80211_AUTHTYPE_NETWORK_EAP: - WL_CONN("network eap\n"); + brcmf_dbg(CONN, "network eap\n"); default: val = 2; - WL_ERR("invalid auth type (%d)\n", sme->auth_type); + brcmf_err("invalid auth type (%d)\n", sme->auth_type); break; } err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "auth", val); if (err) { - WL_ERR("set auth failed (%d)\n", err); + brcmf_err("set auth failed (%d)\n", err); return err; } sec = &profile->sec; @@ -1231,8 +1232,8 @@ brcmf_set_set_cipher(struct net_device *ndev, pval = AES_ENABLED; break; default: - WL_ERR("invalid cipher pairwise (%d)\n", - sme->crypto.ciphers_pairwise[0]); + brcmf_err("invalid cipher pairwise (%d)\n", + sme->crypto.ciphers_pairwise[0]); return -EINVAL; } } @@ -1252,16 +1253,16 @@ brcmf_set_set_cipher(struct net_device *ndev, gval = AES_ENABLED; break; default: - WL_ERR("invalid cipher group (%d)\n", - sme->crypto.cipher_group); + brcmf_err("invalid cipher group (%d)\n", + sme->crypto.cipher_group); return -EINVAL; } } - WL_CONN("pval (%d) gval (%d)\n", pval, gval); + brcmf_dbg(CONN, "pval (%d) gval (%d)\n", pval, gval); err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "wsec", pval | gval); if (err) { - WL_ERR("error (%d)\n", err); + brcmf_err("error (%d)\n", err); return err; } @@ -1284,7 +1285,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) err = brcmf_fil_iovar_int_get(netdev_priv(ndev), "wpa_auth", &val); if (err) { - WL_ERR("could not get wpa_auth (%d)\n", err); + brcmf_err("could not get wpa_auth (%d)\n", err); return err; } if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { @@ -1296,8 +1297,8 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) val = WPA_AUTH_PSK; break; default: - WL_ERR("invalid cipher group (%d)\n", - sme->crypto.cipher_group); + brcmf_err("invalid cipher group (%d)\n", + sme->crypto.cipher_group); return -EINVAL; } } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { @@ -1309,17 +1310,17 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) val = WPA2_AUTH_PSK; break; default: - WL_ERR("invalid cipher group (%d)\n", - sme->crypto.cipher_group); + brcmf_err("invalid cipher group (%d)\n", + sme->crypto.cipher_group); return -EINVAL; } } - WL_CONN("setting wpa_auth to %d\n", val); + brcmf_dbg(CONN, "setting wpa_auth to %d\n", val); err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "wpa_auth", val); if (err) { - WL_ERR("could not set wpa_auth (%d)\n", err); + brcmf_err("could not set wpa_auth (%d)\n", err); return err; } } @@ -1339,14 +1340,14 @@ brcmf_set_sharedkey(struct net_device *ndev, s32 val; s32 err = 0; - WL_CONN("key len (%d)\n", sme->key_len); + brcmf_dbg(CONN, "key len (%d)\n", sme->key_len); if (sme->key_len == 0) return 0; sec = &profile->sec; - WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n", - sec->wpa_versions, sec->cipher_pairwise); + brcmf_dbg(CONN, "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)) return 0; @@ -1359,7 +1360,7 @@ brcmf_set_sharedkey(struct net_device *ndev, key.len = (u32) sme->key_len; key.index = (u32) sme->key_idx; if (key.len > sizeof(key.data)) { - WL_ERR("Too long key length (%u)\n", key.len); + brcmf_err("Too long key length (%u)\n", key.len); return -EINVAL; } memcpy(key.data, sme->key, key.len); @@ -1372,24 +1373,24 @@ brcmf_set_sharedkey(struct net_device *ndev, key.algo = CRYPTO_ALGO_WEP128; break; default: - WL_ERR("Invalid algorithm (%d)\n", - sme->crypto.ciphers_pairwise[0]); + brcmf_err("Invalid algorithm (%d)\n", + sme->crypto.ciphers_pairwise[0]); return -EINVAL; } /* Set the new key/index */ - WL_CONN("key length (%d) key index (%d) algo (%d)\n", - key.len, key.index, key.algo); - WL_CONN("key \"%s\"\n", key.data); + brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n", + key.len, key.index, key.algo); + brcmf_dbg(CONN, "key \"%s\"\n", key.data); err = send_key_to_dongle(ndev, &key); if (err) return err; if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) { - WL_CONN("set auth_type to shared key\n"); + brcmf_dbg(CONN, "set auth_type to shared key\n"); val = WL_AUTH_SHARED_KEY; /* shared key */ err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); if (err) - WL_ERR("set auth failed (%d)\n", err); + brcmf_err("set auth failed (%d)\n", err); } return err; } @@ -1408,12 +1409,12 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; if (!sme->ssid) { - WL_ERR("Invalid ssid\n"); + brcmf_err("Invalid ssid\n"); return -EOPNOTSUPP; } @@ -1422,40 +1423,40 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, if (chan) { cfg->channel = ieee80211_frequency_to_channel(chan->center_freq); - WL_CONN("channel (%d), center_req (%d)\n", - cfg->channel, chan->center_freq); + brcmf_dbg(CONN, "channel (%d), center_req (%d)\n", + cfg->channel, chan->center_freq); } else cfg->channel = 0; - WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); + brcmf_dbg(INFO, "ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); err = brcmf_set_wpa_version(ndev, sme); if (err) { - WL_ERR("wl_set_wpa_version failed (%d)\n", err); + brcmf_err("wl_set_wpa_version failed (%d)\n", err); goto done; } err = brcmf_set_auth_type(ndev, sme); if (err) { - WL_ERR("wl_set_auth_type failed (%d)\n", err); + brcmf_err("wl_set_auth_type failed (%d)\n", err); goto done; } err = brcmf_set_set_cipher(ndev, sme); if (err) { - WL_ERR("wl_set_set_cipher failed (%d)\n", err); + brcmf_err("wl_set_set_cipher failed (%d)\n", err); goto done; } err = brcmf_set_key_mgmt(ndev, sme); if (err) { - WL_ERR("wl_set_key_mgmt failed (%d)\n", err); + brcmf_err("wl_set_key_mgmt failed (%d)\n", err); goto done; } err = brcmf_set_sharedkey(ndev, sme); if (err) { - WL_ERR("brcmf_set_sharedkey failed (%d)\n", err); + brcmf_err("brcmf_set_sharedkey failed (%d)\n", err); goto done; } @@ -1471,20 +1472,20 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, memset(join_params.params_le.bssid, 0xFF, ETH_ALEN); if (ssid.SSID_len < IEEE80211_MAX_SSID_LEN) - WL_CONN("ssid \"%s\", len (%d)\n", - ssid.SSID, ssid.SSID_len); + brcmf_dbg(CONN, "ssid \"%s\", len (%d)\n", + ssid.SSID, ssid.SSID_len); brcmf_ch_to_chanspec(cfg->channel, &join_params, &join_params_size); err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, &join_params, join_params_size); if (err) - WL_ERR("WLC_SET_SSID failed (%d)\n", err); + brcmf_err("WLC_SET_SSID failed (%d)\n", err); done: if (err) clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1497,7 +1498,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, struct brcmf_scb_val_le scbval; s32 err = 0; - WL_TRACE("Enter. Reason code = %d\n", reason_code); + brcmf_dbg(TRACE, "Enter. Reason code = %d\n", reason_code); if (!check_vif_up(ifp->vif)) return -EIO; @@ -1508,9 +1509,9 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC, &scbval, sizeof(scbval)); if (err) - WL_ERR("error (%d)\n", err); + brcmf_err("error (%d)\n", err); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1527,7 +1528,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, s32 disable = 0; s32 dbm = MBM_TO_DBM(mbm); - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; @@ -1537,7 +1538,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, case NL80211_TX_POWER_LIMITED: case NL80211_TX_POWER_FIXED: if (dbm < 0) { - WL_ERR("TX_POWER_FIXED - dbm is negative\n"); + brcmf_err("TX_POWER_FIXED - dbm is negative\n"); err = -EINVAL; goto done; } @@ -1547,7 +1548,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, disable = WL_RADIO_SW_DISABLE << 16; err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable); if (err) - WL_ERR("WLC_SET_RADIO error (%d)\n", err); + brcmf_err("WLC_SET_RADIO error (%d)\n", err); if (dbm > 0xffff) txpwrmw = 0xffff; @@ -1556,11 +1557,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, err = brcmf_fil_iovar_int_set(ifp, "qtxpower", (s32)brcmf_mw_to_qdbm(txpwrmw)); if (err) - WL_ERR("qtxpower error (%d)\n", err); + brcmf_err("qtxpower error (%d)\n", err); cfg->conf->tx_power = dbm; done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1574,13 +1575,13 @@ static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, u8 result; s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &txpwrdbm); if (err) { - WL_ERR("error (%d)\n", err); + brcmf_err("error (%d)\n", err); goto done; } @@ -1588,7 +1589,7 @@ static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, *dbm = (s32) brcmf_qdbm_to_mw(result); done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1601,14 +1602,14 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev, u32 wsec; s32 err = 0; - WL_TRACE("Enter\n"); - WL_CONN("key index (%d)\n", key_idx); + brcmf_dbg(TRACE, "Enter\n"); + brcmf_dbg(CONN, "key index (%d)\n", key_idx); if (!check_vif_up(ifp->vif)) return -EIO; err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); if (err) { - WL_ERR("WLC_GET_WSEC error (%d)\n", err); + brcmf_err("WLC_GET_WSEC error (%d)\n", err); goto done; } @@ -1618,10 +1619,10 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_KEY_PRIMARY, index); if (err) - WL_ERR("error (%d)\n", err); + brcmf_err("error (%d)\n", err); } done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1644,14 +1645,14 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, /* key delete */ err = send_key_to_dongle(ndev, &key); if (err) - WL_ERR("key delete error (%d)\n", err); + brcmf_err("key delete error (%d)\n", err); } else { if (key.len > sizeof(key.data)) { - WL_ERR("Invalid key length (%d)\n", key.len); + brcmf_err("Invalid key length (%d)\n", key.len); return -EINVAL; } - WL_CONN("Setting the key index %d\n", key.index); + brcmf_dbg(CONN, "Setting the key index %d\n", key.index); memcpy(key.data, params->key, key.len); if (params->cipher == WLAN_CIPHER_SUITE_TKIP) { @@ -1675,31 +1676,31 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, switch (params->cipher) { case WLAN_CIPHER_SUITE_WEP40: key.algo = CRYPTO_ALGO_WEP1; - WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n"); break; case WLAN_CIPHER_SUITE_WEP104: key.algo = CRYPTO_ALGO_WEP128; - WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); break; case WLAN_CIPHER_SUITE_TKIP: key.algo = CRYPTO_ALGO_TKIP; - WL_CONN("WLAN_CIPHER_SUITE_TKIP\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); break; case WLAN_CIPHER_SUITE_AES_CMAC: key.algo = CRYPTO_ALGO_AES_CCM; - WL_CONN("WLAN_CIPHER_SUITE_AES_CMAC\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); break; case WLAN_CIPHER_SUITE_CCMP: key.algo = CRYPTO_ALGO_AES_CCM; - WL_CONN("WLAN_CIPHER_SUITE_CCMP\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n"); break; default: - WL_ERR("Invalid cipher (0x%x)\n", params->cipher); + brcmf_err("Invalid cipher (0x%x)\n", params->cipher); return -EINVAL; } err = send_key_to_dongle(ndev, &key); if (err) - WL_ERR("wsec_key error (%d)\n", err); + brcmf_err("wsec_key error (%d)\n", err); } return err; } @@ -1716,13 +1717,13 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, s32 err = 0; u8 keybuf[8]; - WL_TRACE("Enter\n"); - WL_CONN("key index (%d)\n", key_idx); + brcmf_dbg(TRACE, "Enter\n"); + brcmf_dbg(CONN, "key index (%d)\n", key_idx); if (!check_vif_up(ifp->vif)) return -EIO; if (mac_addr) { - WL_TRACE("Exit"); + brcmf_dbg(TRACE, "Exit"); return brcmf_add_keyext(wiphy, ndev, key_idx, mac_addr, params); } memset(&key, 0, sizeof(key)); @@ -1731,7 +1732,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, key.index = (u32) key_idx; if (key.len > sizeof(key.data)) { - WL_ERR("Too long key length (%u)\n", key.len); + brcmf_err("Too long key length (%u)\n", key.len); err = -EINVAL; goto done; } @@ -1742,36 +1743,36 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, case WLAN_CIPHER_SUITE_WEP40: key.algo = CRYPTO_ALGO_WEP1; val = WEP_ENABLED; - WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n"); break; case WLAN_CIPHER_SUITE_WEP104: key.algo = CRYPTO_ALGO_WEP128; val = WEP_ENABLED; - WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); break; case WLAN_CIPHER_SUITE_TKIP: if (ifp->vif->mode != WL_MODE_AP) { - WL_CONN("Swapping key\n"); + brcmf_dbg(CONN, "Swapping key\n"); memcpy(keybuf, &key.data[24], sizeof(keybuf)); memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); memcpy(&key.data[16], keybuf, sizeof(keybuf)); } key.algo = CRYPTO_ALGO_TKIP; val = TKIP_ENABLED; - WL_CONN("WLAN_CIPHER_SUITE_TKIP\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); break; case WLAN_CIPHER_SUITE_AES_CMAC: key.algo = CRYPTO_ALGO_AES_CCM; val = AES_ENABLED; - WL_CONN("WLAN_CIPHER_SUITE_AES_CMAC\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); break; case WLAN_CIPHER_SUITE_CCMP: key.algo = CRYPTO_ALGO_AES_CCM; val = AES_ENABLED; - WL_CONN("WLAN_CIPHER_SUITE_CCMP\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n"); break; default: - WL_ERR("Invalid cipher (0x%x)\n", params->cipher); + brcmf_err("Invalid cipher (0x%x)\n", params->cipher); err = -EINVAL; goto done; } @@ -1782,18 +1783,18 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); if (err) { - WL_ERR("get wsec error (%d)\n", err); + brcmf_err("get wsec error (%d)\n", err); goto done; } wsec |= val; err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); if (err) { - WL_ERR("set wsec error (%d)\n", err); + brcmf_err("set wsec error (%d)\n", err); goto done; } done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1805,13 +1806,13 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, struct brcmf_wsec_key key; s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; if (key_idx >= DOT11_MAX_DEFAULT_KEYS) { /* we ignore this key index in this case */ - WL_ERR("invalid key index (%d)\n", key_idx); + brcmf_err("invalid key index (%d)\n", key_idx); return -EINVAL; } @@ -1821,12 +1822,12 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, key.flags = BRCMF_PRIMARY_KEY; key.algo = CRYPTO_ALGO_OFF; - WL_CONN("key index (%d)\n", key_idx); + brcmf_dbg(CONN, "key index (%d)\n", key_idx); /* Set the new key/index */ err = send_key_to_dongle(ndev, &key); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1842,8 +1843,8 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, s32 wsec; s32 err = 0; - WL_TRACE("Enter\n"); - WL_CONN("key index (%d)\n", key_idx); + brcmf_dbg(TRACE, "Enter\n"); + brcmf_dbg(CONN, "key index (%d)\n", key_idx); if (!check_vif_up(ifp->vif)) return -EIO; @@ -1851,7 +1852,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); if (err) { - WL_ERR("WLC_GET_WSEC error (%d)\n", err); + brcmf_err("WLC_GET_WSEC error (%d)\n", err); /* Ignore this error, may happen during DISASSOC */ err = -EAGAIN; goto done; @@ -1861,29 +1862,29 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, sec = &profile->sec; if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { params.cipher = WLAN_CIPHER_SUITE_WEP40; - WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n"); } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) { params.cipher = WLAN_CIPHER_SUITE_WEP104; - WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); } break; case TKIP_ENABLED: params.cipher = WLAN_CIPHER_SUITE_TKIP; - WL_CONN("WLAN_CIPHER_SUITE_TKIP\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); break; case AES_ENABLED: params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; - WL_CONN("WLAN_CIPHER_SUITE_AES_CMAC\n"); + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); break; default: - WL_ERR("Invalid algo (0x%x)\n", wsec); + brcmf_err("Invalid algo (0x%x)\n", wsec); err = -EINVAL; goto done; } callback(cookie, ¶ms); done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1891,7 +1892,7 @@ static s32 brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_idx) { - WL_INFO("Not supported\n"); + brcmf_dbg(INFO, "Not supported\n"); return -EOPNOTSUPP; } @@ -1909,7 +1910,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, u8 *bssid = profile->bssid; struct brcmf_sta_info_le sta_info_le; - WL_TRACE("Enter, MAC %pM\n", mac); + brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac); if (!check_vif_up(ifp->vif)) return -EIO; @@ -1919,7 +1920,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, &sta_info_le, sizeof(sta_info_le)); if (err < 0) { - WL_ERR("GET STA INFO failed, %d\n", err); + brcmf_err("GET STA INFO failed, %d\n", err); goto done; } sinfo->filled = STATION_INFO_INACTIVE_TIME; @@ -1928,24 +1929,24 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, sinfo->filled |= STATION_INFO_CONNECTED_TIME; sinfo->connected_time = le32_to_cpu(sta_info_le.in); } - WL_TRACE("STA idle time : %d ms, connected time :%d sec\n", - sinfo->inactive_time, sinfo->connected_time); + brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n", + sinfo->inactive_time, sinfo->connected_time); } else if (ifp->vif->mode == WL_MODE_BSS) { if (memcmp(mac, bssid, ETH_ALEN)) { - WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n", - mac, bssid); + brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n", + mac, bssid); err = -ENOENT; goto done; } /* Report the current tx rate */ err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate); if (err) { - WL_ERR("Could not get rate (%d)\n", err); + brcmf_err("Could not get rate (%d)\n", err); goto done; } else { sinfo->filled |= STATION_INFO_TX_BITRATE; sinfo->txrate.legacy = rate * 5; - WL_CONN("Rate %d Mbps\n", rate / 2); + brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2); } if (test_bit(BRCMF_VIF_STATUS_CONNECTED, @@ -1954,19 +1955,19 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scb_val, sizeof(scb_val)); if (err) { - WL_ERR("Could not get rssi (%d)\n", err); + brcmf_err("Could not get rssi (%d)\n", err); goto done; } else { rssi = le32_to_cpu(scb_val.val); sinfo->filled |= STATION_INFO_SIGNAL; sinfo->signal = rssi; - WL_CONN("RSSI %d dBm\n", rssi); + brcmf_dbg(CONN, "RSSI %d dBm\n", rssi); } } } else err = -EPERM; done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -1979,7 +1980,7 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_if *ifp = netdev_priv(ndev); - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); /* * Powersave enable/disable request is coming from the @@ -1991,22 +1992,22 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, cfg->pwr_save = enabled; if (!check_vif_up(ifp->vif)) { - WL_INFO("Device is not ready, storing the value in cfg_info struct\n"); + brcmf_dbg(INFO, "Device is not ready, storing the value in cfg_info struct\n"); goto done; } pm = enabled ? PM_FAST : PM_OFF; - WL_INFO("power save %s\n", (pm ? "enabled" : "disabled")); + brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled")); err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); if (err) { if (err == -ENODEV) - WL_ERR("net_device is not ready yet\n"); + brcmf_err("net_device is not ready yet\n"); else - WL_ERR("error (%d)\n", err); + brcmf_err("error (%d)\n", err); } done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -2024,7 +2025,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev, u32 legacy; s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; @@ -2033,7 +2034,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_CURR_RATESET, &rateset_le, sizeof(rateset_le)); if (err) { - WL_ERR("could not get current rateset (%d)\n", err); + brcmf_err("could not get current rateset (%d)\n", err); goto done; } @@ -2051,7 +2052,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev, /* Specified rate in bps */ rate = val / 500000; - WL_CONN("rate %d mbps\n", rate / 2); + brcmf_dbg(CONN, "rate %d mbps\n", rate / 2); /* * @@ -2061,12 +2062,13 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev, err_bg = brcmf_fil_iovar_int_set(ifp, "bg_rate", rate); err_a = brcmf_fil_iovar_int_set(ifp, "a_rate", rate); if (err_bg && err_a) { - WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a); + brcmf_err("could not set fixed rate (%d) (%d)\n", err_bg, + err_a); err = err_bg | err_a; } done: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -2087,7 +2089,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg, s32 notify_signal; if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { - WL_ERR("Bss info is larger than buffer. Discarding\n"); + brcmf_err("Bss info is larger than buffer. Discarding\n"); return 0; } @@ -2108,13 +2110,11 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg, notify_ielen = le32_to_cpu(bi->ie_length); notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; - WL_CONN("bssid: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", - bi->BSSID[0], bi->BSSID[1], bi->BSSID[2], - bi->BSSID[3], bi->BSSID[4], bi->BSSID[5]); - WL_CONN("Channel: %d(%d)\n", channel, freq); - WL_CONN("Capability: %X\n", notify_capability); - WL_CONN("Beacon interval: %d\n", notify_interval); - WL_CONN("Signal: %d\n", notify_signal); + brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID); + brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq); + brcmf_dbg(CONN, "Capability: %X\n", notify_capability); + brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval); + brcmf_dbg(CONN, "Signal: %d\n", notify_signal); bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)bi->BSSID, 0, notify_capability, notify_interval, notify_ie, @@ -2147,11 +2147,11 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg) bss_list = cfg->bss_list; if (bss_list->count != 0 && bss_list->version != BRCMF_BSS_INFO_VERSION) { - WL_ERR("Version %d != WL_BSS_INFO_VERSION\n", - bss_list->version); + brcmf_err("Version %d != WL_BSS_INFO_VERSION\n", + bss_list->version); return -EOPNOTSUPP; } - WL_SCAN("scanned AP count (%d)\n", bss_list->count); + brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count); for (i = 0; i < bss_list->count; i++) { bi = next_bss_le(bss_list, bi); err = brcmf_inform_single_bss(cfg, bi); @@ -2179,7 +2179,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg, size_t notify_ielen; s32 notify_signal; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); if (buf == NULL) { @@ -2192,7 +2192,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg, err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX); if (err) { - WL_ERR("WLC_GET_BSS_INFO failed: %d\n", err); + brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err); goto CleanUp; } @@ -2215,10 +2215,10 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg, notify_ielen = le32_to_cpu(bi->ie_length); notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; - WL_CONN("channel: %d(%d)\n", channel, freq); - WL_CONN("capability: %X\n", notify_capability); - WL_CONN("beacon interval: %d\n", notify_interval); - WL_CONN("signal: %d\n", notify_signal); + brcmf_dbg(CONN, "channel: %d(%d)\n", channel, freq); + brcmf_dbg(CONN, "capability: %X\n", notify_capability); + brcmf_dbg(CONN, "beacon interval: %d\n", notify_interval); + brcmf_dbg(CONN, "signal: %d\n", notify_signal); bss = cfg80211_inform_bss(wiphy, notify_channel, bssid, 0, notify_capability, notify_interval, @@ -2235,7 +2235,7 @@ CleanUp: kfree(buf); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -2326,7 +2326,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg) u8 *ie; s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (brcmf_is_ibssmode(ifp->vif)) return err; @@ -2336,7 +2336,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg) err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, cfg->extra_buf, WL_EXTRA_BUF_MAX); if (err) { - WL_ERR("Could not get bss info %d\n", err); + brcmf_err("Could not get bss info %d\n", err); goto update_bss_info_out; } @@ -2361,14 +2361,14 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg) u32 var; err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var); if (err) { - WL_ERR("wl dtim_assoc failed (%d)\n", err); + brcmf_err("wl dtim_assoc failed (%d)\n", err); goto update_bss_info_out; } dtim_period = (u8)var; } update_bss_info_out: - WL_TRACE("Exit"); + brcmf_dbg(TRACE, "Exit"); return err; } @@ -2401,7 +2401,7 @@ static void brcmf_escan_timeout(unsigned long data) (struct brcmf_cfg80211_info *)data; if (cfg->scan_request) { - WL_ERR("timer expired\n"); + brcmf_err("timer expired\n"); schedule_work(&cfg->escan_timeout_work); } } @@ -2457,26 +2457,26 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, status = e->status; if (!ndev || !test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - WL_ERR("scan not ready ndev %p drv_status %x\n", ndev, - !test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)); + brcmf_err("scan not ready ndev %p drv_status %x\n", ndev, + !test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)); return -EPERM; } if (status == BRCMF_E_STATUS_PARTIAL) { - WL_SCAN("ESCAN Partial result\n"); + brcmf_dbg(SCAN, "ESCAN Partial result\n"); escan_result_le = (struct brcmf_escan_result_le *) data; if (!escan_result_le) { - WL_ERR("Invalid escan result (NULL pointer)\n"); + brcmf_err("Invalid escan result (NULL pointer)\n"); goto exit; } if (!cfg->scan_request) { - WL_SCAN("result without cfg80211 request\n"); + brcmf_dbg(SCAN, "result without cfg80211 request\n"); goto exit; } if (le16_to_cpu(escan_result_le->bss_count) != 1) { - WL_ERR("Invalid bss_count %d: ignoring\n", - escan_result_le->bss_count); + brcmf_err("Invalid bss_count %d: ignoring\n", + escan_result_le->bss_count); goto exit; } bss_info_le = &escan_result_le->bss_info_le; @@ -2484,8 +2484,8 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, bi_length = le32_to_cpu(bss_info_le->length); if (bi_length != (le32_to_cpu(escan_result_le->buflen) - WL_ESCAN_RESULTS_FIXED_SIZE)) { - WL_ERR("Invalid bss_info length %d: ignoring\n", - bi_length); + brcmf_err("Invalid bss_info length %d: ignoring\n", + bi_length); goto exit; } @@ -2493,7 +2493,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, BIT(NL80211_IFTYPE_ADHOC))) { if (le16_to_cpu(bss_info_le->capability) & WLAN_CAPABILITY_IBSS) { - WL_ERR("Ignoring IBSS result\n"); + brcmf_err("Ignoring IBSS result\n"); goto exit; } } @@ -2501,7 +2501,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, list = (struct brcmf_scan_results *) cfg->escan_info.escan_buf; if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) { - WL_ERR("Buffer is too small: ignoring\n"); + brcmf_err("Buffer is too small: ignoring\n"); goto exit; } @@ -2527,7 +2527,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, brcmf_notify_escan_complete(cfg, ndev, aborted, false); } else - WL_ERR("Unexpected scan result 0x%x\n", status); + brcmf_err("Unexpected scan result 0x%x\n", status); } exit: return err; @@ -2558,7 +2558,7 @@ static __always_inline void brcmf_delay(u32 ms) static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) { - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); return 0; } @@ -2570,7 +2570,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, struct net_device *ndev = cfg_to_ndev(cfg); struct brcmf_cfg80211_vif *vif; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); /* * if the primary net_device is not READY there is nothing @@ -2604,7 +2604,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, brcmf_set_mpc(ndev, 1); exit: - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); /* clear any scanning activity */ cfg->scan_status = 0; return 0; @@ -2619,12 +2619,13 @@ brcmf_update_pmklist(struct net_device *ndev, pmkid_len = le32_to_cpu(pmk_list->pmkids.npmkid); - WL_CONN("No of elements %d\n", pmkid_len); + brcmf_dbg(CONN, "No of elements %d\n", pmkid_len); for (i = 0; i < pmkid_len; i++) { - WL_CONN("PMKID[%d]: %pM =\n", i, - &pmk_list->pmkids.pmkid[i].BSSID); + brcmf_dbg(CONN, "PMKID[%d]: %pM =\n", i, + &pmk_list->pmkids.pmkid[i].BSSID); for (j = 0; j < WLAN_PMKID_LEN; j++) - WL_CONN("%02x\n", pmk_list->pmkids.pmkid[i].PMKID[j]); + brcmf_dbg(CONN, "%02x\n", + pmk_list->pmkids.pmkid[i].PMKID[j]); } if (!err) @@ -2645,7 +2646,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, int i; int pmkid_len; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; @@ -2663,14 +2664,14 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, } else err = -EINVAL; - WL_CONN("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n", - pmkids->pmkid[pmkid_len].BSSID); + brcmf_dbg(CONN, "set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n", + pmkids->pmkid[pmkid_len].BSSID); for (i = 0; i < WLAN_PMKID_LEN; i++) - WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]); + brcmf_dbg(CONN, "%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]); err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -2684,17 +2685,17 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, s32 err = 0; int i, pmkid_len; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETH_ALEN); memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); - WL_CONN("del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n", - &pmkid.pmkid[0].BSSID); + brcmf_dbg(CONN, "del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n", + &pmkid.pmkid[0].BSSID); for (i = 0; i < WLAN_PMKID_LEN; i++) - WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]); + brcmf_dbg(CONN, "%02x\n", pmkid.pmkid[0].PMKID[i]); pmkid_len = le32_to_cpu(cfg->pmk_list->pmkids.npmkid); for (i = 0; i < pmkid_len; i++) @@ -2721,7 +2722,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -2733,14 +2734,14 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev) struct brcmf_if *ifp = netdev_priv(ndev); s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (!check_vif_up(ifp->vif)) return -EIO; memset(cfg->pmk_list, 0, sizeof(*cfg->pmk_list)); err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -2771,10 +2772,10 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp, u32 result_count; u32 status; - WL_SCAN("Enter\n"); + brcmf_dbg(SCAN, "Enter\n"); if (e->event_code == BRCMF_E_PFN_NET_LOST) { - WL_SCAN("PFN NET LOST event. Do Nothing\n"); + brcmf_dbg(SCAN, "PFN NET LOST event. Do Nothing\n"); return 0; } @@ -2787,7 +2788,7 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp, * multiple NET_FOUND events. For now place a warning here. */ WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE); - WL_SCAN("PFN NET FOUND event. count: %d\n", result_count); + brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count); if (result_count > 0) { int i; @@ -2806,13 +2807,14 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp, for (i = 0; i < result_count; i++) { netinfo = &netinfo_start[i]; if (!netinfo) { - WL_ERR("Invalid netinfo ptr. index: %d\n", i); + brcmf_err("Invalid netinfo ptr. index: %d\n", + i); err = -EINVAL; goto out_err; } - WL_SCAN("SSID:%s Channel:%d\n", - netinfo->SSID, netinfo->channel); + brcmf_dbg(SCAN, "SSID:%s Channel:%d\n", + netinfo->SSID, netinfo->channel); memcpy(ssid[i].ssid, netinfo->SSID, netinfo->SSID_len); ssid[i].ssid_len = netinfo->SSID_len; request->n_ssids++; @@ -2849,7 +2851,7 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp, cfg->sched_escan = true; cfg->scan_request = request; } else { - WL_ERR("FALSE PNO Event. (pfn_count == 0)\n"); + brcmf_err("FALSE PNO Event. (pfn_count == 0)\n"); goto out_err; } @@ -2878,7 +2880,7 @@ static int brcmf_dev_pno_clean(struct net_device *ndev) NULL, 0); } if (ret < 0) - WL_ERR("failed code %d\n", ret); + brcmf_err("failed code %d\n", ret); return ret; } @@ -2913,24 +2915,24 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, int i; int ret = 0; - WL_SCAN("Enter n_match_sets:%d n_ssids:%d\n", - request->n_match_sets, request->n_ssids); + brcmf_dbg(SCAN, "Enter n_match_sets:%d n_ssids:%d\n", + request->n_match_sets, request->n_ssids); if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - WL_ERR("Scanning already: status (%lu)\n", cfg->scan_status); + brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status); return -EAGAIN; } if (!request || !request->n_ssids || !request->n_match_sets) { - WL_ERR("Invalid sched scan req!! n_ssids:%d\n", - request ? request->n_ssids : 0); + brcmf_err("Invalid sched scan req!! n_ssids:%d\n", + request ? request->n_ssids : 0); return -EINVAL; } if (request->n_ssids > 0) { for (i = 0; i < request->n_ssids; i++) { /* Active scan req for ssids */ - WL_SCAN(">>> Active scan req for ssid (%s)\n", - request->ssids[i].ssid); + brcmf_dbg(SCAN, ">>> Active scan req for ssid (%s)\n", + request->ssids[i].ssid); /* * match_set ssids is a supert set of n_ssid list, @@ -2943,14 +2945,14 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, /* clean up everything */ ret = brcmf_dev_pno_clean(ndev); if (ret < 0) { - WL_ERR("failed error=%d\n", ret); + brcmf_err("failed error=%d\n", ret); return ret; } /* configure pno */ ret = brcmf_dev_pno_config(ndev); if (ret < 0) { - WL_ERR("PNO setup failed!! ret=%d\n", ret); + brcmf_err("PNO setup failed!! ret=%d\n", ret); return -EINVAL; } @@ -2963,7 +2965,7 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, ssid_len = ssid->ssid_len; if (!ssid_len) { - WL_ERR("skip broadcast ssid\n"); + brcmf_err("skip broadcast ssid\n"); continue; } pfn.auth = cpu_to_le32(WLAN_AUTH_OPEN); @@ -2975,13 +2977,12 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, memcpy(pfn.ssid.SSID, ssid->ssid, ssid_len); ret = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, sizeof(pfn)); - WL_SCAN(">>> PNO filter %s for ssid (%s)\n", - ret == 0 ? "set" : "failed", - ssid->ssid); + brcmf_dbg(SCAN, ">>> PNO filter %s for ssid (%s)\n", + ret == 0 ? "set" : "failed", ssid->ssid); } /* Enable the PNO */ if (brcmf_fil_iovar_int_set(ifp, "pfn", 1) < 0) { - WL_ERR("PNO enable failed!! ret=%d\n", ret); + brcmf_err("PNO enable failed!! ret=%d\n", ret); return -EINVAL; } } else { @@ -2996,7 +2997,7 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy, { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - WL_SCAN("enter\n"); + brcmf_dbg(SCAN, "enter\n"); brcmf_dev_pno_clean(ndev); if (cfg->sched_escan) brcmf_notify_escan_complete(cfg, ndev, true, true); @@ -3012,8 +3013,8 @@ static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) struct sk_buff *reply; int ret; - WL_TRACE("cmd %x set %d buf %p len %d\n", dcmd->cmd, dcmd->set, - dcmd->buf, dcmd->len); + brcmf_dbg(TRACE, "cmd %x set %d buf %p len %d\n", dcmd->cmd, dcmd->set, + dcmd->buf, dcmd->len); if (dcmd->set) ret = brcmf_fil_cmd_data_set(netdev_priv(ndev), dcmd->cmd, @@ -3038,19 +3039,19 @@ static s32 brcmf_configure_opensecurity(struct net_device *ndev, s32 bssidx) /* set auth */ err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0); if (err < 0) { - WL_ERR("auth error %d\n", err); + brcmf_err("auth error %d\n", err); return err; } /* set wsec */ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0); if (err < 0) { - WL_ERR("wsec error %d\n", err); + brcmf_err("wsec error %d\n", err); return err; } /* set upper-layer auth */ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", WPA_AUTH_NONE); if (err < 0) { - WL_ERR("wpa_auth error %d\n", err); + brcmf_err("wpa_auth error %d\n", err); return err; } @@ -3084,7 +3085,7 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, u16 rsn_cap; u32 wme_bss_disable; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (wpa_ie == NULL) goto exit; @@ -3098,13 +3099,13 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, /* check for multicast cipher suite */ if (offset + WPA_IE_MIN_OUI_LEN > len) { err = -EINVAL; - WL_ERR("no multicast cipher suite\n"); + brcmf_err("no multicast cipher suite\n"); goto exit; } if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { err = -EINVAL; - WL_ERR("ivalid OUI\n"); + brcmf_err("ivalid OUI\n"); goto exit; } offset += TLV_OUI_LEN; @@ -3126,7 +3127,7 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, break; default: err = -EINVAL; - WL_ERR("Invalid multi cast cipher info\n"); + brcmf_err("Invalid multi cast cipher info\n"); goto exit; } @@ -3137,13 +3138,13 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, /* Check for unicast suite(s) */ if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { err = -EINVAL; - WL_ERR("no unicast cipher suite\n"); + brcmf_err("no unicast cipher suite\n"); goto exit; } for (i = 0; i < count; i++) { if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { err = -EINVAL; - WL_ERR("ivalid OUI\n"); + brcmf_err("ivalid OUI\n"); goto exit; } offset += TLV_OUI_LEN; @@ -3161,7 +3162,7 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, pval |= AES_ENABLED; break; default: - WL_ERR("Ivalid unicast security info\n"); + brcmf_err("Ivalid unicast security info\n"); } offset++; } @@ -3171,33 +3172,33 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, /* Check for auth key management suite(s) */ if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { err = -EINVAL; - WL_ERR("no auth key mgmt suite\n"); + brcmf_err("no auth key mgmt suite\n"); goto exit; } for (i = 0; i < count; i++) { if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { err = -EINVAL; - WL_ERR("ivalid OUI\n"); + brcmf_err("ivalid OUI\n"); goto exit; } offset += TLV_OUI_LEN; switch (data[offset]) { case RSN_AKM_NONE: - WL_TRACE("RSN_AKM_NONE\n"); + brcmf_dbg(TRACE, "RSN_AKM_NONE\n"); wpa_auth |= WPA_AUTH_NONE; break; case RSN_AKM_UNSPECIFIED: - WL_TRACE("RSN_AKM_UNSPECIFIED\n"); + brcmf_dbg(TRACE, "RSN_AKM_UNSPECIFIED\n"); is_rsn_ie ? (wpa_auth |= WPA2_AUTH_UNSPECIFIED) : (wpa_auth |= WPA_AUTH_UNSPECIFIED); break; case RSN_AKM_PSK: - WL_TRACE("RSN_AKM_PSK\n"); + brcmf_dbg(TRACE, "RSN_AKM_PSK\n"); is_rsn_ie ? (wpa_auth |= WPA2_AUTH_PSK) : (wpa_auth |= WPA_AUTH_PSK); break; default: - WL_ERR("Ivalid key mgmt info\n"); + brcmf_err("Ivalid key mgmt info\n"); } offset++; } @@ -3213,7 +3214,7 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable", wme_bss_disable); if (err < 0) { - WL_ERR("wme_bss_disable error %d\n", err); + brcmf_err("wme_bss_disable error %d\n", err); goto exit; } } @@ -3223,19 +3224,19 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, /* set auth */ err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth); if (err < 0) { - WL_ERR("auth error %d\n", err); + brcmf_err("auth error %d\n", err); goto exit; } /* set wsec */ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); if (err < 0) { - WL_ERR("wsec error %d\n", err); + brcmf_err("wsec error %d\n", err); goto exit; } /* set upper-layer auth */ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth); if (err < 0) { - WL_ERR("wpa_auth error %d\n", err); + brcmf_err("wpa_auth error %d\n", err); goto exit; } @@ -3263,15 +3264,15 @@ brcmf_parse_vndr_ies(const u8 *vndr_ie_buf, u32 vndr_ie_len, vndrie = (struct brcmf_vs_tlv *)ie; /* len should be bigger than OUI length + one */ if (vndrie->len < (VS_IE_FIXED_HDR_LEN - TLV_HDR_LEN + 1)) { - WL_ERR("invalid vndr ie. length is too small %d\n", - vndrie->len); + brcmf_err("invalid vndr ie. length is too small %d\n", + vndrie->len); goto next; } /* if wpa or wme ie, do not add ie */ if (!memcmp(vndrie->oui, (u8 *)WPA_OUI, TLV_OUI_LEN) && ((vndrie->oui_type == WPA_OUI_TYPE) || (vndrie->oui_type == WME_OUI_TYPE))) { - WL_TRACE("Found WPA/WME oui. Do not add it\n"); + brcmf_dbg(TRACE, "Found WPA/WME oui. Do not add it\n"); goto next; } @@ -3284,11 +3285,11 @@ brcmf_parse_vndr_ies(const u8 *vndr_ie_buf, u32 vndr_ie_len, vndr_ies->count++; - WL_TRACE("** OUI %02x %02x %02x, type 0x%02x\n", - parsed_info->vndrie.oui[0], - parsed_info->vndrie.oui[1], - parsed_info->vndrie.oui[2], - parsed_info->vndrie.oui_type); + brcmf_dbg(TRACE, "** OUI %02x %02x %02x, type 0x%02x\n", + parsed_info->vndrie.oui[0], + parsed_info->vndrie.oui[1], + parsed_info->vndrie.oui[2], + parsed_info->vndrie.oui_type); if (vndr_ies->count >= MAX_VNDR_IE_NUMBER) break; @@ -3351,7 +3352,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, ifp = vif->ifp; saved_ie = &vif->saved_ie; - WL_TRACE("bssidx %d, pktflag : 0x%02X\n", ifp->bssidx, pktflag); + brcmf_dbg(TRACE, "bssidx %d, pktflag : 0x%02X\n", ifp->bssidx, pktflag); iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); if (!iovar_ie_buf) return -ENOMEM; @@ -3370,18 +3371,18 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, break; default: err = -EPERM; - WL_ERR("not suitable type\n"); + brcmf_err("not suitable type\n"); goto exit; } } else { err = -EPERM; - WL_ERR("not suitable type\n"); + brcmf_err("not suitable type\n"); goto exit; } if (vndr_ie_len > mgmt_ie_buf_len) { err = -ENOMEM; - WL_ERR("extra IE size too big\n"); + brcmf_err("extra IE size too big\n"); goto exit; } @@ -3401,7 +3402,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, if (parsed_ie_buf_len && (parsed_ie_buf_len == *mgmt_ie_len) && (memcmp(mgmt_ie_buf, curr_ie_buf, parsed_ie_buf_len) == 0)) { - WL_TRACE("Previous mgmt IE equals to current IE\n"); + brcmf_dbg(TRACE, "Previous mgmt IE equals to current IE\n"); goto exit; } @@ -3412,12 +3413,12 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, for (i = 0; i < old_vndr_ies.count; i++) { vndrie_info = &old_vndr_ies.ie_info[i]; - WL_TRACE("DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n", - vndrie_info->vndrie.id, - vndrie_info->vndrie.len, - vndrie_info->vndrie.oui[0], - vndrie_info->vndrie.oui[1], - vndrie_info->vndrie.oui[2]); + brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n", + vndrie_info->vndrie.id, + vndrie_info->vndrie.len, + vndrie_info->vndrie.oui[0], + vndrie_info->vndrie.oui[1], + vndrie_info->vndrie.oui[2]); del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, vndrie_info->ie_ptr, @@ -3442,19 +3443,19 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, /* verify remained buf size before copy data */ if (remained_buf_len < (vndrie_info->vndrie.len + VNDR_IE_VSIE_OFFSET)) { - WL_ERR("no space in mgmt_ie_buf: len left %d", - remained_buf_len); + brcmf_err("no space in mgmt_ie_buf: len left %d", + remained_buf_len); break; } remained_buf_len -= (vndrie_info->ie_len + VNDR_IE_VSIE_OFFSET); - WL_TRACE("ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n", - vndrie_info->vndrie.id, - vndrie_info->vndrie.len, - vndrie_info->vndrie.oui[0], - vndrie_info->vndrie.oui[1], - vndrie_info->vndrie.oui[2]); + brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n", + vndrie_info->vndrie.id, + vndrie_info->vndrie.len, + vndrie_info->vndrie.oui[0], + vndrie_info->vndrie.oui[1], + vndrie_info->vndrie.oui[2]); del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, vndrie_info->ie_ptr, @@ -3474,7 +3475,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf, total_ie_buf_len); if (err) - WL_ERR("vndr ie set error : %d\n", err); + brcmf_err("vndr ie set error : %d\n", err); } exit: @@ -3496,16 +3497,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, struct brcmf_join_params join_params; s32 bssidx = 0; - WL_TRACE("channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", - cfg80211_get_chandef_type(&settings->chandef), - settings->beacon_interval, - settings->dtim_period); - WL_TRACE("ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", - settings->ssid, settings->ssid_len, settings->auth_type, - settings->inactivity_timeout); + brcmf_dbg(TRACE, "channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", + cfg80211_get_chandef_type(&settings->chandef), + settings->beacon_interval, + settings->dtim_period); + brcmf_dbg(TRACE, "ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", + settings->ssid, settings->ssid_len, settings->auth_type, + settings->inactivity_timeout); if (!test_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state)) { - WL_ERR("Not in AP creation mode\n"); + brcmf_err("Not in AP creation mode\n"); return -EPERM; } @@ -3521,7 +3522,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); ssid_le.SSID_len = cpu_to_le32(ssid_ie->len); - WL_TRACE("SSID is (%s) in Head\n", ssid_le.SSID); + brcmf_dbg(TRACE, "SSID is (%s) in Head\n", ssid_le.SSID); } else { memcpy(ssid_le.SSID, settings->ssid, settings->ssid_len); ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len); @@ -3530,17 +3531,17 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, brcmf_set_mpc(ndev, 0); err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); if (err < 0) { - WL_ERR("BRCMF_C_DOWN error %d\n", err); + brcmf_err("BRCMF_C_DOWN error %d\n", err); goto exit; } err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1); if (err < 0) { - WL_ERR("SET INFRA error %d\n", err); + brcmf_err("SET INFRA error %d\n", err); goto exit; } err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1); if (err < 0) { - WL_ERR("setting AP mode failed %d\n", err); + brcmf_err("setting AP mode failed %d\n", err); goto exit; } @@ -3553,7 +3554,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, settings->beacon.tail_len); if ((wpa_ie != NULL || rsn_ie != NULL)) { - WL_TRACE("WPA(2) IE is found\n"); + brcmf_dbg(TRACE, "WPA(2) IE is found\n"); if (wpa_ie != NULL) { /* WPA IE */ err = brcmf_configure_wpaie(ndev, wpa_ie, false); @@ -3567,7 +3568,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, goto exit; } } else { - WL_TRACE("No WPA(2) IEs found\n"); + brcmf_dbg(TRACE, "No WPA(2) IEs found\n"); brcmf_configure_opensecurity(ndev, bssidx); } /* Set Beacon IEs to FW */ @@ -3576,9 +3577,9 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, settings->beacon.tail, settings->beacon.tail_len); if (err) - WL_ERR("Set Beacon IE Failed\n"); + brcmf_err("Set Beacon IE Failed\n"); else - WL_TRACE("Applied Vndr IEs for Beacon\n"); + brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n"); /* Set Probe Response IEs to FW */ err = brcmf_vif_set_mgmt_ie(ndev_to_vif(ndev), @@ -3586,15 +3587,15 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, settings->beacon.proberesp_ies, settings->beacon.proberesp_ies_len); if (err) - WL_ERR("Set Probe Resp IE Failed\n"); + brcmf_err("Set Probe Resp IE Failed\n"); else - WL_TRACE("Applied Vndr IEs for Probe Resp\n"); + brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n"); if (settings->beacon_interval) { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, settings->beacon_interval); if (err < 0) { - WL_ERR("Beacon Interval Set Error, %d\n", err); + brcmf_err("Beacon Interval Set Error, %d\n", err); goto exit; } } @@ -3602,13 +3603,13 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD, settings->dtim_period); if (err < 0) { - WL_ERR("DTIM Interval Set Error, %d\n", err); + brcmf_err("DTIM Interval Set Error, %d\n", err); goto exit; } } err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); if (err < 0) { - WL_ERR("BRCMF_C_UP error (%d)\n", err); + brcmf_err("BRCMF_C_UP error (%d)\n", err); goto exit; } @@ -3619,7 +3620,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, &join_params, sizeof(join_params)); if (err < 0) { - WL_ERR("SET SSID error (%d)\n", err); + brcmf_err("SET SSID error (%d)\n", err); goto exit; } clear_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); @@ -3636,7 +3637,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) struct brcmf_if *ifp = netdev_priv(ndev); s32 err = -EPERM; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (ifp->vif->mode == WL_MODE_AP) { /* Due to most likely deauths outstanding we sleep */ @@ -3644,12 +3645,12 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) msleep(400); err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); if (err < 0) { - WL_ERR("setting AP mode failed %d\n", err); + brcmf_err("setting AP mode failed %d\n", err); goto exit; } err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); if (err < 0) { - WL_ERR("BRCMF_C_UP error %d\n", err); + brcmf_err("BRCMF_C_UP error %d\n", err); goto exit; } brcmf_set_mpc(ndev, 1); @@ -3671,7 +3672,7 @@ brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev, if (!mac) return -EFAULT; - WL_TRACE("Enter %pM\n", mac); + brcmf_dbg(TRACE, "Enter %pM\n", mac); if (!check_vif_up(ifp->vif)) return -EIO; @@ -3681,9 +3682,9 @@ brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev, err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON, &scbval, sizeof(scbval)); if (err) - WL_ERR("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err); + brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -3752,7 +3753,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct brcmf_cfg80211_info)); if (!wiphy) { - WL_ERR("Could not allocate wiphy device\n"); + brcmf_err("Could not allocate wiphy device\n"); return ERR_PTR(-ENOMEM); } set_wiphy_dev(wiphy, phydev); @@ -3779,7 +3780,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) brcmf_wiphy_pno_params(wiphy); err = wiphy_register(wiphy); if (err < 0) { - WL_ERR("Could not register wiphy device (%d)\n", err); + brcmf_err("Could not register wiphy device (%d)\n", err); wiphy_free(wiphy); return ERR_PTR(err); } @@ -3844,7 +3845,7 @@ static bool brcmf_is_linkup(const struct brcmf_event_msg *e) u32 status = e->status; if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) { - WL_CONN("Processing set ssid\n"); + brcmf_dbg(CONN, "Processing set ssid\n"); return true; } @@ -3857,7 +3858,7 @@ static bool brcmf_is_linkdown(const struct brcmf_event_msg *e) u16 flags = e->flags; if (event == BRCMF_E_LINK && (!(flags & BRCMF_EVENT_MSG_LINK))) { - WL_CONN("Processing link down\n"); + brcmf_dbg(CONN, "Processing link down\n"); return true; } return false; @@ -3870,13 +3871,13 @@ static bool brcmf_is_nonetwork(struct brcmf_cfg80211_info *cfg, u32 status = e->status; if (event == BRCMF_E_LINK && status == BRCMF_E_STATUS_NO_NETWORKS) { - WL_CONN("Processing Link %s & no network found\n", - e->flags & BRCMF_EVENT_MSG_LINK ? "up" : "down"); + brcmf_dbg(CONN, "Processing Link %s & no network found\n", + e->flags & BRCMF_EVENT_MSG_LINK ? "up" : "down"); return true; } if (event == BRCMF_E_SET_SSID && status != BRCMF_E_STATUS_SUCCESS) { - WL_CONN("Processing connecting & no network found\n"); + brcmf_dbg(CONN, "Processing connecting & no network found\n"); return true; } @@ -3909,7 +3910,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg) err = brcmf_fil_iovar_data_get(ifp, "assoc_info", cfg->extra_buf, WL_ASSOC_INFO_MAX); if (err) { - WL_ERR("could not get assoc info (%d)\n", err); + brcmf_err("could not get assoc info (%d)\n", err); return err; } assoc_info = @@ -3921,7 +3922,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg) cfg->extra_buf, WL_ASSOC_INFO_MAX); if (err) { - WL_ERR("could not get assoc req (%d)\n", err); + brcmf_err("could not get assoc req (%d)\n", err); return err; } conn_info->req_ie_len = req_len; @@ -3937,7 +3938,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg) cfg->extra_buf, WL_ASSOC_INFO_MAX); if (err) { - WL_ERR("could not get assoc resp (%d)\n", err); + brcmf_err("could not get assoc resp (%d)\n", err); return err; } conn_info->resp_ie_len = resp_len; @@ -3948,8 +3949,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg) conn_info->resp_ie_len = 0; conn_info->resp_ie = NULL; } - WL_CONN("req len (%d) resp len (%d)\n", - conn_info->req_ie_len, conn_info->resp_ie_len); + brcmf_dbg(CONN, "req len (%d) resp len (%d)\n", + conn_info->req_ie_len, conn_info->resp_ie_len); return err; } @@ -3971,7 +3972,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, u32 target_channel; u8 *buf; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); brcmf_get_assoc_ies(cfg); memcpy(profile->bssid, e->addr, ETH_ALEN); @@ -4008,10 +4009,10 @@ done: cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, conn_info->req_ie, conn_info->req_ie_len, conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); - WL_CONN("Report roaming result\n"); + brcmf_dbg(CONN, "Report roaming result\n"); set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -4025,7 +4026,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg, struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); s32 err = 0; - WL_TRACE("Enter\n"); + brcmf_dbg(TRACE, "Enter\n"); if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) { @@ -4046,10 +4047,10 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg, if (completed) set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); - WL_CONN("Report connect result - connection %s\n", - completed ? "succeeded" : "failed"); + brcmf_dbg(CONN, "Report connect result - connection %s\n", + completed ? "succeeded" : "failed"); } - WL_TRACE("Exit\n"); + brcmf_dbg(TRACE, "Exit\n"); return err; } @@ -4066,7 +4067,7 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg, struct station_info sinfo; - WL_CONN("event %d, reason %d\n", event, reason); + brcmf_dbg(CONN, "event %d, reason %d\n", event, reason); memset(&sinfo, 0, sizeof(sinfo)); sinfo.filled = 0; @@ -4074,7 +4075,7 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg, reason == BRCMF_E_STATUS_SUCCESS) { sinfo.filled = STATION_INFO_ASSOC_REQ_IES; if (!data) { - WL_ERR("No IEs present in ASSOC/REASSOC_IND"); + brcmf_err("No IEs present in ASSOC/REASSOC_IND"); return -EINVAL; } sinfo.assoc_req_ies = data; @@ -4104,7 +4105,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, if (ifp->vif->mode == WL_MODE_AP) { err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); } else if (brcmf_is_linkup(e)) { - WL_CONN("Linkup\n"); + brcmf_dbg(CONN, "Linkup\n"); if (brcmf_is_ibssmode(ifp->vif)) { memcpy(profile->bssid, e->addr, ETH_ALEN); wl_inform_ibss(cfg, ndev, e->addr); @@ -4116,7 +4117,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, } else brcmf_bss_connect_done(cfg, ndev, e, true); } else if (brcmf_is_linkdown(e)) { - WL_CONN("Linkdown\n"); + brcmf_dbg(CONN, "Linkdown\n"); if (!brcmf_is_ibssmode(ifp->vif)) { brcmf_bss_connect_done(cfg, ndev, e, false); if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, @@ -4271,10 +4272,10 @@ static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg) brcmf_deinit_priv_mem(cfg); } -struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr) +struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, + struct device *busdev) { struct net_device *ndev = drvr->iflist[0]->ndev; - struct device *busdev = drvr->dev; struct brcmf_cfg80211_info *cfg; struct wiphy *wiphy; struct brcmf_cfg80211_vif *vif; @@ -4282,7 +4283,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr) s32 err = 0; if (!ndev) { - WL_ERR("ndev is invalid\n"); + brcmf_err("ndev is invalid\n"); return NULL; } @@ -4304,7 +4305,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr) err = wl_init_priv(cfg); if (err) { - WL_ERR("Failed to init iwm_priv (%d)\n", err); + brcmf_err("Failed to init iwm_priv (%d)\n", err); goto cfg80211_attach_out; } @@ -4342,7 +4343,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout) if (roamvar) { err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout); if (err) { - WL_ERR("bcn_timeout error (%d)\n", err); + brcmf_err("bcn_timeout error (%d)\n", err); goto dongle_rom_out; } } @@ -4351,10 +4352,10 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout) * Enable/Disable built-in roaming to allow supplicant * to take care of roaming */ - WL_INFO("Internal Roaming = %s\n", roamvar ? "Off" : "On"); + brcmf_dbg(INFO, "Internal Roaming = %s\n", roamvar ? "Off" : "On"); err = brcmf_fil_iovar_int_set(ifp, "roam_off", roamvar); if (err) { - WL_ERR("roam_off error (%d)\n", err); + brcmf_err("roam_off error (%d)\n", err); goto dongle_rom_out; } @@ -4363,7 +4364,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout) err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, (void *)roamtrigger, sizeof(roamtrigger)); if (err) { - WL_ERR("WLC_SET_ROAM_TRIGGER error (%d)\n", err); + brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err); goto dongle_rom_out; } @@ -4372,7 +4373,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout) err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA, (void *)roam_delta, sizeof(roam_delta)); if (err) { - WL_ERR("WLC_SET_ROAM_DELTA error (%d)\n", err); + brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err); goto dongle_rom_out; } @@ -4391,18 +4392,18 @@ brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, scan_assoc_time); if (err) { if (err == -EOPNOTSUPP) - WL_INFO("Scan assoc time is not supported\n"); + brcmf_dbg(INFO, "Scan assoc time is not supported\n"); else - WL_ERR("Scan assoc time error (%d)\n", err); + brcmf_err("Scan assoc time error (%d)\n", err); goto dongle_scantime_out; } err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, scan_unassoc_time); if (err) { if (err == -EOPNOTSUPP) - WL_INFO("Scan unassoc time is not supported\n"); + brcmf_dbg(INFO, "Scan unassoc time is not supported\n"); else - WL_ERR("Scan unassoc time error (%d)\n", err); + brcmf_err("Scan unassoc time error (%d)\n", err); goto dongle_scantime_out; } @@ -4410,9 +4411,9 @@ brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, scan_passive_time); if (err) { if (err == -EOPNOTSUPP) - WL_INFO("Scan passive time is not supported\n"); + brcmf_dbg(INFO, "Scan passive time is not supported\n"); else - WL_ERR("Scan passive time error (%d)\n", err); + brcmf_err("Scan passive time error (%d)\n", err); goto dongle_scantime_out; } @@ -4431,12 +4432,12 @@ static s32 wl_update_wiphybands(struct brcmf_cfg80211_info *cfg) err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_PHYLIST, &phy_list, sizeof(phy_list)); if (err) { - WL_ERR("error (%d)\n", err); + brcmf_err("error (%d)\n", err); return err; } phy = ((char *)&phy_list)[0]; - WL_INFO("%c phy\n", phy); + brcmf_dbg(INFO, "%c phy\n", phy); if (phy == 'n' || phy == 'a') { wiphy = cfg_to_wiphy(cfg); wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n; @@ -4471,8 +4472,8 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) power_mode); if (err) goto default_conf_out; - WL_INFO("power save set to %s\n", - (power_mode ? "enabled" : "disabled")); + brcmf_dbg(INFO, "power save set to %s\n", + (power_mode ? "enabled" : "disabled")); err = brcmf_dongle_roam(ndev, (cfg->roam_on ? 0 : 1), WL_BEACON_TIMEOUT); diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h index d60de187e7d..e4d9cc7a8e6 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h @@ -17,73 +17,6 @@ #ifndef _wl_cfg80211_h_ #define _wl_cfg80211_h_ -#define WL_DBG_NONE 0 -#define WL_DBG_CONN (1 << 5) -#define WL_DBG_SCAN (1 << 4) -#define WL_DBG_TRACE (1 << 3) -#define WL_DBG_INFO (1 << 1) -#define WL_DBG_ERR (1 << 0) -#define WL_DBG_MASK ((WL_DBG_INFO | WL_DBG_ERR | WL_DBG_TRACE) | \ - (WL_DBG_SCAN) | (WL_DBG_CONN)) - -#define WL_ERR(fmt, ...) \ -do { \ - if (brcmf_dbg_level & WL_DBG_ERR) { \ - if (net_ratelimit()) { \ - pr_err("ERROR @%s : " fmt, \ - __func__, ##__VA_ARGS__); \ - } \ - } \ -} while (0) - -#if (defined DEBUG) -#define WL_INFO(fmt, ...) \ -do { \ - if (brcmf_dbg_level & WL_DBG_INFO) { \ - if (net_ratelimit()) { \ - pr_err("INFO @%s : " fmt, \ - __func__, ##__VA_ARGS__); \ - } \ - } \ -} while (0) - -#define WL_TRACE(fmt, ...) \ -do { \ - if (brcmf_dbg_level & WL_DBG_TRACE) { \ - if (net_ratelimit()) { \ - pr_err("TRACE @%s : " fmt, \ - __func__, ##__VA_ARGS__); \ - } \ - } \ -} while (0) - -#define WL_SCAN(fmt, ...) \ -do { \ - if (brcmf_dbg_level & WL_DBG_SCAN) { \ - if (net_ratelimit()) { \ - pr_err("SCAN @%s : " fmt, \ - __func__, ##__VA_ARGS__); \ - } \ - } \ -} while (0) - -#define WL_CONN(fmt, ...) \ -do { \ - if (brcmf_dbg_level & WL_DBG_CONN) { \ - if (net_ratelimit()) { \ - pr_err("CONN @%s : " fmt, \ - __func__, ##__VA_ARGS__); \ - } \ - } \ -} while (0) - -#else /* (defined DEBUG) */ -#define WL_INFO(fmt, args...) -#define WL_TRACE(fmt, args...) -#define WL_SCAN(fmt, args...) -#define WL_CONN(fmt, args...) -#endif /* (defined DEBUG) */ - #define WL_NUM_SCAN_MAX 10 #define WL_NUM_PMKIDS_MAX MAXPMKID #define WL_TLV_INFO_MAX 1024 @@ -450,7 +383,8 @@ brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg) return &cfg->conn_info; } -struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr); +struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, + struct device *busdev); void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); s32 brcmf_cfg80211_up(struct net_device *ndev); s32 brcmf_cfg80211_down(struct net_device *ndev); |