aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-11-28 11:49:02 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-05 09:35:08 -0500
commit88b126af946e7ea789f2a52d9d25aca681f93067 (patch)
tree0991493a6fc53675ca73d971bb92ae77fb628a48
parent04bd4638097c767278fdf12d50fecc8b60194d39 (diff)
ath9k: Add ATH9K_DEBUG configuration option
Make debugging configurable, and add a module parameter to give the debug mask. Add debug.c to hold all debug specific code. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath9k/Kconfig11
-rw-r--r--drivers/net/wireless/ath9k/Makefile2
-rw-r--r--drivers/net/wireless/ath9k/core.h21
-rw-r--r--drivers/net/wireless/ath9k/debug.c40
-rw-r--r--drivers/net/wireless/ath9k/main.c18
5 files changed, 75 insertions, 17 deletions
diff --git a/drivers/net/wireless/ath9k/Kconfig b/drivers/net/wireless/ath9k/Kconfig
index 80a692430413..c43bd321f97f 100644
--- a/drivers/net/wireless/ath9k/Kconfig
+++ b/drivers/net/wireless/ath9k/Kconfig
@@ -9,3 +9,14 @@ config ATH9K
9 Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets. 9 Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
10 10
11 If you choose to build a module, it'll be called ath9k. 11 If you choose to build a module, it'll be called ath9k.
12
13config ATH9K_DEBUG
14 bool "Atheros ath9k debugging"
15 depends on ATH9K
16 ---help---
17 Say Y, if you need ath9k to display debug messages.
18 Pass the debug mask as a module parameter:
19
20 modprobe ath9k debug=0x00002000
21
22 Look in ath9k/core.h for possible debug masks
diff --git a/drivers/net/wireless/ath9k/Makefile b/drivers/net/wireless/ath9k/Makefile
index c741e8d34748..1209d14613ac 100644
--- a/drivers/net/wireless/ath9k/Makefile
+++ b/drivers/net/wireless/ath9k/Makefile
@@ -11,4 +11,6 @@ ath9k-y += hw.o \
11 xmit.o \ 11 xmit.o \
12 rc.o 12 rc.o
13 13
14ath9k-$(CONFIG_ATH9K_DEBUG) += debug.o
15
14obj-$(CONFIG_ATH9K) += ath9k.o 16obj-$(CONFIG_ATH9K) += ath9k.o
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index ae32b2c4ef16..50bef476ba1c 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -105,6 +105,24 @@ enum ATH_DEBUG {
105 105
106#define DBG_DEFAULT (ATH_DBG_FATAL) 106#define DBG_DEFAULT (ATH_DBG_FATAL)
107 107
108#ifdef CONFIG_ATH9K_DEBUG
109
110void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
111void ath9k_init_debug(struct ath_softc *sc);
112
113#else
114
115static inline void DPRINTF(struct ath_softc *sc, int dbg_mask,
116 const char *fmt, ...)
117{
118}
119
120static inline ath9k_init_debug(struct ath_softc *sc)
121{
122}
123
124#endif
125
108struct ath_config { 126struct ath_config {
109 u32 ath_aggr_prot; 127 u32 ath_aggr_prot;
110 u16 txpowlimit; 128 u16 txpowlimit;
@@ -619,7 +637,9 @@ struct ath_softc {
619 u8 sc_myaddr[ETH_ALEN]; 637 u8 sc_myaddr[ETH_ALEN];
620 u8 sc_bssidmask[ETH_ALEN]; 638 u8 sc_bssidmask[ETH_ALEN];
621 639
640#ifdef CONFIG_ATH9K_DEBUG
622 int sc_debug; 641 int sc_debug;
642#endif
623 u32 sc_intrstatus; 643 u32 sc_intrstatus;
624 u32 sc_flags; /* SC_OP_* */ 644 u32 sc_flags; /* SC_OP_* */
625 unsigned int rx_filter; 645 unsigned int rx_filter;
@@ -713,7 +733,6 @@ struct ath_softc {
713 struct ath_ani sc_ani; 733 struct ath_ani sc_ani;
714}; 734};
715 735
716void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
717int ath_reset(struct ath_softc *sc, bool retry_tx); 736int ath_reset(struct ath_softc *sc, bool retry_tx);
718int ath_get_hal_qnum(u16 queue, struct ath_softc *sc); 737int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);
719int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); 738int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
diff --git a/drivers/net/wireless/ath9k/debug.c b/drivers/net/wireless/ath9k/debug.c
new file mode 100644
index 000000000000..31af7cc0fa34
--- /dev/null
+++ b/drivers/net/wireless/ath9k/debug.c
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) 2008 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include "core.h"
18
19static unsigned int ath9k_debug = DBG_DEFAULT;
20module_param_named(debug, ath9k_debug, uint, 0);
21
22void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...)
23{
24 if (!sc)
25 return;
26
27 if (sc->sc_debug & dbg_mask) {
28 va_list args;
29
30 va_start(args, fmt);
31 printk(KERN_DEBUG "ath9k: ");
32 vprintk(fmt, args);
33 va_end(args);
34 }
35}
36
37void ath9k_init_debug(struct ath_softc *sc)
38{
39 sc->sc_debug = ath9k_debug;
40}
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index de059c38467d..9e7045dd7334 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -38,21 +38,6 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = {
38 38
39static void ath_detach(struct ath_softc *sc); 39static void ath_detach(struct ath_softc *sc);
40 40
41void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...)
42{
43 if (!sc)
44 return;
45
46 if (sc->sc_debug & dbg_mask) {
47 va_list args;
48
49 va_start(args, fmt);
50 printk(KERN_DEBUG "ath9k: ");
51 vprintk(fmt, args);
52 va_end(args);
53 }
54}
55
56/* return bus cachesize in 4B word units */ 41/* return bus cachesize in 4B word units */
57 42
58static void bus_read_cachesize(struct ath_softc *sc, int *csz) 43static void bus_read_cachesize(struct ath_softc *sc, int *csz)
@@ -1325,7 +1310,8 @@ static int ath_init(u16 devid, struct ath_softc *sc)
1325 1310
1326 /* XXX: hardware will not be ready until ath_open() being called */ 1311 /* XXX: hardware will not be ready until ath_open() being called */
1327 sc->sc_flags |= SC_OP_INVALID; 1312 sc->sc_flags |= SC_OP_INVALID;
1328 sc->sc_debug = DBG_DEFAULT; 1313
1314 ath9k_init_debug(sc);
1329 1315
1330 spin_lock_init(&sc->sc_resetlock); 1316 spin_lock_init(&sc->sc_resetlock);
1331 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); 1317 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);