From: Michael Krufky Date: Thu, 19 Jun 2008 23:59:08 +0000 (-0300) Subject: V4L/DVB (8295): sms1xxx: add debug module option, to enable debug messages X-Git-Tag: v2.6.27-rc1~966^2~78 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f14d56a99bddb779f6f7ec028bcd9d142536589e;p=linux-2.6 V4L/DVB (8295): sms1xxx: add debug module option, to enable debug messages All dmesg spam turned off by default, for now. Values for debug: (info=1, adv=2 (or-able) Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 6e2cc3d571..402ed03be4 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -33,6 +33,10 @@ #include "smscoreapi.h" +int sms_debug; +module_param_named(debug, sms_debug, int, 0644); +MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))"); + #define PERROR(fmt, args...)\ sms_err("smscore error: line %d- %s(): " fmt, \ __LINE__, __func__, ## args) diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index ccc7e10129..a21f01f71b 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -414,12 +414,26 @@ void smsdvb_unregister(void); int smsusb_register(void); void smsusb_unregister(void); +/* ------------------------------------------------------------------------ */ + +extern int sms_debug; + +#define DBG_INFO 1 +#define DBG_ADV 2 + +#define sms_printk(kern, fmt, arg...) \ + printk(kern "%s: " fmt "\n", __func__, ##arg) + +#define dprintk(kern, lvl, fmt, arg...) do {\ + if (sms_debug & lvl) \ + sms_printk(kern, fmt, ##arg); } while (0) + #define sms_err(fmt, arg...) \ - printk(KERN_ERR "%s " fmt "\n", __func__, ##arg) + sms_printk(KERN_ERR, "%s " fmt "\n", __func__, ##arg) #define sms_info(fmt, arg...) \ - printk(KERN_INFO "%s " fmt "\n", __func__, ##arg) + dprintk(KERN_INFO, DBG_INFO, fmt, ##arg) #define sms_debug(fmt, arg...) \ - printk(KERN_DEBUG "%s " fmt "\n", __func__, ##arg) + dprintk(KERN_DEBUG, DBG_ADV, fmt, ##arg) #endif /* __smscoreapi_h__ */