On Tue, Mar 03, 2009 at 11:00:04AM +0100, Geert Uytterhoeven wrote: > On Mon, Mar 2, 2009 at 23:42, Marcin Slusarz <marcin.slusarz@xxxxxxxxx> wrote: > > --- /dev/null > > +++ b/drivers/char/idle.c > > @@ -0,0 +1,445 @@ > > > +#ifdef DEBUG > > +#define idle_printk(args...) printk(KERN_DEBUG "IDLEDEV: " args) > > +#else > > +#define idle_printk(args...) do {} while (0) > > +#endif > > Please use the standard debug interface, i.e. > > #define pr_fmt(fmt) "IDLEDEV: " fmt > > and use pr_debug() everywhere, to always have printf()-style format checking. Thanks for looking at the patch! And here's a patch implementing your request: --- From: Marcin Slusarz <marcin.slusarz@xxxxxxxxx> Subject: [PATCH] idle: convert idle_printk to pr_debug Signed-off-by: Marcin Slusarz <marcin.slusarz@xxxxxxxxx> --- drivers/char/idle.c | 40 +++++++++++++++++++--------------------- 1 files changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/char/idle.c b/drivers/char/idle.c index 5fe792d..d2b6b2b 100644 --- a/drivers/char/idle.c +++ b/drivers/char/idle.c @@ -13,11 +13,17 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ + +/* these 2 defines must be before include linux/kernel.h */ +/*#define DEBUG*/ +#define pr_fmt(fmt) "IDLEDEV: " fmt + #include <linux/bug.h> #include <linux/device.h> #include <linux/err.h> #include <linux/fs.h> #include <linux/hrtimer.h> +#include <linux/kernel.h> #include <linux/keyboard.h> #include <linux/ktime.h> #include <linux/module.h> @@ -32,14 +38,6 @@ /* TODO: support all input devices */ -/*#define DEBUG*/ - -#ifdef DEBUG -#define idle_printk(args...) printk(KERN_DEBUG "IDLEDEV: " args) -#else -#define idle_printk(args...) do {} while (0) -#endif - /* spinlock protecting all data */ static DEFINE_SPINLOCK(idle_events_lock); @@ -66,7 +64,7 @@ static int idle_kb_event(struct notifier_block *this, { unsigned long flags; - idle_printk("kb_event\n"); + pr_debug("kb_event\n"); spin_lock_irqsave(&idle_events_lock, flags); @@ -124,7 +122,7 @@ static enum hrtimer_restart idle_timer_timeout(struct hrtimer *timer) container_of(timer, struct idle_file_data, timer); unsigned long flags; - idle_printk("timeout\n"); + pr_debug("timeout\n"); spin_lock_irqsave(&idle_events_lock, flags); @@ -147,7 +145,7 @@ static int idle_get_event(struct idle_file_data *d, u8 __user *user_event) bool wakeup; u8 event; - idle_printk("idle_get_event\n"); + pr_debug("idle_get_event\n"); spin_lock_irq(&idle_events_lock); @@ -187,7 +185,7 @@ static int idle_set_timeout(struct idle_file_data *d, u32 secs) if (ktime_compare(timeout, d->timeout) == 0) return -EALREADY; - idle_printk("setting timeout to %u\n", secs); + pr_debug("setting timeout to %u\n", secs); hrtimer_cancel(&d->timer); @@ -204,7 +202,7 @@ static int idle_set_timeout(struct idle_file_data *d, u32 secs) static int idle_remove_timeout(struct idle_file_data *d) { - idle_printk("removing timeout\n"); + pr_debug("removing timeout\n"); hrtimer_cancel(&d->timer); @@ -260,13 +258,13 @@ static unsigned int idle_poll(struct file *f, poll_table *pt) unsigned int mask = POLLOUT | POLLWRNORM; struct idle_file_data *d = f->private_data; - idle_printk("idle_poll\n"); + pr_debug("idle_poll\n"); spin_lock_irq(&idle_events_lock); if (event_available(d)) { mask |= POLLIN | POLLRDNORM; - idle_printk("idle data available\n"); + pr_debug("idle data available\n"); } if (d->waiting_for_wakeup) @@ -296,7 +294,7 @@ static int idle_new_client(void) mutex_lock(&open_counter_mutex); if (open_counter == 0) { - idle_printk("first client connected\n"); + pr_debug("first client connected\n"); last_input_event_time = ktime_get_real(); @@ -344,7 +342,7 @@ static void idle_client_leaving(void) mutex_lock(&open_counter_mutex); if (--open_counter == 0) { - idle_printk("last client disconnected\n"); + pr_debug("last client disconnected\n"); WARN_ON(unregister_keyboard_notifier(&idle_nb)); } @@ -381,11 +379,11 @@ static int __init idle_init(void) { int err = 0; - idle_printk("starting\n"); + pr_debug("starting\n"); idle_major = register_chrdev(0, "idle", &idle_ops); if (idle_major < 0) { - idle_printk("cannot register device\n"); + pr_debug("cannot register device\n"); return idle_major; } @@ -402,7 +400,7 @@ static int __init idle_init(void) goto out_device; } - idle_printk("device major: %d\n", idle_major); + pr_debug("device major: %d\n", idle_major); if (daemon_mode) { err = idle_new_client(); @@ -423,7 +421,7 @@ out_class: static void __exit idle_exit(void) { - idle_printk("exiting\n"); + pr_debug("exiting\n"); if (daemon_mode) idle_client_leaving(); -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html