[media] rc-core.h: Surround macro with do {} while (0)
authorJoe Perches <joe@perches.com>
Sun, 21 Aug 2011 22:56:45 +0000 (19:56 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 3 Sep 2011 23:56:22 +0000 (20:56 -0300)
Macros coded with if statements should be do { if... } while (0)
so the macros can be used in other if tests.

Use ##__VA_ARGS__ for variadic macro as well.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
include/media/rc-core.h

index b1f19b77ecd44c570f6d54c4e3018e877aa783f1..b0c494a6907904b9ceb38dac8be868f06b276d5a 100644 (file)
 #include <media/rc-map.h>
 
 extern int rc_core_debug;
-#define IR_dprintk(level, fmt, arg...) if (rc_core_debug >= level) \
-       printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
+#define IR_dprintk(level, fmt, ...)                            \
+do {                                                           \
+       if (rc_core_debug >= level)                             \
+               pr_debug("%s: " fmt, __func__, ##__VA_ARGS__);  \
+} while (0)
 
 enum rc_driver_type {
        RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */