Skip to contentSkip to conversation

panel: Use pr_debug(...) rather than printk(KERN_DEBUG ...)

PATCH In review Toshiaki Yamane 2 participants 5 messages Jul 10, 2012 – Jul 11, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 panel: Use pr_debug(...) rather than printk(KERN_DEBUG ...)

This change is inspired by checkpatch.

---
 drivers/staging/panel/panel.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
drivers/staging/panel/panel.c +4 -5
index 7365089..6f40ec8 100644
@@ -1838,9 +1838,8 @@ static void panel_process_inputs(void)
 	struct logical_input *input;
 
 #if 0
-	printk(KERN_DEBUG
-	       "entering panel_process_inputs with pp=%016Lx & pc=%016Lx\n",
-	       phys_prev, phys_curr);
+	pr_debug("entering panel_process_inputs with pp=%016Lx & pc=%016Lx\n",
+		 phys_prev, phys_curr);
 #endif
 
 	keypressed = 0;
@@ -2003,8 +2002,8 @@ static struct logical_input *panel_bind_key(char *name, char *press,
 	key->fall_time = 1;
 
 #if 0
-	printk(KERN_DEBUG "bind: <%s> : m=%016Lx v=%016Lx\n", name, key->mask,
-	       key->value);
+	pr_debug("bind: <%s> : m=%016Lx v=%016Lx\n", name, key->mask,
+		 key->value);
 #endif
 	strncpy(key->u.kbd.press_str, press, sizeof(key->u.kbd.press_str));
 	strncpy(key->u.kbd.repeat_str, repeat, sizeof(key->u.kbd.repeat_str));
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 2/3 panel: Use pr_info(...) rather than printk(KERN_INFO ...)

This change is inspired by checkpatch.

---
 drivers/staging/panel/panel.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/panel/panel.c +5 -5
index 6f40ec8..7b79f53 100644
@@ -2298,12 +2298,12 @@ int panel_init(void)
 	register_reboot_notifier(&panel_notifier);
 
 	if (pprt)
-		printk(KERN_INFO "Panel driver version " PANEL_VERSION
-		       " registered on parport%d (io=0x%lx).\n", parport,
-		       pprt->port->base);
+		pr_info("Panel driver version " PANEL_VERSION
+			" registered on parport%d (io=0x%lx).\n", parport,
+			pprt->port->base);
 	else
-		printk(KERN_INFO "Panel driver version " PANEL_VERSION
-		       " not yet registered\n");
+		pr_info("Panel driver version " PANEL_VERSION
+			" not yet registered\n");
 	/* tells various subsystems about the fact that initialization
 	   is finished */
 	init_in_progress = 0;
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 3/3 panel: Use pr_err(...) rather than printk(KERN_ERR ...)

In reply to Toshiaki Yamane

This change is inspired by checkpatch.

---
 drivers/staging/panel/panel.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
drivers/staging/panel/panel.c +7 -11
index 7b79f53..d6a7a51 100644
@@ -1987,7 +1987,7 @@ static struct logical_input *panel_bind_key(char *name, char *press,
 
 	key = kzalloc(sizeof(struct logical_input), GFP_KERNEL);
 	if (!key) {
-		printk(KERN_ERR "panel: not enough memory\n");
+		pr_err("panel: not enough memory\n");
 		return NULL;
 	}
 	if (!input_name2mask(name, &key->mask, &key->value, &scan_mask_i,
@@ -2030,7 +2030,7 @@ static struct logical_input *panel_bind_callback(char *name,
 
 	callback = kmalloc(sizeof(struct logical_input), GFP_KERNEL);
 	if (!callback) {
-		printk(KERN_ERR "panel: not enough memory\n");
+		pr_err("panel: not enough memory\n");
 		return NULL;
 	}
 	memset(callback, 0, sizeof(struct logical_input));
@@ -2109,8 +2109,7 @@ static void panel_attach(struct parport *port)
 		return;
 
 	if (pprt) {
-		printk(KERN_ERR
-		       "panel_attach(): port->number=%d parport=%d, "
+		pr_err("panel_attach(): port->number=%d parport=%d, "
 		       "already registered !\n",
 		       port->number, parport);
 		return;
@@ -2128,8 +2127,7 @@ static void panel_attach(struct parport *port)
 	}
 
 	if (parport_claim(pprt)) {
-		printk(KERN_ERR
-		       "Panel: could not claim access to parport%d. "
+		pr_err("Panel: could not claim access to parport%d. "
 		       "Aborting.\n", parport);
 		goto err_unreg_device;
 	}
@@ -2164,8 +2162,7 @@ static void panel_detach(struct parport *port)
 		return;
 
 	if (!pprt) {
-		printk(KERN_ERR
-		       "panel_detach(): port->number=%d parport=%d, "
+		pr_err("panel_detach(): port->number=%d parport=%d, "
 		       "nothing to unregister.\n",
 		       port->number, parport);
 		return;
@@ -2277,8 +2274,7 @@ int panel_init(void)
 	init_in_progress = 1;
 
 	if (parport_register_driver(&panel_driver)) {
-		printk(KERN_ERR
-		       "Panel: could not register with parport. Aborting.\n");
+		pr_err("Panel: could not register with parport. Aborting.\n");
 		return -EIO;
 	}
 
@@ -2290,7 +2286,7 @@ int panel_init(void)
 			pprt = NULL;
 		}
 		parport_unregister_driver(&panel_driver);
-		printk(KERN_ERR "Panel driver version " PANEL_VERSION
+		pr_err("Panel driver version " PANEL_VERSION
 		       " disabled.\n");
 		return -ENODEV;
 	}
Signature · 1 line
1.7.5.4
#4 lore raw
In reply to Toshiaki Yamane
Quoted 1 line · Toshiaki Yamane

This change is inspired by checkpatch.

[]

drivers/staging/panel/panel.c

Quoted 1 line
drivers/staging/panel/panel.c +0 -0

[]

drivers/staging/panel/panel.c static void panel_process_inputs(void) · line 1843

Quoted 10 lines
drivers/staging/panel/panel.c +2 -3
@@ -1838,9 +1838,8 @@ static void panel_process_inputs(void)
 	struct logical_input *input;
 
 #if 0
-	printk(KERN_DEBUG
-	       "entering panel_process_inputs with pp=%016Lx & pc=%016Lx\n",
-	       phys_prev, phys_curr);
+	pr_debug("entering panel_process_inputs with pp=%016Lx & pc=%016Lx\n",
+		 phys_prev, phys_curr);
 #endif

Might as well delete these #if 0 blocks instead

Quoted 13 lines
drivers/staging/panel/panel.c +2 -2
 	keypressed = 0;
@@ -2003,8 +2002,8 @@ static struct logical_input *panel_bind_key(char *name, char *press,
 	key->fall_time = 1;
 
 #if 0
-	printk(KERN_DEBUG "bind: <%s> : m=%016Lx v=%016Lx\n", name, key->mask,
-	       key->value);
+	pr_debug("bind: <%s> : m=%016Lx v=%016Lx\n", name, key->mask,
+		 key->value);
 #endif
 	strncpy(key->u.kbd.press_str, press, sizeof(key->u.kbd.press_str));
 	strncpy(key->u.kbd.repeat_str, repeat, sizeof(key->u.kbd.repeat_str));
#3 lore raw

Re: [PATCH 3/3] panel: Use pr_err(...) rather than printk(KERN_ERR ...)

In reply to Toshiaki Yamane
Quoted 1 line · Toshiaki Yamane

This change is inspired by checkpatch.

[]

Please add
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
before any #include

and remove the "panel: " prefixes from output messages.

drivers/staging/panel/panel.c

Quoted 1 line
drivers/staging/panel/panel.c +0 -0

[]

drivers/staging/panel/panel.c static struct logical_input *panel_bind_key(char *name, char *press, · line 1990

Quoted 6 lines
drivers/staging/panel/panel.c +1 -1
@@ -1987,7 +1987,7 @@ static struct logical_input *panel_bind_key(char *name, char *press,
 
 	key = kzalloc(sizeof(struct logical_input), GFP_KERNEL);
 	if (!key) {
-		printk(KERN_ERR "panel: not enough memory\n");
+		pr_err("panel: not enough memory\n");

OOM messages are duplicative and unnecessary.
alloc failures get a dump_stack.

[]

drivers/staging/panel/panel.c static void panel_attach(struct parport *port) · line 2113

Quoted 8 lines
drivers/staging/panel/panel.c +1 -2
@@ -2109,8 +2109,7 @@ static void panel_attach(struct parport *port)
 		return;
 
 	if (pprt) {
-		printk(KERN_ERR
-		       "panel_attach(): port->number=%d parport=%d, "
+		pr_err("panel_attach(): port->number=%d parport=%d, "
 		       "already registered !\n",

Please coalesce formats and use "%s: ...", __func__ when there is an embedded function name. It'd also be nice to use argument alignment to open parenthesis.

		pr_err("%s: port->number=%d parport=%d, already registered\n",
		       port->number, parport);

etc...

cheers, Joe