diff options
author | Joe Perches <joe@perches.com> | 2012-01-15 03:38:40 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-24 14:21:13 -0500 |
commit | 1e02382979dd422e3b1bdb45545a0699497e3692 (patch) | |
tree | bd640f0c9c3c42d8773630185df6b828a65de066 /drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |
parent | d6400c29abcd218bcc9be5d09f76e0770e25face (diff) |
brcm80211: Add and use brcmX_dbg_dump_hex
Reduce the number of #ifdef DEBUG uses by
adding a dbg_hex_dump routine which has the
appropriate #ifdef DEBUG test.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 141 |
1 files changed, 49 insertions, 92 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 7157a60c94b2..4ab1023352a2 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -1279,13 +1279,10 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1279 | } | 1279 | } |
1280 | return 0; | 1280 | return 0; |
1281 | } | 1281 | } |
1282 | #ifdef DEBUG | 1282 | |
1283 | if (BRCMF_GLOM_ON()) { | 1283 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), |
1284 | printk(KERN_DEBUG "SUPERFRAME:\n"); | 1284 | pfirst->data, min_t(int, pfirst->len, 48), |
1285 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | 1285 | "SUPERFRAME:\n"); |
1286 | pfirst->data, min_t(int, pfirst->len, 48)); | ||
1287 | } | ||
1288 | #endif | ||
1289 | 1286 | ||
1290 | /* Validate the superframe header */ | 1287 | /* Validate the superframe header */ |
1291 | dptr = (u8 *) (pfirst->data); | 1288 | dptr = (u8 *) (pfirst->data); |
@@ -1362,13 +1359,8 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1362 | check = get_unaligned_le16(dptr + sizeof(u16)); | 1359 | check = get_unaligned_le16(dptr + sizeof(u16)); |
1363 | chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); | 1360 | chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); |
1364 | doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); | 1361 | doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); |
1365 | #ifdef DEBUG | 1362 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), |
1366 | if (BRCMF_GLOM_ON()) { | 1363 | dptr, 32, "subframe:\n"); |
1367 | printk(KERN_DEBUG "subframe:\n"); | ||
1368 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | ||
1369 | dptr, 32); | ||
1370 | } | ||
1371 | #endif | ||
1372 | 1364 | ||
1373 | if ((u16)~(sublen ^ check)) { | 1365 | if ((u16)~(sublen ^ check)) { |
1374 | brcmf_dbg(ERROR, "(subframe %d): HW hdr error: len/check 0x%04x/0x%04x\n", | 1366 | brcmf_dbg(ERROR, "(subframe %d): HW hdr error: len/check 0x%04x/0x%04x\n", |
@@ -1433,13 +1425,8 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1433 | } | 1425 | } |
1434 | rxseq++; | 1426 | rxseq++; |
1435 | 1427 | ||
1436 | #ifdef DEBUG | 1428 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(), |
1437 | if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) { | 1429 | dptr, dlen, "Rx Subframe Data:\n"); |
1438 | printk(KERN_DEBUG "Rx Subframe Data:\n"); | ||
1439 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | ||
1440 | dptr, dlen); | ||
1441 | } | ||
1442 | #endif | ||
1443 | 1430 | ||
1444 | __skb_trim(pfirst, sublen); | 1431 | __skb_trim(pfirst, sublen); |
1445 | skb_pull(pfirst, doff); | 1432 | skb_pull(pfirst, doff); |
@@ -1457,17 +1444,13 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1457 | continue; | 1444 | continue; |
1458 | } | 1445 | } |
1459 | 1446 | ||
1460 | #ifdef DEBUG | 1447 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), |
1461 | if (BRCMF_GLOM_ON()) { | 1448 | pfirst->data, |
1462 | brcmf_dbg(GLOM, "subframe %d to stack, %p (%p/%d) nxt/lnk %p/%p\n", | 1449 | min_t(int, pfirst->len, 32), |
1463 | bus->glom.qlen, pfirst, pfirst->data, | 1450 | "subframe %d to stack, %p (%p/%d) nxt/lnk %p/%p\n", |
1464 | pfirst->len, pfirst->next, | 1451 | bus->glom.qlen, pfirst, pfirst->data, |
1465 | pfirst->prev); | 1452 | pfirst->len, pfirst->next, |
1466 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | 1453 | pfirst->prev); |
1467 | pfirst->data, | ||
1468 | min_t(int, pfirst->len, 32)); | ||
1469 | } | ||
1470 | #endif /* DEBUG */ | ||
1471 | } | 1454 | } |
1472 | /* sent any remaining packets up */ | 1455 | /* sent any remaining packets up */ |
1473 | if (bus->glom.qlen) { | 1456 | if (bus->glom.qlen) { |
@@ -1584,12 +1567,8 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) | |||
1584 | 1567 | ||
1585 | gotpkt: | 1568 | gotpkt: |
1586 | 1569 | ||
1587 | #ifdef DEBUG | 1570 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_CTL_ON(), |
1588 | if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) { | 1571 | bus->rxctl, len, "RxCtrl:\n"); |
1589 | printk(KERN_DEBUG "RxCtrl:\n"); | ||
1590 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, bus->rxctl, len); | ||
1591 | } | ||
1592 | #endif | ||
1593 | 1572 | ||
1594 | /* Point to valid data and indicate its length */ | 1573 | /* Point to valid data and indicate its length */ |
1595 | bus->rxctl += doff; | 1574 | bus->rxctl += doff; |
@@ -1818,17 +1797,13 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished) | |||
1818 | } | 1797 | } |
1819 | bus->tx_max = txmax; | 1798 | bus->tx_max = txmax; |
1820 | 1799 | ||
1821 | #ifdef DEBUG | 1800 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(), |
1822 | if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) { | 1801 | rxbuf, len, "Rx Data:\n"); |
1823 | printk(KERN_DEBUG "Rx Data:\n"); | 1802 | brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() && |
1824 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | 1803 | BRCMF_DATA_ON()) && |
1825 | rxbuf, len); | 1804 | BRCMF_HDRS_ON(), |
1826 | } else if (BRCMF_HDRS_ON()) { | 1805 | bus->rxhdr, SDPCM_HDRLEN, |
1827 | printk(KERN_DEBUG "RxHdr:\n"); | 1806 | "RxHdr:\n"); |
1828 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | ||
1829 | bus->rxhdr, SDPCM_HDRLEN); | ||
1830 | } | ||
1831 | #endif | ||
1832 | 1807 | ||
1833 | if (chan == SDPCM_CONTROL_CHANNEL) { | 1808 | if (chan == SDPCM_CONTROL_CHANNEL) { |
1834 | brcmf_dbg(ERROR, "(nextlen): readahead on control packet %d?\n", | 1809 | brcmf_dbg(ERROR, "(nextlen): readahead on control packet %d?\n", |
@@ -1865,13 +1840,9 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished) | |||
1865 | brcmf_sdbrcm_rxfail(bus, true, true); | 1840 | brcmf_sdbrcm_rxfail(bus, true, true); |
1866 | continue; | 1841 | continue; |
1867 | } | 1842 | } |
1868 | #ifdef DEBUG | 1843 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() || BRCMF_HDRS_ON(), |
1869 | if (BRCMF_BYTES_ON() || BRCMF_HDRS_ON()) { | 1844 | bus->rxhdr, SDPCM_HDRLEN, "RxHdr:\n"); |
1870 | printk(KERN_DEBUG "RxHdr:\n"); | 1845 | |
1871 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | ||
1872 | bus->rxhdr, SDPCM_HDRLEN); | ||
1873 | } | ||
1874 | #endif | ||
1875 | 1846 | ||
1876 | /* Extract hardware header fields */ | 1847 | /* Extract hardware header fields */ |
1877 | len = get_unaligned_le16(bus->rxhdr); | 1848 | len = get_unaligned_le16(bus->rxhdr); |
@@ -2024,13 +1995,8 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished) | |||
2024 | skb_push(pkt, BRCMF_FIRSTREAD); | 1995 | skb_push(pkt, BRCMF_FIRSTREAD); |
2025 | memcpy(pkt->data, bus->rxhdr, BRCMF_FIRSTREAD); | 1996 | memcpy(pkt->data, bus->rxhdr, BRCMF_FIRSTREAD); |
2026 | 1997 | ||
2027 | #ifdef DEBUG | 1998 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(), |
2028 | if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) { | 1999 | pkt->data, len, "Rx Data:\n"); |
2029 | printk(KERN_DEBUG "Rx Data:\n"); | ||
2030 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | ||
2031 | pkt->data, len); | ||
2032 | } | ||
2033 | #endif | ||
2034 | 2000 | ||
2035 | deliver: | 2001 | deliver: |
2036 | /* Save superframe descriptor and allocate packet frame */ | 2002 | /* Save superframe descriptor and allocate packet frame */ |
@@ -2038,14 +2004,9 @@ deliver: | |||
2038 | if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_FRAMETAG_LEN])) { | 2004 | if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_FRAMETAG_LEN])) { |
2039 | brcmf_dbg(GLOM, "glom descriptor, %d bytes:\n", | 2005 | brcmf_dbg(GLOM, "glom descriptor, %d bytes:\n", |
2040 | len); | 2006 | len); |
2041 | #ifdef DEBUG | 2007 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), |
2042 | if (BRCMF_GLOM_ON()) { | 2008 | pkt->data, len, |
2043 | printk(KERN_DEBUG "Glom Data:\n"); | 2009 | "Glom Data:\n"); |
2044 | print_hex_dump_bytes("", | ||
2045 | DUMP_PREFIX_OFFSET, | ||
2046 | pkt->data, len); | ||
2047 | } | ||
2048 | #endif | ||
2049 | __skb_trim(pkt, len); | 2010 | __skb_trim(pkt, len); |
2050 | skb_pull(pkt, SDPCM_HDRLEN); | 2011 | skb_pull(pkt, SDPCM_HDRLEN); |
2051 | bus->glomd = pkt; | 2012 | bus->glomd = pkt; |
@@ -2178,16 +2139,18 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt, | |||
2178 | 2139 | ||
2179 | #ifdef DEBUG | 2140 | #ifdef DEBUG |
2180 | tx_packets[pkt->priority]++; | 2141 | tx_packets[pkt->priority]++; |
2181 | if (BRCMF_BYTES_ON() && | 2142 | |
2182 | (((BRCMF_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) || | 2143 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && |
2183 | (BRCMF_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) { | 2144 | ((BRCMF_CTL_ON() && chan == SDPCM_CONTROL_CHANNEL) || |
2184 | printk(KERN_DEBUG "Tx Frame:\n"); | 2145 | (BRCMF_DATA_ON() && chan != SDPCM_CONTROL_CHANNEL)), |
2185 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, frame, len); | 2146 | frame, len, "Tx Frame:\n"); |
2186 | } else if (BRCMF_HDRS_ON()) { | 2147 | brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() && |
2187 | printk(KERN_DEBUG "TxHdr:\n"); | 2148 | ((BRCMF_CTL_ON() && |
2188 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | 2149 | chan == SDPCM_CONTROL_CHANNEL) || |
2189 | frame, min_t(u16, len, 16)); | 2150 | (BRCMF_DATA_ON() && |
2190 | } | 2151 | chan != SDPCM_CONTROL_CHANNEL))) && |
2152 | BRCMF_HDRS_ON(), | ||
2153 | frame, min_t(u16, len, 16), "TxHdr:\n"); | ||
2191 | #endif | 2154 | #endif |
2192 | 2155 | ||
2193 | /* Raise len to next SDIO block to eliminate tail command */ | 2156 | /* Raise len to next SDIO block to eliminate tail command */ |
@@ -2982,17 +2945,11 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) | |||
2982 | } | 2945 | } |
2983 | 2946 | ||
2984 | if (ret == -1) { | 2947 | if (ret == -1) { |
2985 | #ifdef DEBUG | 2948 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_CTL_ON(), |
2986 | if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) { | 2949 | frame, len, "Tx Frame:\n"); |
2987 | printk(KERN_DEBUG "Tx Frame:\n"); | 2950 | brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() && BRCMF_CTL_ON()) && |
2988 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | 2951 | BRCMF_HDRS_ON(), |
2989 | frame, len); | 2952 | frame, min_t(u16, len, 16), "TxHdr:\n"); |
2990 | } else if (BRCMF_HDRS_ON()) { | ||
2991 | printk(KERN_DEBUG "TxHdr:\n"); | ||
2992 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | ||
2993 | frame, min_t(u16, len, 16)); | ||
2994 | } | ||
2995 | #endif | ||
2996 | 2953 | ||
2997 | do { | 2954 | do { |
2998 | ret = brcmf_tx_frame(bus, frame, len); | 2955 | ret = brcmf_tx_frame(bus, frame, len); |