diff options
-rw-r--r-- | drivers/net/wimax/i2400m/driver.c | 10 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/sdio.c | 10 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/usb.c | 9 | ||||
-rw-r--r-- | include/linux/wimax/debug.h | 72 | ||||
-rw-r--r-- | net/wimax/stack.c | 11 |
5 files changed, 112 insertions, 0 deletions
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c index 7ba00de5dd9b..e3b2c246cad7 100644 --- a/drivers/net/wimax/i2400m/driver.c +++ b/drivers/net/wimax/i2400m/driver.c | |||
@@ -90,6 +90,14 @@ MODULE_PARM_DESC(power_save_disabled, | |||
90 | "False by default (so the device is told to do power " | 90 | "False by default (so the device is told to do power " |
91 | "saving)."); | 91 | "saving)."); |
92 | 92 | ||
93 | static char i2400m_debug_params[128]; | ||
94 | module_param_string(debug, i2400m_debug_params, sizeof(i2400m_debug_params), | ||
95 | 0644); | ||
96 | MODULE_PARM_DESC(debug, | ||
97 | "String of space-separated NAME:VALUE pairs, where NAMEs " | ||
98 | "are the different debug submodules and VALUE are the " | ||
99 | "initial debug value to set."); | ||
100 | |||
93 | /** | 101 | /** |
94 | * i2400m_queue_work - schedule work on a i2400m's queue | 102 | * i2400m_queue_work - schedule work on a i2400m's queue |
95 | * | 103 | * |
@@ -794,6 +802,8 @@ size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL); | |||
794 | static | 802 | static |
795 | int __init i2400m_driver_init(void) | 803 | int __init i2400m_driver_init(void) |
796 | { | 804 | { |
805 | d_parse_params(D_LEVEL, D_LEVEL_SIZE, i2400m_debug_params, | ||
806 | "i2400m.debug"); | ||
797 | return 0; | 807 | return 0; |
798 | } | 808 | } |
799 | module_init(i2400m_driver_init); | 809 | module_init(i2400m_driver_init); |
diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c index 7c1b843b63e9..2d2cc5ac6d86 100644 --- a/drivers/net/wimax/i2400m/sdio.c +++ b/drivers/net/wimax/i2400m/sdio.c | |||
@@ -71,6 +71,14 @@ | |||
71 | static int ioe_timeout = 2; | 71 | static int ioe_timeout = 2; |
72 | module_param(ioe_timeout, int, 0); | 72 | module_param(ioe_timeout, int, 0); |
73 | 73 | ||
74 | static char i2400ms_debug_params[128]; | ||
75 | module_param_string(debug, i2400ms_debug_params, sizeof(i2400ms_debug_params), | ||
76 | 0644); | ||
77 | MODULE_PARM_DESC(debug, | ||
78 | "String of space-separated NAME:VALUE pairs, where NAMEs " | ||
79 | "are the different debug submodules and VALUE are the " | ||
80 | "initial debug value to set."); | ||
81 | |||
74 | /* Our firmware file name list */ | 82 | /* Our firmware file name list */ |
75 | static const char *i2400ms_bus_fw_names[] = { | 83 | static const char *i2400ms_bus_fw_names[] = { |
76 | #define I2400MS_FW_FILE_NAME "i2400m-fw-sdio-1.3.sbcf" | 84 | #define I2400MS_FW_FILE_NAME "i2400m-fw-sdio-1.3.sbcf" |
@@ -559,6 +567,8 @@ struct sdio_driver i2400m_sdio_driver = { | |||
559 | static | 567 | static |
560 | int __init i2400ms_driver_init(void) | 568 | int __init i2400ms_driver_init(void) |
561 | { | 569 | { |
570 | d_parse_params(D_LEVEL, D_LEVEL_SIZE, i2400ms_debug_params, | ||
571 | "i2400m_sdio.debug"); | ||
562 | return sdio_register_driver(&i2400m_sdio_driver); | 572 | return sdio_register_driver(&i2400m_sdio_driver); |
563 | } | 573 | } |
564 | module_init(i2400ms_driver_init); | 574 | module_init(i2400ms_driver_init); |
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index a5879e21bbf3..063422290a43 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -71,6 +71,13 @@ | |||
71 | #define D_SUBMODULE usb | 71 | #define D_SUBMODULE usb |
72 | #include "usb-debug-levels.h" | 72 | #include "usb-debug-levels.h" |
73 | 73 | ||
74 | static char i2400mu_debug_params[128]; | ||
75 | module_param_string(debug, i2400mu_debug_params, sizeof(i2400mu_debug_params), | ||
76 | 0644); | ||
77 | MODULE_PARM_DESC(debug, | ||
78 | "String of space-separated NAME:VALUE pairs, where NAMEs " | ||
79 | "are the different debug submodules and VALUE are the " | ||
80 | "initial debug value to set."); | ||
74 | 81 | ||
75 | /* Our firmware file name */ | 82 | /* Our firmware file name */ |
76 | static const char *i2400mu_bus_fw_names[] = { | 83 | static const char *i2400mu_bus_fw_names[] = { |
@@ -633,6 +640,8 @@ struct usb_driver i2400mu_driver = { | |||
633 | static | 640 | static |
634 | int __init i2400mu_driver_init(void) | 641 | int __init i2400mu_driver_init(void) |
635 | { | 642 | { |
643 | d_parse_params(D_LEVEL, D_LEVEL_SIZE, i2400mu_debug_params, | ||
644 | "i2400m_usb.debug"); | ||
636 | return usb_register(&i2400mu_driver); | 645 | return usb_register(&i2400mu_driver); |
637 | } | 646 | } |
638 | module_init(i2400mu_driver_init); | 647 | module_init(i2400mu_driver_init); |
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h index c703e0340423..db8096e88533 100644 --- a/include/linux/wimax/debug.h +++ b/include/linux/wimax/debug.h | |||
@@ -450,4 +450,76 @@ do { \ | |||
450 | }) | 450 | }) |
451 | 451 | ||
452 | 452 | ||
453 | static inline | ||
454 | void d_submodule_set(struct d_level *d_level, size_t d_level_size, | ||
455 | const char *submodule, u8 level, const char *tag) | ||
456 | { | ||
457 | struct d_level *itr, *top; | ||
458 | int index = -1; | ||
459 | |||
460 | for (itr = d_level, top = itr + d_level_size; itr < top; itr++) { | ||
461 | index++; | ||
462 | if (itr->name == NULL) { | ||
463 | printk(KERN_ERR "%s: itr->name NULL?? (%p, #%d)\n", | ||
464 | tag, itr, index); | ||
465 | continue; | ||
466 | } | ||
467 | if (!strcmp(itr->name, submodule)) { | ||
468 | itr->level = level; | ||
469 | return; | ||
470 | } | ||
471 | } | ||
472 | printk(KERN_ERR "%s: unknown submodule %s\n", tag, submodule); | ||
473 | } | ||
474 | |||
475 | |||
476 | /** | ||
477 | * d_parse_params - Parse a string with debug parameters from the | ||
478 | * command line | ||
479 | * | ||
480 | * @d_level: level structure (D_LEVEL) | ||
481 | * @d_level_size: number of items in the level structure | ||
482 | * (D_LEVEL_SIZE). | ||
483 | * @_params: string with the parameters; this is a space (not tab!) | ||
484 | * separated list of NAME:VALUE, where value is the debug level | ||
485 | * and NAME is the name of the submodule. | ||
486 | * @tag: string for error messages (example: MODULE.ARGNAME). | ||
487 | */ | ||
488 | static inline | ||
489 | void d_parse_params(struct d_level *d_level, size_t d_level_size, | ||
490 | const char *_params, const char *tag) | ||
491 | { | ||
492 | char submodule[130], *params, *params_orig, *token, *colon; | ||
493 | unsigned level, tokens; | ||
494 | |||
495 | if (_params == NULL) | ||
496 | return; | ||
497 | params_orig = kstrdup(_params, GFP_KERNEL); | ||
498 | params = params_orig; | ||
499 | while (1) { | ||
500 | token = strsep(¶ms, " "); | ||
501 | if (token == NULL) | ||
502 | break; | ||
503 | if (*token == '\0') /* eat joint spaces */ | ||
504 | continue; | ||
505 | /* kernel's sscanf %s eats until whitespace, so we | ||
506 | * replace : by \n so it doesn't get eaten later by | ||
507 | * strsep */ | ||
508 | colon = strchr(token, ':'); | ||
509 | if (colon != NULL) | ||
510 | *colon = '\n'; | ||
511 | tokens = sscanf(token, "%s\n%u", submodule, &level); | ||
512 | if (colon != NULL) | ||
513 | *colon = ':'; /* set back, for error messages */ | ||
514 | if (tokens == 2) | ||
515 | d_submodule_set(d_level, d_level_size, | ||
516 | submodule, level, tag); | ||
517 | else | ||
518 | printk(KERN_ERR "%s: can't parse '%s' as a " | ||
519 | "SUBMODULE:LEVEL (%d tokens)\n", | ||
520 | tag, token, tokens); | ||
521 | } | ||
522 | kfree(params_orig); | ||
523 | } | ||
524 | |||
453 | #endif /* #ifndef __debug__h__ */ | 525 | #endif /* #ifndef __debug__h__ */ |
diff --git a/net/wimax/stack.c b/net/wimax/stack.c index 79fb7d7c640f..c8866412f830 100644 --- a/net/wimax/stack.c +++ b/net/wimax/stack.c | |||
@@ -60,6 +60,14 @@ | |||
60 | #define D_SUBMODULE stack | 60 | #define D_SUBMODULE stack |
61 | #include "debug-levels.h" | 61 | #include "debug-levels.h" |
62 | 62 | ||
63 | static char wimax_debug_params[128]; | ||
64 | module_param_string(debug, wimax_debug_params, sizeof(wimax_debug_params), | ||
65 | 0644); | ||
66 | MODULE_PARM_DESC(debug, | ||
67 | "String of space-separated NAME:VALUE pairs, where NAMEs " | ||
68 | "are the different debug submodules and VALUE are the " | ||
69 | "initial debug value to set."); | ||
70 | |||
63 | /* | 71 | /* |
64 | * Authoritative source for the RE_STATE_CHANGE attribute policy | 72 | * Authoritative source for the RE_STATE_CHANGE attribute policy |
65 | * | 73 | * |
@@ -562,6 +570,9 @@ int __init wimax_subsys_init(void) | |||
562 | int result, cnt; | 570 | int result, cnt; |
563 | 571 | ||
564 | d_fnstart(4, NULL, "()\n"); | 572 | d_fnstart(4, NULL, "()\n"); |
573 | d_parse_params(D_LEVEL, D_LEVEL_SIZE, wimax_debug_params, | ||
574 | "wimax.debug"); | ||
575 | |||
565 | snprintf(wimax_gnl_family.name, sizeof(wimax_gnl_family.name), | 576 | snprintf(wimax_gnl_family.name, sizeof(wimax_gnl_family.name), |
566 | "WiMAX"); | 577 | "WiMAX"); |
567 | result = genl_register_family(&wimax_gnl_family); | 578 | result = genl_register_family(&wimax_gnl_family); |