diff options
author | Eliad Peller <eliad@wizery.com> | 2010-12-12 05:15:35 -0500 |
---|---|---|
committer | Luciano Coelho <luciano.coelho@nokia.com> | 2010-12-15 08:41:36 -0500 |
commit | 17c1755c24d83f9fd0509b64c76cc43fc60cc642 (patch) | |
tree | 15d4287053529b89f65a7ef75041880efad180c1 /drivers | |
parent | ea559b460509b241cc1a3f36eebe0b2b634b3cf2 (diff) |
wl12xx: allow runtime changing of debug_level
Currently, the debug level is set in compilation time (by the DEBUG_LEVEL
const). This method has the advantage of compiling only the relevant
messages, while optimizing out the unused ones.
In order to allow runtime control over the debug_level, while optimizing
out messages when debug messages are not needed, we combine some methods:
1. use dynamic_debug (pr_debug) rather then printk.
2. add debug_level module param in order to set debug level during insmod.
3. add debug_level sysfs file in order to allow dynamic control over the
debug level.
Since patches for pr_debug_hex_dump() implementation haven't been applied yet,
we are still temporarly using print_hex_dump().
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/wl12xx/debugfs.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl12xx.h | 19 |
3 files changed, 20 insertions, 9 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index 8106a6c8a1ba..c2cd58074372 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -401,6 +401,11 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl) | |||
401 | 401 | ||
402 | DEBUGFS_ADD(gpio_power, wl->rootdir); | 402 | DEBUGFS_ADD(gpio_power, wl->rootdir); |
403 | 403 | ||
404 | entry = debugfs_create_x32("debug_level", 0600, wl->rootdir, | ||
405 | &wl12xx_debug_level); | ||
406 | if (!entry || IS_ERR(entry)) | ||
407 | goto err; | ||
408 | |||
404 | return 0; | 409 | return 0; |
405 | 410 | ||
406 | err: | 411 | err: |
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 0865585c8a75..8c50d3b3fabb 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -2833,6 +2833,11 @@ int wl1271_free_hw(struct wl1271 *wl) | |||
2833 | } | 2833 | } |
2834 | EXPORT_SYMBOL_GPL(wl1271_free_hw); | 2834 | EXPORT_SYMBOL_GPL(wl1271_free_hw); |
2835 | 2835 | ||
2836 | u32 wl12xx_debug_level; | ||
2837 | EXPORT_SYMBOL_GPL(wl12xx_debug_level); | ||
2838 | module_param_named(debug_level, wl12xx_debug_level, uint, DEBUG_NONE); | ||
2839 | MODULE_PARM_DESC(debug_level, "wl12xx debugging level"); | ||
2840 | |||
2836 | MODULE_LICENSE("GPL"); | 2841 | MODULE_LICENSE("GPL"); |
2837 | MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>"); | 2842 | MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>"); |
2838 | MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); | 2843 | MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); |
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h index e904c72e8c8f..07c2297b89a2 100644 --- a/drivers/net/wireless/wl12xx/wl12xx.h +++ b/drivers/net/wireless/wl12xx/wl12xx.h | |||
@@ -60,31 +60,32 @@ enum { | |||
60 | DEBUG_ALL = ~0, | 60 | DEBUG_ALL = ~0, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | #define DEBUG_LEVEL (DEBUG_NONE) | 63 | extern u32 wl12xx_debug_level; |
64 | 64 | ||
65 | #define DEBUG_DUMP_LIMIT 1024 | 65 | #define DEBUG_DUMP_LIMIT 1024 |
66 | 66 | ||
67 | #define wl1271_error(fmt, arg...) \ | 67 | #define wl1271_error(fmt, arg...) \ |
68 | printk(KERN_ERR DRIVER_PREFIX "ERROR " fmt "\n", ##arg) | 68 | pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg) |
69 | 69 | ||
70 | #define wl1271_warning(fmt, arg...) \ | 70 | #define wl1271_warning(fmt, arg...) \ |
71 | printk(KERN_WARNING DRIVER_PREFIX "WARNING " fmt "\n", ##arg) | 71 | pr_warning(DRIVER_PREFIX "WARNING " fmt "\n", ##arg) |
72 | 72 | ||
73 | #define wl1271_notice(fmt, arg...) \ | 73 | #define wl1271_notice(fmt, arg...) \ |
74 | printk(KERN_INFO DRIVER_PREFIX fmt "\n", ##arg) | 74 | pr_info(DRIVER_PREFIX fmt "\n", ##arg) |
75 | 75 | ||
76 | #define wl1271_info(fmt, arg...) \ | 76 | #define wl1271_info(fmt, arg...) \ |
77 | printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg) | 77 | pr_info(DRIVER_PREFIX fmt "\n", ##arg) |
78 | 78 | ||
79 | #define wl1271_debug(level, fmt, arg...) \ | 79 | #define wl1271_debug(level, fmt, arg...) \ |
80 | do { \ | 80 | do { \ |
81 | if (level & DEBUG_LEVEL) \ | 81 | if (level & wl12xx_debug_level) \ |
82 | printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg); \ | 82 | pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \ |
83 | } while (0) | 83 | } while (0) |
84 | 84 | ||
85 | /* TODO: use pr_debug_hex_dump when it will be available */ | ||
85 | #define wl1271_dump(level, prefix, buf, len) \ | 86 | #define wl1271_dump(level, prefix, buf, len) \ |
86 | do { \ | 87 | do { \ |
87 | if (level & DEBUG_LEVEL) \ | 88 | if (level & wl12xx_debug_level) \ |
88 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ | 89 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ |
89 | DUMP_PREFIX_OFFSET, 16, 1, \ | 90 | DUMP_PREFIX_OFFSET, 16, 1, \ |
90 | buf, \ | 91 | buf, \ |
@@ -94,7 +95,7 @@ enum { | |||
94 | 95 | ||
95 | #define wl1271_dump_ascii(level, prefix, buf, len) \ | 96 | #define wl1271_dump_ascii(level, prefix, buf, len) \ |
96 | do { \ | 97 | do { \ |
97 | if (level & DEBUG_LEVEL) \ | 98 | if (level & wl12xx_debug_level) \ |
98 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ | 99 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ |
99 | DUMP_PREFIX_OFFSET, 16, 1, \ | 100 | DUMP_PREFIX_OFFSET, 16, 1, \ |
100 | buf, \ | 101 | buf, \ |