Skip to content

Commit

Permalink
staging: brcm80211: remove usage of printf (macro) from driver
Browse files Browse the repository at this point in the history
The driver contained several calls to printf which was mapped
to printk using a macro. These have been changed to explicit
call to printk or use an appropropriate macro.

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Brett Rudley <brudley@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Arend van Spriel authored and Greg Kroah-Hartman committed Feb 18, 2011
1 parent 9d2c415 commit 0bef774
Show file tree
Hide file tree
Showing 16 changed files with 229 additions and 180 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool bcmsdh_chipmatch(u16 vendor, u16 device)
#ifdef BCMSDIOH_SPI
/* This is the PciSpiHost. */
if (device == SPIH_FPGA_ID && vendor == VENDOR_BROADCOM) {
printf("Found PCI SPI Host Controller\n");
WL_NONE("Found PCI SPI Host Controller\n");
return true;
}
#endif /* BCMSDIOH_SPI */
Expand Down
36 changes: 30 additions & 6 deletions drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,36 @@
#define __BCMSDH_SDMMC_H__

#ifdef BCMDBG
#define sd_err(x) do { if ((sd_msglevel & SDH_ERROR_VAL) && net_ratelimit()) printf x; } while (0)
#define sd_trace(x) do { if ((sd_msglevel & SDH_TRACE_VAL) && net_ratelimit()) printf x; } while (0)
#define sd_info(x) do { if ((sd_msglevel & SDH_INFO_VAL) && net_ratelimit()) printf x; } while (0)
#define sd_debug(x) do { if ((sd_msglevel & SDH_DEBUG_VAL) && net_ratelimit()) printf x; } while (0)
#define sd_data(x) do { if ((sd_msglevel & SDH_DATA_VAL) && net_ratelimit()) printf x; } while (0)
#define sd_ctrl(x) do { if ((sd_msglevel & SDH_CTRL_VAL) && net_ratelimit()) printf x; } while (0)
#define sd_err(x) \
do { \
if ((sd_msglevel & SDH_ERROR_VAL) && net_ratelimit()) \
printk x; \
} while (0)
#define sd_trace(x) \
do { \
if ((sd_msglevel & SDH_TRACE_VAL) && net_ratelimit()) \
printk x; \
} while (0)
#define sd_info(x) \
do { \
if ((sd_msglevel & SDH_INFO_VAL) && net_ratelimit()) \
printk x; \
} while (0)
#define sd_debug(x) \
do { \
if ((sd_msglevel & SDH_DEBUG_VAL) && net_ratelimit()) \
printk x; \
} while (0)
#define sd_data(x) \
do { \
if ((sd_msglevel & SDH_DATA_VAL) && net_ratelimit()) \
printk x; \
} while (0)
#define sd_ctrl(x) \
do { \
if ((sd_msglevel & SDH_CTRL_VAL) && net_ratelimit()) \
printk x; \
} while (0)
#else
#define sd_err(x)
#define sd_trace(x)
Expand Down
17 changes: 9 additions & 8 deletions drivers/staging/brcm80211/brcmfmac/dhd_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,11 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
memcpy(&hdr, buf, MSGTRACE_HDRLEN);

if (hdr.version != MSGTRACE_VERSION) {
printf
DHD_ERROR(
("\nMACEVENT: %s [unsupported version --> "
"dhd version:%d dongle version:%d]\n",
event_name, MSGTRACE_VERSION, hdr.version);
event_name, MSGTRACE_VERSION, hdr.version)
);
/* Reset datalen to avoid display below */
datalen = 0;
break;
Expand All @@ -753,18 +754,18 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)

if (ntoh32(hdr.discarded_bytes)
|| ntoh32(hdr.discarded_printf)) {
printf
DHD_ERROR(
("\nWLC_E_TRACE: [Discarded traces in dongle -->"
"discarded_bytes %d discarded_printf %d]\n",
ntoh32(hdr.discarded_bytes),
ntoh32(hdr.discarded_printf));
ntoh32(hdr.discarded_printf)));
}

nblost = ntoh32(hdr.seqnum) - seqnum_prev - 1;
if (nblost > 0) {
printf
DHD_ERROR(
("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
ntoh32(hdr.seqnum), nblost);
ntoh32(hdr.seqnum), nblost));
}
seqnum_prev = ntoh32(hdr.seqnum);

Expand All @@ -775,10 +776,10 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
p = (char *)&buf[MSGTRACE_HDRLEN];
while ((s = strstr(p, "\n")) != NULL) {
*s = '\0';
printf("%s\n", p);
printk(KERN_DEBUG"%s\n", p);
p = s + 1;
}
printf("%s\n", p);
printk(KERN_DEBUG "%s\n", p);

