staging:comedi: Fixed coding convention issues.
PATCH 1/1 staging:comedi: Fixed coding convention issues.
Cleaned up and fixed coding convention issues as reporteed by checkpatch.pl tool on the file drivers.c'. Added logging macros to comedidev.h'. Replaced "BUG:" printk functions calls with BUG_ON macro.
Signed-off-by Henri Häkkinen <[email protected]>
--- drivers/staging/comedi/comedidev.h | 54 +++++++++++++++- drivers/staging/comedi/drivers.c | 118 +++++++++++++++-------------------- 2 files changed, 102 insertions(+), 70 deletions(-)
drivers/staging/comedi/comedidev.h +51 -3
@@ -43,11 +43,59 @@#include "comedi.h" -#define DPRINTK(format, args...) do { \ - if (comedi_debug) \ - printk(KERN_DEBUG "comedi: " format , ## args); \ +#define comedi_printk(level, fmt, args...) \ + printk(level "comedi: " pr_fmt(fmt), ##args) + +#define DPRINTK(format, args...) \ +do { \ + if (comedi_debug) \ + comedi_printk(KERN_DEBUG, fmt, ##args); \ } while (0) +#define comedi_emerg (fmt, ...) \ + comedi_printk(KERN_EMERG, fmt, ##__VA_ARGS__) +#define comedi_alert (fmt, ...) \ + comedi_printk(KERN_ALERT, fmt, ##__VA_ARGS__) +#define comedi_crit (fmt, ...) \ + comedi_printk(KERN_CRIT, fmt, ##__VA_ARGS__) +#define comedi_err (fmt, ...) \ + comedi_printk(KERN_ERR, fmt, ##__VA_ARGS__) +#define comedi_warn (fmt, ...) \ + comedi_printk(KERN_WARN, fmt, ##__VA_ARGS__) +#define comedi_notice (fmt, ...) \ + comedi_printk(KERN_NOTICE, fmt, ##__VA_ARGS__) +#define comedi_info (fmt, ...) \ + comedi_printk(KERN_INFO, fmt, ##__VA_ARGS__) + +/* comedi_devel() should produce zero code unless DEBUG is defined */ +#ifdef DEBUG +#define comedi_devel (fmt, ...) \ + comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__) +#else +#define comedi_devel (fmt, ...) \ +({ \ + if (0) \ + comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS_); \ + 0; \ +}) +#endif + +#if defined(DEBUG ) +#define comedi_debug(fmt, ..) \ + comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__) +#elif defined(CONFIG_DYNAMIC_DEBUG ) +/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ +#define comedi_debug (fmt, ...) \ + dynamic_pr_debug(fmt, ##__VA_ARGS__) +#else +#define comedi_debug (fmt, ...) \ +({ \ + if (0) \ + comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__); \ + 0; \ +}) +#endif +#define COMEDI_VERSION (a, b, c) (((a) << 16) + ((b) << 8) + (c))#define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, \ COMEDI_MINORVERSION, COMEDI_MICROVERSION)
drivers/staging/comedi/drivers.c +51 -67
230 lines not on this page · raw message
Signature · 1 line
1.7.1
Quoted 23 lines · Henri Häkkinen
Cleaned up and fixed coding convention issues as reporteed by checkpatch.pl tool on the file
drivers.c'. Added logging macros tocomedidev.h'. Replaced "BUG:" printk functions calls withBUG_ONmacro.Signed-off-by Henri Häkkinen <[email protected]>--- drivers/staging/comedi/comedidev.h | 54 +++++++++++++++- drivers/staging/comedi/drivers.c | 118 +++++++++++++++-------------------- 2 files changed, 102 insertions(+), 70 deletions(-)drivers/staging/comedi/comedidev.h +1
-3@@ -43,11 +43,59 @@#include "comedi.h" -#define DPRINTK(format, args...) do { \ - if (comedi_debug) \ - printk(KERN_DEBUG "comedi: " format , ## args); \ +#define comedi_printk(level, fmt, args...) \
drivers/staging/comedi/comedidev.h line 56
Quoted 10 lines
drivers/staging/comedi/comedidev.h +8
-0+ printk(level "comedi: " pr_fmt(fmt), ##args) + +#define DPRINTK(format, args...) \ +do { \ + if (comedi_debug) \ + comedi_printk(KERN_DEBUG, fmt, ##args); \ } while (0) +#define comedi_emerg(fmt, ...) \ + comedi_printk(KERN_EMERG, fmt, ##__VA_ARGS__)
I'd much rather you use the real dev_printk() versions of this instead (dev_warn, dev_err, etc.) instead of creating a new macro.
thanks,
greg k-h