aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-01-25 09:49:59 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 16:01:47 -0500
commit060210f938d8aa0b9d795588a2274cd67ba9d6a4 (patch)
tree74eceabb2bb5b945862f49e567bf862d243ff13a /drivers/net/wireless/b43
parent08e87a833f5e77ff33b64c9ac27cb7fb9ecd4a48 (diff)
b43: Dynamically control log verbosity
Dynamically control the log verbosity with a module parameter. This enables us to dynamically enable debugging messages (or disable info, warn, error messages) via module parameter or /sys/module/b43/parameters/verbose. This increases the module size by about 3k. But in practice it reduces the module size for the user, because some distributions ship the b43 module with CONFIG_B43_DEBUG set, which increases the module by about 15k. So with this patch applied, distributions should really _disable_ CONFIG_B43_DEBUG. There is no reason to keep it in a production-release kernel. So we have a net reduction in size by about 12k. This patch also adds a printk of the wireless core revision, so people don't have to enable SSB debugging to get the wireless core revision. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r--drivers/net/wireless/b43/Kconfig14
-rw-r--r--drivers/net/wireless/b43/b43.h5
-rw-r--r--drivers/net/wireless/b43/debugfs.c13
-rw-r--r--drivers/net/wireless/b43/debugfs.h4
-rw-r--r--drivers/net/wireless/b43/main.c25
-rw-r--r--drivers/net/wireless/b43/main.h18
6 files changed, 60 insertions, 19 deletions
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 1f81d36f87c..aab71a70ba7 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -110,10 +110,18 @@ config B43_DEBUG
110 bool "Broadcom 43xx debugging" 110 bool "Broadcom 43xx debugging"
111 depends on B43 111 depends on B43
112 ---help--- 112 ---help---
113 Broadcom 43xx debugging messages. 113 Broadcom 43xx debugging.
114 114
115 Say Y, if you want to find out why the driver does not 115 This adds additional runtime sanity checks and statistics to the driver.
116 work for you. 116 These checks and statistics might me expensive and hurt runtime performance
117 of your system.
118 This also adds the b43 debugfs interface.
119
120 Do not enable this, unless you are debugging the driver.
121
122 Say N, if you are a distributor or user building a release kernel
123 for production use.
124 Only say Y, if you are debugging a problem in the b43 driver sourcecode.
117 125
118config B43_FORCE_PIO 126config B43_FORCE_PIO
119 bool "Force usage of PIO instead of DMA" 127 bool "Force usage of PIO instead of DMA"
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 9e0da212f8c..e9d60f0910b 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -878,12 +878,9 @@ void b43err(struct b43_wl *wl, const char *fmt, ...)
878 __attribute__ ((format(printf, 2, 3))); 878 __attribute__ ((format(printf, 2, 3)));
879void b43warn(struct b43_wl *wl, const char *fmt, ...) 879void b43warn(struct b43_wl *wl, const char *fmt, ...)
880 __attribute__ ((format(printf, 2, 3))); 880 __attribute__ ((format(printf, 2, 3)));
881#if B43_DEBUG
882void b43dbg(struct b43_wl *wl, const char *fmt, ...) 881void b43dbg(struct b43_wl *wl, const char *fmt, ...)
883 __attribute__ ((format(printf, 2, 3))); 882 __attribute__ ((format(printf, 2, 3)));
884#else /* DEBUG */ 883
885# define b43dbg(wl, fmt...) do { /* nothing */ } while (0)
886#endif /* DEBUG */
887 884
888/* A WARN_ON variant that vanishes when b43 debugging is disabled. 885/* A WARN_ON variant that vanishes when b43 debugging is disabled.
889 * This _also_ evaluates the arg with debugging disabled. */ 886 * This _also_ evaluates the arg with debugging disabled. */
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index 7ed0eeeddea..bc2767da46e 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -668,9 +668,18 @@ B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1);
668B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0); 668B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0);
669 669
670 670
671int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) 671bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
672{ 672{
673 return !!(dev->dfsentry && dev->dfsentry->dyn_debug[feature]); 673 bool enabled;
674
675 enabled = (dev->dfsentry && dev->dfsentry->dyn_debug[feature]);
676 if (unlikely(enabled)) {
677 /* Force full debugging messages, if the user enabled
678 * some dynamic debugging feature. */
679 b43_modparam_verbose = B43_VERBOSITY_MAX;
680 }
681
682 return enabled;
674} 683}
675 684
676static void b43_remove_dynamic_debug(struct b43_wldev *dev) 685static void b43_remove_dynamic_debug(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/b43/debugfs.h b/drivers/net/wireless/b43/debugfs.h
index 91a2f2918a2..b9d4de4a979 100644
--- a/drivers/net/wireless/b43/debugfs.h
+++ b/drivers/net/wireless/b43/debugfs.h
@@ -71,7 +71,7 @@ struct b43_dfsentry {
71 struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG]; 71 struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
72}; 72};
73 73
74int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature); 74bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
75 75
76void b43_debugfs_init(void); 76void b43_debugfs_init(void);
77void b43_debugfs_exit(void); 77void b43_debugfs_exit(void);
@@ -82,7 +82,7 @@ void b43_debugfs_log_txstat(struct b43_wldev *dev,
82 82
83#else /* CONFIG_B43_DEBUG */ 83#else /* CONFIG_B43_DEBUG */
84 84
85static inline int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) 85static inline bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
86{ 86{
87 return 0; 87 return 0;
88} 88}
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index e41c10fd31d..dbb8765506e 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de> 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
6 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it> 6 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
7 Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005-2009 Michael Buesch <mb@bu3sch.de>
8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 10
@@ -88,6 +88,10 @@ static int modparam_btcoex = 1;
88module_param_named(btcoex, modparam_btcoex, int, 0444); 88module_param_named(btcoex, modparam_btcoex, int, 0444);
89MODULE_PARM_DESC(btcoex, "Enable Bluetooth coexistance (default on)"); 89MODULE_PARM_DESC(btcoex, "Enable Bluetooth coexistance (default on)");
90 90
91int b43_modparam_verbose = B43_VERBOSITY_DEFAULT;
92module_param_named(verbose, b43_modparam_verbose, int, 0644);
93MODULE_PARM_DESC(verbose, "Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug");
94
91 95
92static const struct ssb_device_id b43_ssb_tbl[] = { 96static const struct ssb_device_id b43_ssb_tbl[] = {
93 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5), 97 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5),
@@ -300,6 +304,8 @@ void b43info(struct b43_wl *wl, const char *fmt, ...)
300{ 304{
301 va_list args; 305 va_list args;
302 306
307 if (b43_modparam_verbose < B43_VERBOSITY_INFO)
308 return;
303 if (!b43_ratelimit(wl)) 309 if (!b43_ratelimit(wl))
304 return; 310 return;
305 va_start(args, fmt); 311 va_start(args, fmt);
@@ -313,6 +319,8 @@ void b43err(struct b43_wl *wl, const char *fmt, ...)
313{ 319{
314 va_list args; 320 va_list args;
315 321
322 if (b43_modparam_verbose < B43_VERBOSITY_ERROR)
323 return;
316 if (!b43_ratelimit(wl)) 324 if (!b43_ratelimit(wl))
317 return; 325 return;
318 va_start(args, fmt); 326 va_start(args, fmt);
@@ -326,6 +334,8 @@ void b43warn(struct b43_wl *wl, const char *fmt, ...)
326{ 334{
327 va_list args; 335 va_list args;
328 336
337 if (b43_modparam_verbose < B43_VERBOSITY_WARN)
338 return;
329 if (!b43_ratelimit(wl)) 339 if (!b43_ratelimit(wl))
330 return; 340 return;
331 va_start(args, fmt); 341 va_start(args, fmt);
@@ -335,18 +345,18 @@ void b43warn(struct b43_wl *wl, const char *fmt, ...)
335 va_end(args); 345 va_end(args);
336} 346}
337 347
338#if B43_DEBUG
339void b43dbg(struct b43_wl *wl, const char *fmt, ...) 348void b43dbg(struct b43_wl *wl, const char *fmt, ...)
340{ 349{
341 va_list args; 350 va_list args;
342 351
352 if (b43_modparam_verbose < B43_VERBOSITY_DEBUG)
353 return;
343 va_start(args, fmt); 354 va_start(args, fmt);
344 printk(KERN_DEBUG "b43-%s debug: ", 355 printk(KERN_DEBUG "b43-%s debug: ",
345 (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan"); 356 (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
346 vprintk(fmt, args); 357 vprintk(fmt, args);
347 va_end(args); 358 va_end(args);
348} 359}
349#endif /* DEBUG */
350 360
351static void b43_ram_write(struct b43_wldev *dev, u16 offset, u32 val) 361static void b43_ram_write(struct b43_wldev *dev, u16 offset, u32 val)
352{ 362{
@@ -3589,9 +3599,7 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3589 u8 algorithm; 3599 u8 algorithm;
3590 u8 index; 3600 u8 index;
3591 int err; 3601 int err;
3592#if B43_DEBUG 3602 static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
3593 static const u8 bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
3594#endif
3595 3603
3596 if (modparam_nohwcrypt) 3604 if (modparam_nohwcrypt)
3597 return -ENOSPC; /* User disabled HW-crypto */ 3605 return -ENOSPC; /* User disabled HW-crypto */
@@ -4744,9 +4752,10 @@ static int b43_wireless_init(struct ssb_device *dev)
4744 INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work); 4752 INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work);
4745 4753
4746 ssb_set_devtypedata(dev, wl); 4754 ssb_set_devtypedata(dev, wl);
4747 b43info(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id); 4755 b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n",
4756 dev->bus->chip_id, dev->id.revision);
4748 err = 0; 4757 err = 0;
4749 out: 4758out:
4750 return err; 4759 return err;
4751} 4760}
4752 4761
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index e6d90f377d9..40abcf5d1b4 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -40,6 +40,24 @@
40 40
41 41
42extern int b43_modparam_qos; 42extern int b43_modparam_qos;
43extern int b43_modparam_verbose;
44
45/* Logmessage verbosity levels. Update the b43_modparam_verbose helptext, if
46 * you add or remove levels. */
47enum b43_verbosity {
48 B43_VERBOSITY_ERROR,
49 B43_VERBOSITY_WARN,
50 B43_VERBOSITY_INFO,
51 B43_VERBOSITY_DEBUG,
52 __B43_VERBOSITY_AFTERLAST, /* keep last */
53
54 B43_VERBOSITY_MAX = __B43_VERBOSITY_AFTERLAST - 1,
55#if B43_DEBUG
56 B43_VERBOSITY_DEFAULT = B43_VERBOSITY_DEBUG,
57#else
58 B43_VERBOSITY_DEFAULT = B43_VERBOSITY_INFO,
59#endif
60};
43 61
44 62
45/* Lightweight function to convert a frequency (in Mhz) to a channel number. */ 63/* Lightweight function to convert a frequency (in Mhz) to a channel number. */