/* Reset datalen to avoid display below */
datalen = 0;
Expand Down
28 changes: 14 additions & 14 deletions drivers/staging/brcm80211/brcmfmac/dhd_dbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@

#define DHD_ERROR(args) \
do {if ((dhd_msg_level & DHD_ERROR_VAL) && (net_ratelimit())) \
printf args; } while (0)
printk args; } while (0)
#define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_CTL(args) do {if (dhd_msg_level & DHD_CTL_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_TIMER(args) do {if (dhd_msg_level & DHD_TIMER_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_HDRS(args) do {if (dhd_msg_level & DHD_HDRS_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_BYTES(args) do {if (dhd_msg_level & DHD_BYTES_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_INTR(args) do {if (dhd_msg_level & DHD_INTR_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_GLOM(args) do {if (dhd_msg_level & DHD_GLOM_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_EVENT(args) do {if (dhd_msg_level & DHD_EVENT_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_BTA(args) do {if (dhd_msg_level & DHD_BTA_VAL) \
printf args; } while (0)
printk args; } while (0)
#define DHD_ISCAN(args) do {if (dhd_msg_level & DHD_ISCAN_VAL) \
printf args; } while (0)
printk args; } while (0)

#define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL)
#define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL)
Expand All @@ -63,7 +63,7 @@

#else /* (defined BCMDBG) || (defined DHD_DEBUG) */

#define DHD_ERROR(args) do {if (net_ratelimit()) printf args; } while (0)
#define DHD_ERROR(args) do {if (net_ratelimit()) printk args; } while (0)
#define DHD_TRACE(args)
#define DHD_INFO(args)
#define DHD_DATA(args)
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/brcm80211/brcmfmac/dhd_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
goto fail;
}

printf("%s: Broadcom Dongle Host Driver\n", net->name);
DHD_INFO(("%s: Broadcom Dongle Host Driver\n", net->name));

return 0;

Expand Down Expand Up @@ -2934,7 +2934,7 @@ int write_to_file(dhd_pub_t *dhd, u8 *buf, int size)
/* open file to write */
fp = filp_open("/tmp/mem_dump", O_WRONLY | O_CREAT, 0640);
if (!fp) {
printf("%s: open file error\n", __func__);
DHD_ERROR(("%s: open file error\n", __func__));
ret = -1;
goto exit;
}
Expand Down
20 changes: 10 additions & 10 deletions drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1951,34 +1951,34 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus)
size = bus->ramsize;
buf = kmalloc(size, GFP_ATOMIC);
if (!buf) {
printf("%s: Out of memory (%d bytes)\n", __func__, size);
DHD_ERROR(("%s: Out of memory (%d bytes)\n", __func__, size));
return -1;
}

/* Read mem content */
printf("Dump dongle memory");
printk(KERN_DEBUG "Dump dongle memory");
databuf = buf;
while (size) {
read_size = min(MEMBLOCK, size);
ret = dhdsdio_membytes(bus, false, start, databuf, read_size);
if (ret) {
printf("%s: Error membytes %d\n", __func__, ret);
DHD_ERROR(("%s: Error membytes %d\n", __func__, ret));
if (buf)
kfree(buf);
return -1;
}
printf(".");
printk(".");

/* Decrement size and increment start address */
size -= read_size;
start += read_size;
databuf += read_size;
}
printf("Done\n");
printk(KERN_DEBUG "Done\n");

/* free buf before return !!! */
if (write_to_file(bus->dhd, buf, bus->ramsize)) {
printf("%s: Error writing to files\n", __func__);
DHD_ERROR(("%s: Error writing to files\n", __func__));
return -1;
}

Expand Down Expand Up @@ -2056,7 +2056,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
if (line[n - 1] == '\r')
n--;
line[n] = 0;
printf("CONSOLE: %s\n", line);
printk(KERN_DEBUG "CONSOLE: %s\n", line);
}
}
break2:
Expand Down Expand Up @@ -4500,7 +4500,7 @@ bool dhdsdio_dpc(dhd_bus_t *bus)
if (ret == 0)
bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;

printf("Return_dpc value is : %d\n", ret);
DHD_INFO(("Return_dpc value is : %d\n", ret));
bus->ctrl_frame_stat = false;
dhd_wait_event_wakeup(bus->dhd);
}
Expand Down Expand Up @@ -4640,7 +4640,7 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
/* Display current count if appropriate */
if (bus->pktgen_print && (++bus->pktgen_ptick >= bus->pktgen_print)) {
bus->pktgen_ptick = 0;
printf("%s: send attempts %d rcvd %d\n",
printk(KERN_DEBUG "%s: send attempts %d rcvd %d\n",
__func__, bus->pktgen_sent, bus->pktgen_rcvd);
}

Expand Down Expand Up @@ -5237,7 +5237,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, struct osl_info *osh, void *sdh,
DHD_ERROR(("%s: FAILED to return to SI_ENUM_BASE\n", __func__));

#ifdef DHD_DEBUG
printf("F1 signature read @0x18000000=0x%4x\n",
printk(KERN_DEBUG "F1 signature read @0x18000000=0x%4x\n",
bcmsdh_reg_read(bus->sdh, SI_ENUM_BASE, 4));

#endif /* DHD_DEBUG */
Expand Down
8 changes: 4 additions & 4 deletions drivers/staging/brcm80211/brcmfmac/wl_iw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3444,10 +3444,10 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
wrqu.data.length = sizeof(status) + 1;
extra[0] = WLC_E_ACTION_FRAME_COMPLETE;
memcpy(&extra[1], &status, sizeof(status));
printf("wl_iw_event status %d PacketId %d\n", status,
toto);
printf("WLC_E_ACTION_FRAME_COMPLETE len %d\n",
wrqu.data.length);
WL_TRACE("wl_iw_event status %d PacketId %d\n", status,
toto);
WL_TRACE("WLC_E_ACTION_FRAME_COMPLETE len %d\n",
wrqu.data.length);
}
break;
#endif /* WIRELESS_EXT > 14 */
Expand Down
24 changes: 12 additions & 12 deletions drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs,

/* prepare ucode */
if (wl_request_fw(wl, (struct pci_dev *)btparam)) {
printf("%s: Failed to find firmware usually in %s\n",
KBUILD_MODNAME, "/lib/firmware/brcm");
WL_ERROR("%s: Failed to find firmware usually in %s\n",
KBUILD_MODNAME, "/lib/firmware/brcm");
wl_release_fw(wl);
wl_remove((struct pci_dev *)btparam);
goto fail1;
Expand All @@ -723,8 +723,8 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs,
wl->regsva, wl->bcm_bustype, btparam, &err);
wl_release_fw(wl);
if (!wl->wlc) {
printf("%s: wlc_attach() failed with code %d\n",
KBUILD_MODNAME, err);
WL_ERROR("%s: wlc_attach() failed with code %d\n",
KBUILD_MODNAME, err);
goto fail;
}
wl->pub = wlc_pub(wl->wlc);
Expand Down Expand Up @@ -1705,15 +1705,15 @@ int wl_ucode_init_buf(struct wl_info *wl, void **pbuf, u32 idx)
pdata = wl->fw.fw_bin[i]->data + hdr->offset;
*pbuf = kmalloc(hdr->len, GFP_ATOMIC);
if (*pbuf == NULL) {
printf("fail to alloc %d bytes\n",
hdr->len);
WL_ERROR("fail to alloc %d bytes\n",
hdr->len);
}
bcopy(pdata, *pbuf, hdr->len);
return 0;
}
}
}
printf("ERROR: ucode buf tag:%d can not be found!\n", idx);
WL_ERROR("ERROR: ucode buf tag:%d can not be found!\n", idx);
*pbuf = NULL;
return -1;
}
Expand All @@ -1735,7 +1735,7 @@ int wl_ucode_init_uint(struct wl_info *wl, u32 *data, u32 idx)
}
}
}
printf("ERROR: ucode tag:%d can not be found!\n", idx);
WL_ERROR("ERROR: ucode tag:%d can not be found!\n", idx);
return -1;
}

Expand All @@ -1755,8 +1755,8 @@ static int wl_request_fw(struct wl_info *wl, struct pci_dev *pdev)
WL_NONE("request fw %s\n", fw_name);
status = request_firmware(&wl->fw.fw_bin[i], fw_name, device);
if (status) {
printf("%s: fail to load firmware %s\n",
KBUILD_MODNAME, fw_name);
WL_ERROR("%s: fail to load firmware %s\n",
KBUILD_MODNAME, fw_name);
wl_release_fw(wl);
return status;
}
Expand All @@ -1765,8 +1765,8 @@ static int wl_request_fw(struct wl_info *wl, struct pci_dev *pdev)
UCODE_LOADER_API_VER);
status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device);
if (status) {
printf("%s: fail to load firmware %s\n",
KBUILD_MODNAME, fw_name);
WL_ERROR("%s: fail to load firmware %s\n",
KBUILD_MODNAME, fw_name);
wl_release_fw(wl);
return status;
}
Expand Down
Loading

0 comments on commit 0bef774

Please sign in to comment.