Skip to content

Commit

Permalink
staging: easycap: group module parameters handling
Browse files Browse the repository at this point in the history
1. For readability group module parameters handling on one place
2. Introduce kernel config option EASY_DEBUG

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Jan 24, 2011
1 parent 3dbab73 commit 02149cf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
12 changes: 12 additions & 0 deletions drivers/staging/easycap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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]

6 changes: 3 additions & 3 deletions drivers/staging/easycap/easycap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand All @@ -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: " \
Expand All @@ -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))) + \
Expand Down
29 changes: 16 additions & 13 deletions drivers/staging/easycap/easycap_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,26 @@

#include "easycap.h"


MODULE_LICENSE("GPL");
MODULE_AUTHOR("R.M. Thomas <rmthomas@sciolus.org>");
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;

Expand Down Expand Up @@ -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@sciolus.org>");
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");
/*****************************************************************************/

0 comments on commit 02149cf

Please sign in to comment.