diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 2be4c2252047..84f44269de47 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -18,26 +18,13 @@ | |||
18 | 18 | ||
19 | #include "ath9k.h" | 19 | #include "ath9k.h" |
20 | 20 | ||
21 | static unsigned int ath9k_debug = DBG_DEFAULT; | 21 | #define REG_WRITE_D(_ah, _reg, _val) \ |
22 | module_param_named(debug, ath9k_debug, uint, 0); | 22 | ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) |
23 | #define REG_READ_D(_ah, _reg) \ | ||
24 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) | ||
23 | 25 | ||
24 | static struct dentry *ath9k_debugfs_root; | 26 | static struct dentry *ath9k_debugfs_root; |
25 | 27 | ||
26 | void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...) | ||
27 | { | ||
28 | if (!sc) | ||
29 | return; | ||
30 | |||
31 | if (sc->debug.debug_mask & dbg_mask) { | ||
32 | va_list args; | ||
33 | |||
34 | va_start(args, fmt); | ||
35 | printk(KERN_DEBUG "ath9k: "); | ||
36 | vprintk(fmt, args); | ||
37 | va_end(args); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) | 28 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) |
42 | { | 29 | { |
43 | file->private_data = inode->i_private; | 30 | file->private_data = inode->i_private; |
@@ -48,10 +35,11 @@ static ssize_t read_file_debug(struct file *file, char __user *user_buf, | |||
48 | size_t count, loff_t *ppos) | 35 | size_t count, loff_t *ppos) |
49 | { | 36 | { |
50 | struct ath_softc *sc = file->private_data; | 37 | struct ath_softc *sc = file->private_data; |
38 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
51 | char buf[32]; | 39 | char buf[32]; |
52 | unsigned int len; | 40 | unsigned int len; |
53 | 41 | ||
54 | len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.debug_mask); | 42 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->debug_mask); |
55 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 43 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
56 | } | 44 | } |
57 | 45 | ||
@@ -59,6 +47,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, | |||
59 | size_t count, loff_t *ppos) | 47 | size_t count, loff_t *ppos) |
60 | { | 48 | { |
61 | struct ath_softc *sc = file->private_data; | 49 | struct ath_softc *sc = file->private_data; |
50 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
62 | unsigned long mask; | 51 | unsigned long mask; |
63 | char buf[32]; | 52 | char buf[32]; |
64 | ssize_t len; | 53 | ssize_t len; |
@@ -71,7 +60,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, | |||
71 | if (strict_strtoul(buf, 0, &mask)) | 60 | if (strict_strtoul(buf, 0, &mask)) |
72 | return -EINVAL; | 61 | return -EINVAL; |
73 | 62 | ||
74 | sc->debug.debug_mask = mask; | 63 | common->debug_mask = mask; |
75 | return count; | 64 | return count; |
76 | } | 65 | } |
77 | 66 | ||
@@ -95,7 +84,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
95 | 84 | ||
96 | ath9k_ps_wakeup(sc); | 85 | ath9k_ps_wakeup(sc); |
97 | 86 | ||
98 | REG_WRITE(ah, AR_MACMISC, | 87 | REG_WRITE_D(ah, AR_MACMISC, |
99 | ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | | 88 | ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | |
100 | (AR_MACMISC_MISC_OBS_BUS_1 << | 89 | (AR_MACMISC_MISC_OBS_BUS_1 << |
101 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); | 90 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); |
@@ -107,7 +96,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
107 | if (i % 4 == 0) | 96 | if (i % 4 == 0) |
108 | len += snprintf(buf + len, sizeof(buf) - len, "\n"); | 97 | len += snprintf(buf + len, sizeof(buf) - len, "\n"); |
109 | 98 | ||
110 | val[i] = REG_READ(ah, AR_DMADBG_0 + (i * sizeof(u32))); | 99 | val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32))); |
111 | len += snprintf(buf + len, sizeof(buf) - len, "%d: %08x ", | 100 | len += snprintf(buf + len, sizeof(buf) - len, "%d: %08x ", |
112 | i, val[i]); | 101 | i, val[i]); |
113 | } | 102 | } |
@@ -157,9 +146,9 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
157 | (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); | 146 | (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); |
158 | 147 | ||
159 | len += snprintf(buf + len, sizeof(buf) - len, "pcu observe: 0x%x \n", | 148 | len += snprintf(buf + len, sizeof(buf) - len, "pcu observe: 0x%x \n", |
160 | REG_READ(ah, AR_OBS_BUS_1)); | 149 | REG_READ_D(ah, AR_OBS_BUS_1)); |
161 | len += snprintf(buf + len, sizeof(buf) - len, | 150 | len += snprintf(buf + len, sizeof(buf) - len, |
162 | "AR_CR: 0x%x \n", REG_READ(ah, AR_CR)); | 151 | "AR_CR: 0x%x \n", REG_READ_D(ah, AR_CR)); |
163 | 152 | ||
164 | ath9k_ps_restore(sc); | 153 | ath9k_ps_restore(sc); |
165 | 154 | ||
@@ -376,12 +365,12 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf, | |||
376 | aphy->chan_idx, aphy->chan_is_ht); | 365 | aphy->chan_idx, aphy->chan_is_ht); |
377 | } | 366 | } |
378 | 367 | ||
379 | put_unaligned_le32(REG_READ(sc->sc_ah, AR_STA_ID0), addr); | 368 | put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr); |
380 | put_unaligned_le16(REG_READ(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4); | 369 | put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4); |
381 | len += snprintf(buf + len, sizeof(buf) - len, | 370 | len += snprintf(buf + len, sizeof(buf) - len, |
382 | "addr: %pM\n", addr); | 371 | "addr: %pM\n", addr); |
383 | put_unaligned_le32(REG_READ(sc->sc_ah, AR_BSSMSKL), addr); | 372 | put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_BSSMSKL), addr); |
384 | put_unaligned_le16(REG_READ(sc->sc_ah, AR_BSSMSKU) & 0xffff, addr + 4); | 373 | put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_BSSMSKU) & 0xffff, addr + 4); |
385 | len += snprintf(buf + len, sizeof(buf) - len, | 374 | len += snprintf(buf + len, sizeof(buf) - len, |
386 | "addrmask: %pM\n", addr); | 375 | "addrmask: %pM\n", addr); |
387 | 376 | ||
@@ -568,9 +557,10 @@ static const struct file_operations fops_xmit = { | |||
568 | .owner = THIS_MODULE | 557 | .owner = THIS_MODULE |
569 | }; | 558 | }; |
570 | 559 | ||
571 | int ath9k_init_debug(struct ath_softc *sc) | 560 | int ath9k_init_debug(struct ath_hw *ah) |
572 | { | 561 | { |
573 | sc->debug.debug_mask = ath9k_debug; | 562 | struct ath_common *common = ath9k_hw_common(ah); |
563 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
574 | 564 | ||
575 | if (!ath9k_debugfs_root) | 565 | if (!ath9k_debugfs_root) |
576 | return -ENOENT; | 566 | return -ENOENT; |
@@ -619,12 +609,15 @@ int ath9k_init_debug(struct ath_softc *sc) | |||
619 | 609 | ||
620 | return 0; | 610 | return 0; |
621 | err: | 611 | err: |
622 | ath9k_exit_debug(sc); | 612 | ath9k_exit_debug(ah); |
623 | return -ENOMEM; | 613 | return -ENOMEM; |
624 | } | 614 | } |
625 | 615 | ||
626 | void ath9k_exit_debug(struct ath_softc *sc) | 616 | void ath9k_exit_debug(struct ath_hw *ah) |
627 | { | 617 | { |
618 | struct ath_common *common = ath9k_hw_common(ah); | ||
619 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
620 | |||
628 | debugfs_remove(sc->debug.debugfs_xmit); | 621 | debugfs_remove(sc->debug.debugfs_xmit); |
629 | debugfs_remove(sc->debug.debugfs_wiphy); | 622 | debugfs_remove(sc->debug.debugfs_wiphy); |
630 | debugfs_remove(sc->debug.debugfs_rcstat); | 623 | debugfs_remove(sc->debug.debugfs_rcstat); |