From: Tomas Winkler <tomas.winkler@xxxxxxxxx> 1. For readability group module parameters handling on one place 2. Introduce kernel config option EASY_DEBUG Cc: Mike Thomas <rmthomas@xxxxxxxxxxx> Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx> --- drivers/staging/easycap/Kconfig | 12 ++++++++++++ drivers/staging/easycap/easycap.h | 6 +++--- drivers/staging/easycap/easycap_main.c | 29 ++++++++++++++++------------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/drivers/staging/easycap/Kconfig b/drivers/staging/easycap/Kconfig index eaa8a86..4c1ad7e 100644 --- a/drivers/staging/easycap/Kconfig +++ b/drivers/staging/easycap/Kconfig @@ -15,3 +15,15 @@ config EASYCAP To compile this driver as a module, choose M here: the module will be called easycap +config EASYCAP_DEBUG + bool "Enable EasyCAP driver debugging" + depends on EASYCAP + + ---help--- + This option enables debug printouts + + To enable debug, pass the debug level to the debug module + parameter: + + modprobe easycap debug=[0..9] + diff --git a/drivers/staging/easycap/easycap.h b/drivers/staging/easycap/easycap.h index 360653c..8a04bad 100644 --- a/drivers/staging/easycap/easycap.h +++ b/drivers/staging/easycap/easycap.h @@ -668,7 +668,6 @@ unsigned long long int remainder; * IMMEDIATELY OBVIOUS FROM A CASUAL READING OF THE SOURCE CODE. BEWARE. */ /*---------------------------------------------------------------------------*/ -extern int easycap_debug; #define SAY(format, args...) do { \ printk(KERN_DEBUG "easycap:: %s: " \ format, __func__, ##args); \ @@ -678,7 +677,8 @@ extern int easycap_debug; format, peasycap->isdongle, __func__, ##args);\ } while (0) -#if defined(EASYCAP_DEBUG) +#ifdef CONFIG_EASYCAP_DEBUG +extern int easycap_debug; #define JOT(n, format, args...) do { \ if (n <= easycap_debug) { \ printk(KERN_DEBUG "easycap:: %s: " \ @@ -695,7 +695,7 @@ extern int easycap_debug; #else #define JOT(n, format, args...) do {} while (0) #define JOM(n, format, args...) do {} while (0) -#endif /*EASYCAP_DEBUG*/ +#endif /* CONFIG_EASYCAP_DEBUG */ #define MICROSECONDS(X, Y) \ ((1000000*((long long int)(X.tv_sec - Y.tv_sec))) + \ diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c index b15493e..9218410 100644 --- a/drivers/staging/easycap/easycap_main.c +++ b/drivers/staging/easycap/easycap_main.c @@ -30,13 +30,26 @@ #include "easycap.h" + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("R.M. Thomas <rmthomas@xxxxxxxxxxx>"); +MODULE_DESCRIPTION(EASYCAP_DRIVER_DESCRIPTION); +MODULE_VERSION(EASYCAP_DRIVER_VERSION); + +#ifdef CONFIG_EASYCAP_DEBUG int easycap_debug; -static int easycap_bars = 1; -static int easycap_gain = 16; module_param_named(debug, easycap_debug, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Debug level: 0(default),1,2,...,9"); +#endif /* CONFIG_EASYCAP_DEBUG */ + +static int easycap_bars = 1; module_param_named(bars, easycap_bars, int, S_IRUGO | S_IWUSR); -module_param_named(gain, easycap_gain, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(bars, + "Testcard bars on input signal failure: 0=>no, 1=>yes(default)"); +static int easycap_gain = 16; +module_param_named(gain, easycap_gain, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(gain, "Audio gain: 0,...,16(default),...31"); struct easycap_dongle easycapdc60_dongle[DONGLE_MANY]; static struct mutex mutex_dongle; @@ -5113,14 +5126,4 @@ JOT(4, "ends\n"); module_init(easycap_module_init); module_exit(easycap_module_exit); -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("R.M. Thomas <rmthomas@xxxxxxxxxxx>"); -MODULE_DESCRIPTION(EASYCAP_DRIVER_DESCRIPTION); -MODULE_VERSION(EASYCAP_DRIVER_VERSION); -#if defined(EASYCAP_DEBUG) -MODULE_PARM_DESC(debug, "Debug level: 0(default),1,2,...,9"); -#endif /*EASYCAP_DEBUG*/ -MODULE_PARM_DESC(bars, - "Testcard bars on input signal failure: 0=>no, 1=>yes(default)"); -MODULE_PARM_DESC(gain, "Audio gain: 0,...,16(default),...31"); /*****************************************************************************/ -- 1.7.4.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel