linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging/olpc_dcon: fix checkpatch warnings
@ 2012-07-26 23:49 Toshiaki Yamane
  2012-07-27  1:40 ` Joe Perches
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Toshiaki Yamane @ 2012-07-26 23:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andres Salomon, Chris Ball, Jon Nettleton, linux-kernel,
	Toshiaki Yamane

Now checkpatch clean.

$ find drivers/staging/olpc_dcon/ -name "*.[ch]"|xargs ./scripts/checkpatch.pl \
-f --terse --nosummary|cut -f3- -d":"|sort |uniq -c|sort -n
      2  WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt
      3  WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
      3  WARNING: Prefer pr_warn(... to printk(KERN_WARNING, ...
      6  WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
     19  WARNING: Prefer pr_err(... to printk(KERN_ERR, ...

And added pr_fmt.

Signed-off-by: Toshiaki Yamane <yamanetoshi@gmail.com>
---
 drivers/staging/olpc_dcon/olpc_dcon.c        |   56 +++++++++++++-------------
 drivers/staging/olpc_dcon/olpc_dcon_xo_1.c   |   15 ++++---
 drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c |    6 ++-
 3 files changed, 41 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
index 992275c..4e6efc1 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -11,6 +11,7 @@
  * License as published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
 #include <linux/fb.h>
@@ -71,18 +72,18 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
 
 	ver = dcon_read(dcon, DCON_REG_ID);
 	if ((ver >> 8) != 0xDC) {
-		printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
-			ver);
+		pr_err("olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
+		       ver);
 		rc = -ENXIO;
 		goto err;
 	}
 
 	if (is_init) {
-		printk(KERN_INFO "olpc-dcon:  Discovered DCON version %x\n",
-				ver & 0xFF);
+		pr_info("olpc-dcon:  Discovered DCON version %x\n",
+			ver & 0xFF);
 		rc = pdata->init(dcon);
 		if (rc != 0) {
-			printk(KERN_ERR "olpc-dcon:  Unable to init.\n");
+			pr_err("olpc-dcon:  Unable to init.\n");
 			goto err;
 		}
 	}
@@ -136,21 +137,21 @@ power_up:
 		x = 1;
 		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
 		if (x) {
-			printk(KERN_WARNING "olpc-dcon:  unable to force dcon to power up: %d!\n",
+			pr_warn("olpc-dcon:  unable to force dcon to power up: %d!\n",
 				x);
 			return x;
 		}
-		msleep(10); /* we'll be conservative */
+		usleep_range(10000, 20000);
 	}
 
 	pdata->bus_stabilize_wiggle();
 
 	for (x = -1, timeout = 50; timeout && x < 0; timeout--) {
-		msleep(1);
+		usleep_range(1000, 2000);
 		x = dcon_read(dcon, DCON_REG_ID);
 	}
 	if (x < 0) {
-		printk(KERN_ERR "olpc-dcon:  unable to stabilize dcon's smbus, reasserting power and praying.\n");
+		pr_err("olpc-dcon:  unable to stabilize dcon's smbus, reasserting power and praying.\n");
 		BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
 		x = 0;
 		olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
@@ -221,7 +222,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
 		x = 0;
 		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
 		if (x)
-			printk(KERN_WARNING "olpc-dcon:  unable to force dcon to power down: %d!\n",
+			pr_warn("olpc-dcon:  unable to force dcon to power down: %d!\n",
 				x);
 		else
 			dcon->asleep = sleep;
@@ -231,7 +232,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
 			dcon->disp_mode |= MODE_BL_ENABLE;
 		x = dcon_bus_stabilize(dcon, 1);
 		if (x)
-			printk(KERN_WARNING "olpc-dcon:  unable to reinit dcon hardware: %d!\n",
+			pr_warn("olpc-dcon:  unable to reinit dcon hardware: %d!\n",
 				x);
 		else
 			dcon->asleep = sleep;
@@ -303,12 +304,11 @@ static void dcon_source_switch(struct work_struct *work)
 
 	switch (source) {
 	case DCON_SOURCE_CPU:
-		printk(KERN_INFO "dcon_source_switch to CPU\n");
+		pr_info("dcon_source_switch to CPU\n");
 		/* Enable the scanline interrupt bit */
 		if (dcon_write(dcon, DCON_REG_MODE,
 				dcon->disp_mode | MODE_SCAN_INT))
-			printk(KERN_ERR
-			       "olpc-dcon:  couldn't enable scanline interrupt!\n");
+			pr_err("olpc-dcon:  couldn't enable scanline interrupt!\n");
 		else {
 			/* Wait up to one second for the scanline interrupt */
 			wait_event_timeout(dcon_wait_queue,
@@ -316,11 +316,11 @@ static void dcon_source_switch(struct work_struct *work)
 		}
 
 		if (!dcon->switched)
-			printk(KERN_ERR "olpc-dcon:  Timeout entering CPU mode; expect a screen glitch.\n");
+			pr_err("olpc-dcon:  Timeout entering CPU mode; expect a screen glitch.\n");
 
 		/* Turn off the scanline interrupt */
 		if (dcon_write(dcon, DCON_REG_MODE, dcon->disp_mode))
-			printk(KERN_ERR "olpc-dcon:  couldn't disable scanline interrupt!\n");
+			pr_err("olpc-dcon:  couldn't disable scanline interrupt!\n");
 
 		/*
 		 * Ideally we'd like to disable interrupts here so that the
@@ -331,7 +331,7 @@ static void dcon_source_switch(struct work_struct *work)
 		 * For now, we just hope..
 		 */
 		if (!dcon_blank_fb(dcon, false)) {
-			printk(KERN_ERR "olpc-dcon:  Failed to enter CPU mode\n");
+			pr_err("olpc-dcon:  Failed to enter CPU mode\n");
 			dcon->pending_src = DCON_SOURCE_DCON;
 			return;
 		}
@@ -340,14 +340,14 @@ static void dcon_source_switch(struct work_struct *work)
 		pdata->set_dconload(1);
 		getnstimeofday(&dcon->load_time);
 
-		printk(KERN_INFO "olpc-dcon: The CPU has control\n");
+		pr_info("olpc-dcon: The CPU has control\n");
 		break;
 	case DCON_SOURCE_DCON:
 	{
 		int t;
 		struct timespec delta_t;
 
-		printk(KERN_INFO "dcon_source_switch to DCON\n");
+		pr_info("dcon_source_switch to DCON\n");
 
 		add_wait_queue(&dcon_wait_queue, &wait);
 		set_current_state(TASK_UNINTERRUPTIBLE);
@@ -361,7 +361,7 @@ static void dcon_source_switch(struct work_struct *work)
 		set_current_state(TASK_RUNNING);
 
 		if (!dcon->switched) {
-			printk(KERN_ERR "olpc-dcon: Timeout entering DCON mode; expect a screen glitch.\n");
+			pr_err("olpc-dcon: Timeout entering DCON mode; expect a screen glitch.\n");
 		} else {
 			/* sometimes the DCON doesn't follow its own rules,
 			 * and doesn't wait for two vsync pulses before
@@ -377,7 +377,7 @@ static void dcon_source_switch(struct work_struct *work)
 			delta_t = timespec_sub(dcon->irq_time, dcon->load_time);
 			if (dcon->switched && delta_t.tv_sec == 0 &&
 					delta_t.tv_nsec < NSEC_PER_MSEC * 20) {
-				printk(KERN_ERR "olpc-dcon: missed loading, retrying\n");
+				pr_err("olpc-dcon: missed loading, retrying\n");
 				pdata->set_dconload(1);
 				mdelay(41);
 				pdata->set_dconload(0);
@@ -387,7 +387,7 @@ static void dcon_source_switch(struct work_struct *work)
 		}
 
 		dcon_blank_fb(dcon, true);
-		printk(KERN_INFO "olpc-dcon: The DCON has control\n");
+		pr_info("olpc-dcon: The DCON has control\n");
 		break;
 	}
 	default:
@@ -475,7 +475,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
 	if (ret)
 		return ret;
 
-	printk(KERN_INFO "dcon_freeze_store: %lu\n", output);
+	pr_info("dcon_freeze_store: %lu\n", output);
 
 	switch (output) {
 	case 0:
@@ -649,7 +649,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	dcon_device = platform_device_alloc("dcon", -1);
 
 	if (dcon_device == NULL) {
-		printk(KERN_ERR "dcon:  Unable to create the DCON device\n");
+		pr_err("dcon:  Unable to create the DCON device\n");
 		rc = -ENOMEM;
 		goto eirq;
 	}
@@ -657,7 +657,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	platform_set_drvdata(dcon_device, dcon);
 
 	if (rc) {
-		printk(KERN_ERR "dcon:  Unable to add the DCON device\n");
+		pr_err("dcon:  Unable to add the DCON device\n");
 		goto edev;
 	}
 
@@ -761,7 +761,7 @@ irqreturn_t dcon_interrupt(int irq, void *id)
 
 	switch (status & 3) {
 	case 3:
-		printk(KERN_DEBUG "olpc-dcon: DCONLOAD_MISSED interrupt\n");
+		pr_debug("olpc-dcon: DCONLOAD_MISSED interrupt\n");
 		break;
 
 	case 2:	/* switch to DCON mode */
@@ -783,9 +783,9 @@ irqreturn_t dcon_interrupt(int irq, void *id)
 			dcon->switched = true;
 			getnstimeofday(&dcon->irq_time);
 			wake_up(&dcon_wait_queue);
-			printk(KERN_DEBUG "olpc-dcon: switching w/ status 0/0\n");
+			pr_debug("olpc-dcon: switching w/ status 0/0\n");
 		} else {
-			printk(KERN_DEBUG "olpc-dcon: scanline interrupt w/CPU\n");
+			pr_debug("olpc-dcon: scanline interrupt w/CPU\n");
 		}
 	}
 
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
index c87fdfa..e83467e 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
@@ -10,6 +10,9 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/cs5535.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
@@ -22,23 +25,23 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 	unsigned char lob;
 
 	if (gpio_request(OLPC_GPIO_DCON_STAT0, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request STAT0 GPIO\n");
+		pr_err("olpc-dcon: failed to request STAT0 GPIO\n");
 		return -EIO;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_STAT1, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request STAT1 GPIO\n");
+		pr_err("olpc-dcon: failed to request STAT1 GPIO\n");
 		goto err_gp_stat1;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_IRQ, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request IRQ GPIO\n");
+		pr_err("olpc-dcon: failed to request IRQ GPIO\n");
 		goto err_gp_irq;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_LOAD, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request LOAD GPIO\n");
+		pr_err("olpc-dcon: failed to request LOAD GPIO\n");
 		goto err_gp_load;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_BLANK, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request BLANK GPIO\n");
+		pr_err("olpc-dcon: failed to request BLANK GPIO\n");
 		goto err_gp_blank;
 	}
 
@@ -83,7 +86,7 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 
 	/* Register the interrupt handler */
 	if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon)) {
-		printk(KERN_ERR "olpc-dcon: failed to request DCON's irq\n");
+		pr_err("olpc-dcon: failed to request DCON's irq\n");
 		goto err_req_irq;
 	}
 
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
index 69415ee..352dd3d 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
@@ -6,6 +6,8 @@
  * License as published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/acpi.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
@@ -66,7 +68,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
 	pdev = pci_get_device(PCI_VENDOR_ID_VIA,
 			      PCI_DEVICE_ID_VIA_VX855, NULL);
 	if (!pdev) {
-		printk(KERN_ERR "cannot find VX855 PCI ID\n");
+		pr_err("cannot find VX855 PCI ID\n");
 		return 1;
 	}
 
@@ -104,7 +106,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
 	/* we're sharing the IRQ with ACPI */
 	irq = acpi_gbl_FADT.sci_interrupt;
 	if (request_irq(irq, &dcon_interrupt, IRQF_SHARED, "DCON", dcon)) {
-		printk(KERN_ERR PREFIX "DCON (IRQ%d) allocation failed\n", irq);
+		pr_err("DCON (IRQ%d) allocation failed\n", irq);
 		return 1;
 	}
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-26 23:49 [PATCH] staging/olpc_dcon: fix checkpatch warnings Toshiaki Yamane
@ 2012-07-27  1:40 ` Joe Perches
  2012-07-27  2:14   ` Toshiaki Yamane
  2012-07-27  2:28 ` Andres Salomon
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2012-07-27  1:40 UTC (permalink / raw)
  To: Toshiaki Yamane
  Cc: Greg Kroah-Hartman, Andres Salomon, Chris Ball, Jon Nettleton,
	linux-kernel

On Fri, 2012-07-27 at 08:49 +0900, Toshiaki Yamane wrote:
> Now checkpatch clean.
[]
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
[]
> @@ -11,6 +11,7 @@
[]
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
[]
> @@ -71,18 +72,18 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
>  
>  	ver = dcon_read(dcon, DCON_REG_ID);
>  	if ((ver >> 8) != 0xDC) {
> -		printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
> -			ver);
> +		pr_err("olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
> +		       ver);
>  		rc = -ENXIO;
>  		goto err;
>  	}
>  
>  	if (is_init) {
> -		printk(KERN_INFO "olpc-dcon:  Discovered DCON version %x\n",
> -				ver & 0xFF);
> +		pr_info("olpc-dcon:  Discovered DCON version %x\n",
> +			ver & 0xFF);

Hello.

Please remove all the embedded "olpc-dcon: " prefixes.
There is a pr_fmt define that adds "olpc_dcon" already.

You can use the strings program on the output .o files to
verify the formats that are produced.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-27  1:40 ` Joe Perches
@ 2012-07-27  2:14   ` Toshiaki Yamane
  0 siblings, 0 replies; 13+ messages in thread
From: Toshiaki Yamane @ 2012-07-27  2:14 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, Andres Salomon, Chris Ball, Jon Nettleton,
	linux-kernel

On Fri, Jul 27, 2012 at 10:40 AM, Joe Perches <joe@perches.com> wrote:
> On Fri, 2012-07-27 at 08:49 +0900, Toshiaki Yamane wrote:
>> Now checkpatch clean.
> []
>> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
> []
>> @@ -11,6 +11,7 @@
> []
>> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> []
>> @@ -71,18 +72,18 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
>>
>>       ver = dcon_read(dcon, DCON_REG_ID);
>>       if ((ver >> 8) != 0xDC) {
>> -             printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
>> -                     ver);
>> +             pr_err("olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
>> +                    ver);
>>               rc = -ENXIO;
>>               goto err;
>>       }
>>
>>       if (is_init) {
>> -             printk(KERN_INFO "olpc-dcon:  Discovered DCON version %x\n",
>> -                             ver & 0xFF);
>> +             pr_info("olpc-dcon:  Discovered DCON version %x\n",
>> +                     ver & 0xFF);
>
> Hello.
>
> Please remove all the embedded "olpc-dcon: " prefixes.
> There is a pr_fmt define that adds "olpc_dcon" already.
>
> You can use the strings program on the output .o files to
> verify the formats that are produced.
>

Thanks for your reply.

I was able to check for duplicates in strings.
I will try to fix with care.




-- 

Regards,


 .
  .
...

Yamane Toshiaki

yamanetoshi@gmail.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-26 23:49 [PATCH] staging/olpc_dcon: fix checkpatch warnings Toshiaki Yamane
  2012-07-27  1:40 ` Joe Perches
@ 2012-07-27  2:28 ` Andres Salomon
  2012-07-27  2:42   ` Toshiaki Yamane
  2012-07-27  4:46 ` Toshiaki Yamane
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Andres Salomon @ 2012-07-27  2:28 UTC (permalink / raw)
  To: Toshiaki Yamane
  Cc: Greg Kroah-Hartman, Chris Ball, Jon Nettleton, linux-kernel

On Fri, 27 Jul 2012 08:49:19 +0900
Toshiaki Yamane <yamanetoshi@gmail.com> wrote:

> Now checkpatch clean.
> 
> $ find drivers/staging/olpc_dcon/ -name
> "*.[ch]"|xargs ./scripts/checkpatch.pl \ -f --terse --nosummary|cut
> -f3- -d":"|sort |uniq -c|sort -n 2  WARNING: msleep < 20ms can sleep
> for up to 20ms; see Documentation/timers/timers-howto.txt 3  WARNING:

NACK - please don't modify the msleep timings right now.  The pr_*
changes are welcome, however.


> Prefer pr_debug(... to printk(KERN_DEBUG, ... 3  WARNING: Prefer
> pr_warn(... to printk(KERN_WARNING, ... 6  WARNING: Prefer
> pr_info(... to printk(KERN_INFO, ... 19  WARNING: Prefer pr_err(...
> to printk(KERN_ERR, ...
> 
> And added pr_fmt.
> 
> Signed-off-by: Toshiaki Yamane <yamanetoshi@gmail.com>
[...]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-27  2:28 ` Andres Salomon
@ 2012-07-27  2:42   ` Toshiaki Yamane
  0 siblings, 0 replies; 13+ messages in thread
From: Toshiaki Yamane @ 2012-07-27  2:42 UTC (permalink / raw)
  To: Andres Salomon
  Cc: Greg Kroah-Hartman, Chris Ball, Jon Nettleton, linux-kernel

On Fri, Jul 27, 2012 at 11:28 AM, Andres Salomon <dilinger@queued.net> wrote:
> On Fri, 27 Jul 2012 08:49:19 +0900
> Toshiaki Yamane <yamanetoshi@gmail.com> wrote:
>
>> Now checkpatch clean.
>>
>> $ find drivers/staging/olpc_dcon/ -name
>> "*.[ch]"|xargs ./scripts/checkpatch.pl \ -f --terse --nosummary|cut
>> -f3- -d":"|sort |uniq -c|sort -n 2  WARNING: msleep < 20ms can sleep
>> for up to 20ms; see Documentation/timers/timers-howto.txt 3  WARNING:
>
> NACK - please don't modify the msleep timings right now.  The pr_*
> changes are welcome, however.
>

I agree.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-26 23:49 [PATCH] staging/olpc_dcon: fix checkpatch warnings Toshiaki Yamane
  2012-07-27  1:40 ` Joe Perches
  2012-07-27  2:28 ` Andres Salomon
@ 2012-07-27  4:46 ` Toshiaki Yamane
  2012-07-27  5:03   ` Joe Perches
  2012-07-27 11:45 ` Toshiaki Yamane
  2012-08-17  5:37 ` Toshiaki Yamane
  4 siblings, 1 reply; 13+ messages in thread
From: Toshiaki Yamane @ 2012-07-27  4:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andres Salomon, Chris Ball, Jon Nettleton, Joe Perches,
	linux-kernel, Toshiaki Yamane

fixed some checkpatch warnings.
(Excluding -WARNING: msleep < 20ms can sleep for up to 20ms-)

$ find drivers/staging/olpc_dcon/ -name "*.[ch]"|xargs ./scripts/checkpatch.pl \
-f --terse --nosummary|cut -f3- -d":"|sort |uniq -c|sort -n
      2  WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt
      3  WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
      3  WARNING: Prefer pr_warn(... to printk(KERN_WARNING, ...
      6  WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
     19  WARNING: Prefer pr_err(... to printk(KERN_ERR, ...

And added pr_fmt.

Signed-off-by: Toshiaki Yamane <yamanetoshi@gmail.com>
---
 drivers/staging/olpc_dcon/olpc_dcon.c        |   52 +++++++++++++-------------
 drivers/staging/olpc_dcon/olpc_dcon_xo_1.c   |   15 ++++---
 drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c |    6 ++-
 3 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
index 992275c..f092c80 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -11,6 +11,7 @@
  * License as published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
 #include <linux/fb.h>
@@ -71,18 +72,18 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
 
 	ver = dcon_read(dcon, DCON_REG_ID);
 	if ((ver >> 8) != 0xDC) {
-		printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
-			ver);
+		pr_err("DCON ID not 0xDCxx: 0x%04x instead.\n",
+		       ver);
 		rc = -ENXIO;
 		goto err;
 	}
 
 	if (is_init) {
-		printk(KERN_INFO "olpc-dcon:  Discovered DCON version %x\n",
-				ver & 0xFF);
+		pr_info("Discovered DCON version %x\n",
+			ver & 0xFF);
 		rc = pdata->init(dcon);
 		if (rc != 0) {
-			printk(KERN_ERR "olpc-dcon:  Unable to init.\n");
+			pr_err("Unable to init.\n");
 			goto err;
 		}
 	}
@@ -136,7 +137,7 @@ power_up:
 		x = 1;
 		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
 		if (x) {
-			printk(KERN_WARNING "olpc-dcon:  unable to force dcon to power up: %d!\n",
+			pr_warn("unable to force dcon to power up: %d!\n",
 				x);
 			return x;
 		}
@@ -150,7 +151,7 @@ power_up:
 		x = dcon_read(dcon, DCON_REG_ID);
 	}
 	if (x < 0) {
-		printk(KERN_ERR "olpc-dcon:  unable to stabilize dcon's smbus, reasserting power and praying.\n");
+		pr_err("unable to stabilize dcon's smbus, reasserting power and praying.\n");
 		BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
 		x = 0;
 		olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
@@ -221,7 +222,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
 		x = 0;
 		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
 		if (x)
-			printk(KERN_WARNING "olpc-dcon:  unable to force dcon to power down: %d!\n",
+			pr_warn("unable to force dcon to power down: %d!\n",
 				x);
 		else
 			dcon->asleep = sleep;
@@ -231,7 +232,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
 			dcon->disp_mode |= MODE_BL_ENABLE;
 		x = dcon_bus_stabilize(dcon, 1);
 		if (x)
-			printk(KERN_WARNING "olpc-dcon:  unable to reinit dcon hardware: %d!\n",
+			pr_warn("unable to reinit dcon hardware: %d!\n",
 				x);
 		else
 			dcon->asleep = sleep;
@@ -303,12 +304,11 @@ static void dcon_source_switch(struct work_struct *work)
 
 	switch (source) {
 	case DCON_SOURCE_CPU:
-		printk(KERN_INFO "dcon_source_switch to CPU\n");
+		pr_info("dcon_source_switch to CPU\n");
 		/* Enable the scanline interrupt bit */
 		if (dcon_write(dcon, DCON_REG_MODE,
 				dcon->disp_mode | MODE_SCAN_INT))
-			printk(KERN_ERR
-			       "olpc-dcon:  couldn't enable scanline interrupt!\n");
+			pr_err("couldn't enable scanline interrupt!\n");
 		else {
 			/* Wait up to one second for the scanline interrupt */
 			wait_event_timeout(dcon_wait_queue,
@@ -316,11 +316,11 @@ static void dcon_source_switch(struct work_struct *work)
 		}
 
 		if (!dcon->switched)
-			printk(KERN_ERR "olpc-dcon:  Timeout entering CPU mode; expect a screen glitch.\n");
+			pr_err("Timeout entering CPU mode; expect a screen glitch.\n");
 
 		/* Turn off the scanline interrupt */
 		if (dcon_write(dcon, DCON_REG_MODE, dcon->disp_mode))
-			printk(KERN_ERR "olpc-dcon:  couldn't disable scanline interrupt!\n");
+			pr_err("couldn't disable scanline interrupt!\n");
 
 		/*
 		 * Ideally we'd like to disable interrupts here so that the
@@ -331,7 +331,7 @@ static void dcon_source_switch(struct work_struct *work)
 		 * For now, we just hope..
 		 */
 		if (!dcon_blank_fb(dcon, false)) {
-			printk(KERN_ERR "olpc-dcon:  Failed to enter CPU mode\n");
+			pr_err("Failed to enter CPU mode\n");
 			dcon->pending_src = DCON_SOURCE_DCON;
 			return;
 		}
@@ -340,14 +340,14 @@ static void dcon_source_switch(struct work_struct *work)
 		pdata->set_dconload(1);
 		getnstimeofday(&dcon->load_time);
 
-		printk(KERN_INFO "olpc-dcon: The CPU has control\n");
+		pr_info("The CPU has control\n");
 		break;
 	case DCON_SOURCE_DCON:
 	{
 		int t;
 		struct timespec delta_t;
 
-		printk(KERN_INFO "dcon_source_switch to DCON\n");
+		pr_info("dcon_source_switch to DCON\n");
 
 		add_wait_queue(&dcon_wait_queue, &wait);
 		set_current_state(TASK_UNINTERRUPTIBLE);
@@ -361,7 +361,7 @@ static void dcon_source_switch(struct work_struct *work)
 		set_current_state(TASK_RUNNING);
 
 		if (!dcon->switched) {
-			printk(KERN_ERR "olpc-dcon: Timeout entering DCON mode; expect a screen glitch.\n");
+			pr_err("Timeout entering DCON mode; expect a screen glitch.\n");
 		} else {
 			/* sometimes the DCON doesn't follow its own rules,
 			 * and doesn't wait for two vsync pulses before
@@ -377,7 +377,7 @@ static void dcon_source_switch(struct work_struct *work)
 			delta_t = timespec_sub(dcon->irq_time, dcon->load_time);
 			if (dcon->switched && delta_t.tv_sec == 0 &&
 					delta_t.tv_nsec < NSEC_PER_MSEC * 20) {
-				printk(KERN_ERR "olpc-dcon: missed loading, retrying\n");
+				pr_err("missed loading, retrying\n");
 				pdata->set_dconload(1);
 				mdelay(41);
 				pdata->set_dconload(0);
@@ -387,7 +387,7 @@ static void dcon_source_switch(struct work_struct *work)
 		}
 
 		dcon_blank_fb(dcon, true);
-		printk(KERN_INFO "olpc-dcon: The DCON has control\n");
+		pr_info("The DCON has control\n");
 		break;
 	}
 	default:
@@ -475,7 +475,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
 	if (ret)
 		return ret;
 
-	printk(KERN_INFO "dcon_freeze_store: %lu\n", output);
+	pr_info("dcon_freeze_store: %lu\n", output);
 
 	switch (output) {
 	case 0:
@@ -649,7 +649,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	dcon_device = platform_device_alloc("dcon", -1);
 
 	if (dcon_device == NULL) {
-		printk(KERN_ERR "dcon:  Unable to create the DCON device\n");
+		pr_err("Unable to create the DCON device\n");
 		rc = -ENOMEM;
 		goto eirq;
 	}
@@ -657,7 +657,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	platform_set_drvdata(dcon_device, dcon);
 
 	if (rc) {
-		printk(KERN_ERR "dcon:  Unable to add the DCON device\n");
+		pr_err("Unable to add the DCON device\n");
 		goto edev;
 	}
 
@@ -761,7 +761,7 @@ irqreturn_t dcon_interrupt(int irq, void *id)
 
 	switch (status & 3) {
 	case 3:
-		printk(KERN_DEBUG "olpc-dcon: DCONLOAD_MISSED interrupt\n");
+		pr_debug("DCONLOAD_MISSED interrupt\n");
 		break;
 
 	case 2:	/* switch to DCON mode */
@@ -783,9 +783,9 @@ irqreturn_t dcon_interrupt(int irq, void *id)
 			dcon->switched = true;
 			getnstimeofday(&dcon->irq_time);
 			wake_up(&dcon_wait_queue);
-			printk(KERN_DEBUG "olpc-dcon: switching w/ status 0/0\n");
+			pr_debug("switching w/ status 0/0\n");
 		} else {
-			printk(KERN_DEBUG "olpc-dcon: scanline interrupt w/CPU\n");
+			pr_debug("scanline interrupt w/CPU\n");
 		}
 	}
 
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
index c87fdfa..77e8eb5 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
@@ -10,6 +10,9 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/cs5535.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
@@ -22,23 +25,23 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 	unsigned char lob;
 
 	if (gpio_request(OLPC_GPIO_DCON_STAT0, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request STAT0 GPIO\n");
+		pr_err("failed to request STAT0 GPIO\n");
 		return -EIO;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_STAT1, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request STAT1 GPIO\n");
+		pr_err("failed to request STAT1 GPIO\n");
 		goto err_gp_stat1;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_IRQ, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request IRQ GPIO\n");
+		pr_err("failed to request IRQ GPIO\n");
 		goto err_gp_irq;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_LOAD, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request LOAD GPIO\n");
+		pr_err("failed to request LOAD GPIO\n");
 		goto err_gp_load;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_BLANK, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request BLANK GPIO\n");
+		pr_err("failed to request BLANK GPIO\n");
 		goto err_gp_blank;
 	}
 
@@ -83,7 +86,7 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 
 	/* Register the interrupt handler */
 	if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon)) {
-		printk(KERN_ERR "olpc-dcon: failed to request DCON's irq\n");
+		pr_err("failed to request DCON's irq\n");
 		goto err_req_irq;
 	}
 
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
index 69415ee..352dd3d 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
@@ -6,6 +6,8 @@
  * License as published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/acpi.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
@@ -66,7 +68,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
 	pdev = pci_get_device(PCI_VENDOR_ID_VIA,
 			      PCI_DEVICE_ID_VIA_VX855, NULL);
 	if (!pdev) {
-		printk(KERN_ERR "cannot find VX855 PCI ID\n");
+		pr_err("cannot find VX855 PCI ID\n");
 		return 1;
 	}
 
@@ -104,7 +106,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
 	/* we're sharing the IRQ with ACPI */
 	irq = acpi_gbl_FADT.sci_interrupt;
 	if (request_irq(irq, &dcon_interrupt, IRQF_SHARED, "DCON", dcon)) {
-		printk(KERN_ERR PREFIX "DCON (IRQ%d) allocation failed\n", irq);
+		pr_err("DCON (IRQ%d) allocation failed\n", irq);
 		return 1;
 	}
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-27  4:46 ` Toshiaki Yamane
@ 2012-07-27  5:03   ` Joe Perches
  2012-07-27  5:05     ` Toshiaki Yamane
  0 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2012-07-27  5:03 UTC (permalink / raw)
  To: Toshiaki Yamane
  Cc: Greg Kroah-Hartman, Andres Salomon, Chris Ball, Jon Nettleton,
	linux-kernel

On Fri, 2012-07-27 at 13:46 +0900, Toshiaki Yamane wrote:
> fixed some checkpatch warnings.
> (Excluding -WARNING: msleep < 20ms can sleep for up to 20ms-)
[]
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
[]
> @@ -71,18 +72,18 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
>  
>  	ver = dcon_read(dcon, DCON_REG_ID);
>  	if ((ver >> 8) != 0xDC) {
> -		printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
> -			ver);
> +		pr_err("DCON ID not 0xDCxx: 0x%04x instead.\n",
> +		       ver);

Please fit arguments on a single line where feasible.

		pr_err("DCON ID not 0xDCxx: 0x%04x instead.\n", ver);
[]

> @@ -231,7 +232,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
>  			dcon->disp_mode |= MODE_BL_ENABLE;
>  		x = dcon_bus_stabilize(dcon, 1);
>  		if (x)
> -			printk(KERN_WARNING "olpc-dcon:  unable to reinit dcon hardware: %d!\n",
> +			pr_warn("unable to reinit dcon hardware: %d!\n",
>  				x);

			pr_warn("unable to reinit dcon hardware: %d!\n", x);

etc.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-27  5:03   ` Joe Perches
@ 2012-07-27  5:05     ` Toshiaki Yamane
  0 siblings, 0 replies; 13+ messages in thread
From: Toshiaki Yamane @ 2012-07-27  5:05 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, Andres Salomon, Chris Ball, Jon Nettleton,
	linux-kernel

On Fri, Jul 27, 2012 at 2:03 PM, Joe Perches <joe@perches.com> wrote:
> On Fri, 2012-07-27 at 13:46 +0900, Toshiaki Yamane wrote:
>> fixed some checkpatch warnings.
>> (Excluding -WARNING: msleep < 20ms can sleep for up to 20ms-)
> []
>> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
> []
>> @@ -71,18 +72,18 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
>>
>>       ver = dcon_read(dcon, DCON_REG_ID);
>>       if ((ver >> 8) != 0xDC) {
>> -             printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
>> -                     ver);
>> +             pr_err("DCON ID not 0xDCxx: 0x%04x instead.\n",
>> +                    ver);
>
> Please fit arguments on a single line where feasible.

I agree.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-26 23:49 [PATCH] staging/olpc_dcon: fix checkpatch warnings Toshiaki Yamane
                   ` (2 preceding siblings ...)
  2012-07-27  4:46 ` Toshiaki Yamane
@ 2012-07-27 11:45 ` Toshiaki Yamane
  2012-07-27 18:25   ` Andres Salomon
  2012-08-14  2:21   ` Greg Kroah-Hartman
  2012-08-17  5:37 ` Toshiaki Yamane
  4 siblings, 2 replies; 13+ messages in thread
From: Toshiaki Yamane @ 2012-07-27 11:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andres Salomon, Chris Ball, Jon Nettleton, Joe Perches,
	linux-kernel, Toshiaki Yamane

fixed some checkpatch warnings.
(Excluding -WARNING: msleep < 20ms can sleep for up to 20ms-)

$ find drivers/staging/olpc_dcon/ -name "*.[ch]"|xargs ./scripts/checkpatch.pl \
-f --terse --nosummary|cut -f3- -d":"|sort |uniq -c|sort -n
      2  WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt
      3  WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
      3  WARNING: Prefer pr_warn(... to printk(KERN_WARNING, ...
      6  WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
     19  WARNING: Prefer pr_err(... to printk(KERN_ERR, ...

And added pr_fmt.

Signed-off-by: Toshiaki Yamane <yamanetoshi@gmail.com>
---
 drivers/staging/olpc_dcon/olpc_dcon.c        |   53 ++++++++++++--------------
 drivers/staging/olpc_dcon/olpc_dcon_xo_1.c   |   15 ++++---
 drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c |    6 ++-
 3 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
index 992275c..280751a 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -11,6 +11,7 @@
  * License as published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
 #include <linux/fb.h>
@@ -71,18 +72,16 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
 
 	ver = dcon_read(dcon, DCON_REG_ID);
 	if ((ver >> 8) != 0xDC) {
-		printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
-			ver);
+		pr_err("DCON ID not 0xDCxx: 0x%04x instead.\n", ver);
 		rc = -ENXIO;
 		goto err;
 	}
 
 	if (is_init) {
-		printk(KERN_INFO "olpc-dcon:  Discovered DCON version %x\n",
-				ver & 0xFF);
+		pr_info("Discovered DCON version %x\n", ver & 0xFF);
 		rc = pdata->init(dcon);
 		if (rc != 0) {
-			printk(KERN_ERR "olpc-dcon:  Unable to init.\n");
+			pr_err("Unable to init.\n");
 			goto err;
 		}
 	}
@@ -136,8 +135,7 @@ power_up:
 		x = 1;
 		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
 		if (x) {
-			printk(KERN_WARNING "olpc-dcon:  unable to force dcon to power up: %d!\n",
-				x);
+			pr_warn("unable to force dcon to power up: %d!\n", x);
 			return x;
 		}
 		msleep(10); /* we'll be conservative */
@@ -150,7 +148,7 @@ power_up:
 		x = dcon_read(dcon, DCON_REG_ID);
 	}
 	if (x < 0) {
-		printk(KERN_ERR "olpc-dcon:  unable to stabilize dcon's smbus, reasserting power and praying.\n");
+		pr_err("unable to stabilize dcon's smbus, reasserting power and praying.\n");
 		BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
 		x = 0;
 		olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
@@ -221,8 +219,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
 		x = 0;
 		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
 		if (x)
-			printk(KERN_WARNING "olpc-dcon:  unable to force dcon to power down: %d!\n",
-				x);
+			pr_warn("unable to force dcon to power down: %d!\n", x);
 		else
 			dcon->asleep = sleep;
 	} else {
@@ -231,8 +228,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
 			dcon->disp_mode |= MODE_BL_ENABLE;
 		x = dcon_bus_stabilize(dcon, 1);
 		if (x)
-			printk(KERN_WARNING "olpc-dcon:  unable to reinit dcon hardware: %d!\n",
-				x);
+			pr_warn("unable to reinit dcon hardware: %d!\n", x);
 		else
 			dcon->asleep = sleep;
 
@@ -303,12 +299,11 @@ static void dcon_source_switch(struct work_struct *work)
 
 	switch (source) {
 	case DCON_SOURCE_CPU:
-		printk(KERN_INFO "dcon_source_switch to CPU\n");
+		pr_info("dcon_source_switch to CPU\n");
 		/* Enable the scanline interrupt bit */
 		if (dcon_write(dcon, DCON_REG_MODE,
 				dcon->disp_mode | MODE_SCAN_INT))
-			printk(KERN_ERR
-			       "olpc-dcon:  couldn't enable scanline interrupt!\n");
+			pr_err("couldn't enable scanline interrupt!\n");
 		else {
 			/* Wait up to one second for the scanline interrupt */
 			wait_event_timeout(dcon_wait_queue,
@@ -316,11 +311,11 @@ static void dcon_source_switch(struct work_struct *work)
 		}
 
 		if (!dcon->switched)
-			printk(KERN_ERR "olpc-dcon:  Timeout entering CPU mode; expect a screen glitch.\n");
+			pr_err("Timeout entering CPU mode; expect a screen glitch.\n");
 
 		/* Turn off the scanline interrupt */
 		if (dcon_write(dcon, DCON_REG_MODE, dcon->disp_mode))
-			printk(KERN_ERR "olpc-dcon:  couldn't disable scanline interrupt!\n");
+			pr_err("couldn't disable scanline interrupt!\n");
 
 		/*
 		 * Ideally we'd like to disable interrupts here so that the
@@ -331,7 +326,7 @@ static void dcon_source_switch(struct work_struct *work)
 		 * For now, we just hope..
 		 */
 		if (!dcon_blank_fb(dcon, false)) {
-			printk(KERN_ERR "olpc-dcon:  Failed to enter CPU mode\n");
+			pr_err("Failed to enter CPU mode\n");
 			dcon->pending_src = DCON_SOURCE_DCON;
 			return;
 		}
@@ -340,14 +335,14 @@ static void dcon_source_switch(struct work_struct *work)
 		pdata->set_dconload(1);
 		getnstimeofday(&dcon->load_time);
 
-		printk(KERN_INFO "olpc-dcon: The CPU has control\n");
+		pr_info("The CPU has control\n");
 		break;
 	case DCON_SOURCE_DCON:
 	{
 		int t;
 		struct timespec delta_t;
 
-		printk(KERN_INFO "dcon_source_switch to DCON\n");
+		pr_info("dcon_source_switch to DCON\n");
 
 		add_wait_queue(&dcon_wait_queue, &wait);
 		set_current_state(TASK_UNINTERRUPTIBLE);
@@ -361,7 +356,7 @@ static void dcon_source_switch(struct work_struct *work)
 		set_current_state(TASK_RUNNING);
 
 		if (!dcon->switched) {
-			printk(KERN_ERR "olpc-dcon: Timeout entering DCON mode; expect a screen glitch.\n");
+			pr_err("Timeout entering DCON mode; expect a screen glitch.\n");
 		} else {
 			/* sometimes the DCON doesn't follow its own rules,
 			 * and doesn't wait for two vsync pulses before
@@ -377,7 +372,7 @@ static void dcon_source_switch(struct work_struct *work)
 			delta_t = timespec_sub(dcon->irq_time, dcon->load_time);
 			if (dcon->switched && delta_t.tv_sec == 0 &&
 					delta_t.tv_nsec < NSEC_PER_MSEC * 20) {
-				printk(KERN_ERR "olpc-dcon: missed loading, retrying\n");
+				pr_err("missed loading, retrying\n");
 				pdata->set_dconload(1);
 				mdelay(41);
 				pdata->set_dconload(0);
@@ -387,7 +382,7 @@ static void dcon_source_switch(struct work_struct *work)
 		}
 
 		dcon_blank_fb(dcon, true);
-		printk(KERN_INFO "olpc-dcon: The DCON has control\n");
+		pr_info("The DCON has control\n");
 		break;
 	}
 	default:
@@ -475,7 +470,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
 	if (ret)
 		return ret;
 
-	printk(KERN_INFO "dcon_freeze_store: %lu\n", output);
+	pr_info("dcon_freeze_store: %lu\n", output);
 
 	switch (output) {
 	case 0:
@@ -649,7 +644,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	dcon_device = platform_device_alloc("dcon", -1);
 
 	if (dcon_device == NULL) {
-		printk(KERN_ERR "dcon:  Unable to create the DCON device\n");
+		pr_err("Unable to create the DCON device\n");
 		rc = -ENOMEM;
 		goto eirq;
 	}
@@ -657,7 +652,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	platform_set_drvdata(dcon_device, dcon);
 
 	if (rc) {
-		printk(KERN_ERR "dcon:  Unable to add the DCON device\n");
+		pr_err("Unable to add the DCON device\n");
 		goto edev;
 	}
 
@@ -761,7 +756,7 @@ irqreturn_t dcon_interrupt(int irq, void *id)
 
 	switch (status & 3) {
 	case 3:
-		printk(KERN_DEBUG "olpc-dcon: DCONLOAD_MISSED interrupt\n");
+		pr_debug("DCONLOAD_MISSED interrupt\n");
 		break;
 
 	case 2:	/* switch to DCON mode */
@@ -783,9 +778,9 @@ irqreturn_t dcon_interrupt(int irq, void *id)
 			dcon->switched = true;
 			getnstimeofday(&dcon->irq_time);
 			wake_up(&dcon_wait_queue);
-			printk(KERN_DEBUG "olpc-dcon: switching w/ status 0/0\n");
+			pr_debug("switching w/ status 0/0\n");
 		} else {
-			printk(KERN_DEBUG "olpc-dcon: scanline interrupt w/CPU\n");
+			pr_debug("scanline interrupt w/CPU\n");
 		}
 	}
 
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
index c87fdfa..77e8eb5 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
@@ -10,6 +10,9 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/cs5535.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
@@ -22,23 +25,23 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 	unsigned char lob;
 
 	if (gpio_request(OLPC_GPIO_DCON_STAT0, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request STAT0 GPIO\n");
+		pr_err("failed to request STAT0 GPIO\n");
 		return -EIO;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_STAT1, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request STAT1 GPIO\n");
+		pr_err("failed to request STAT1 GPIO\n");
 		goto err_gp_stat1;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_IRQ, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request IRQ GPIO\n");
+		pr_err("failed to request IRQ GPIO\n");
 		goto err_gp_irq;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_LOAD, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request LOAD GPIO\n");
+		pr_err("failed to request LOAD GPIO\n");
 		goto err_gp_load;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_BLANK, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request BLANK GPIO\n");
+		pr_err("failed to request BLANK GPIO\n");
 		goto err_gp_blank;
 	}
 
@@ -83,7 +86,7 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 
 	/* Register the interrupt handler */
 	if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon)) {
-		printk(KERN_ERR "olpc-dcon: failed to request DCON's irq\n");
+		pr_err("failed to request DCON's irq\n");
 		goto err_req_irq;
 	}
 
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
index 69415ee..352dd3d 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
@@ -6,6 +6,8 @@
  * License as published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/acpi.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
@@ -66,7 +68,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
 	pdev = pci_get_device(PCI_VENDOR_ID_VIA,
 			      PCI_DEVICE_ID_VIA_VX855, NULL);
 	if (!pdev) {
-		printk(KERN_ERR "cannot find VX855 PCI ID\n");
+		pr_err("cannot find VX855 PCI ID\n");
 		return 1;
 	}
 
@@ -104,7 +106,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
 	/* we're sharing the IRQ with ACPI */
 	irq = acpi_gbl_FADT.sci_interrupt;
 	if (request_irq(irq, &dcon_interrupt, IRQF_SHARED, "DCON", dcon)) {
-		printk(KERN_ERR PREFIX "DCON (IRQ%d) allocation failed\n", irq);
+		pr_err("DCON (IRQ%d) allocation failed\n", irq);
 		return 1;
 	}
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-27 11:45 ` Toshiaki Yamane
@ 2012-07-27 18:25   ` Andres Salomon
  2012-08-14  2:21   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 13+ messages in thread
From: Andres Salomon @ 2012-07-27 18:25 UTC (permalink / raw)
  To: Toshiaki Yamane
  Cc: Greg Kroah-Hartman, Chris Ball, Jon Nettleton, Joe Perches,
	linux-kernel

Looks fine to me, thanks.

Acked-by: Andres Salomon <dilinger@queued.net>

On Fri, 27 Jul 2012
20:45:52 +0900 Toshiaki Yamane <yamanetoshi@gmail.com> wrote:

> fixed some checkpatch warnings.
> (Excluding -WARNING: msleep < 20ms can sleep for up to 20ms-)
> 
> $ find drivers/staging/olpc_dcon/ -name
> "*.[ch]"|xargs ./scripts/checkpatch.pl \ -f --terse --nosummary|cut
> -f3- -d":"|sort |uniq -c|sort -n 2  WARNING: msleep < 20ms can sleep
> for up to 20ms; see Documentation/timers/timers-howto.txt 3  WARNING:
> Prefer pr_debug(... to printk(KERN_DEBUG, ... 3  WARNING: Prefer
> pr_warn(... to printk(KERN_WARNING, ... 6  WARNING: Prefer
> pr_info(... to printk(KERN_INFO, ... 19  WARNING: Prefer pr_err(...
> to printk(KERN_ERR, ...
> 
> And added pr_fmt.
> 
> Signed-off-by: Toshiaki Yamane <yamanetoshi@gmail.com>
> ---
>  drivers/staging/olpc_dcon/olpc_dcon.c        |   53
> ++++++++++++--------------
> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c   |   15 ++++---
> drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c |    6 ++- 3 files
> changed, 37 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c
> b/drivers/staging/olpc_dcon/olpc_dcon.c index 992275c..280751a 100644
> --- a/drivers/staging/olpc_dcon/olpc_dcon.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon.c
> @@ -11,6 +11,7 @@
>   * License as published by the Free Software Foundation.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>  
>  #include <linux/kernel.h>
>  #include <linux/fb.h>
> @@ -71,18 +72,16 @@ static int dcon_hw_init(struct dcon_priv *dcon,
> int is_init) 
>  	ver = dcon_read(dcon, DCON_REG_ID);
>  	if ((ver >> 8) != 0xDC) {
> -		printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx:
> 0x%04x instead.\n",
> -			ver);
> +		pr_err("DCON ID not 0xDCxx: 0x%04x instead.\n", ver);
>  		rc = -ENXIO;
>  		goto err;
>  	}
>  
>  	if (is_init) {
> -		printk(KERN_INFO "olpc-dcon:  Discovered DCON
> version %x\n",
> -				ver & 0xFF);
> +		pr_info("Discovered DCON version %x\n", ver & 0xFF);
>  		rc = pdata->init(dcon);
>  		if (rc != 0) {
> -			printk(KERN_ERR "olpc-dcon:  Unable to
> init.\n");
> +			pr_err("Unable to init.\n");
>  			goto err;
>  		}
>  	}
> @@ -136,8 +135,7 @@ power_up:
>  		x = 1;
>  		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL,
> 0); if (x) {
> -			printk(KERN_WARNING "olpc-dcon:  unable to
> force dcon to power up: %d!\n",
> -				x);
> +			pr_warn("unable to force dcon to power up:
> %d!\n", x); return x;
>  		}
>  		msleep(10); /* we'll be conservative */
> @@ -150,7 +148,7 @@ power_up:
>  		x = dcon_read(dcon, DCON_REG_ID);
>  	}
>  	if (x < 0) {
> -		printk(KERN_ERR "olpc-dcon:  unable to stabilize
> dcon's smbus, reasserting power and praying.\n");
> +		pr_err("unable to stabilize dcon's smbus,
> reasserting power and praying.\n");
> BUG_ON(olpc_board_at_least(olpc_board(0xc2))); x = 0;
>  		olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
> @@ -221,8 +219,7 @@ static void dcon_sleep(struct dcon_priv *dcon,
> bool sleep) x = 0;
>  		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL,
> 0); if (x)
> -			printk(KERN_WARNING "olpc-dcon:  unable to
> force dcon to power down: %d!\n",
> -				x);
> +			pr_warn("unable to force dcon to power down:
> %d!\n", x); else
>  			dcon->asleep = sleep;
>  	} else {
> @@ -231,8 +228,7 @@ static void dcon_sleep(struct dcon_priv *dcon,
> bool sleep) dcon->disp_mode |= MODE_BL_ENABLE;
>  		x = dcon_bus_stabilize(dcon, 1);
>  		if (x)
> -			printk(KERN_WARNING "olpc-dcon:  unable to
> reinit dcon hardware: %d!\n",
> -				x);
> +			pr_warn("unable to reinit dcon hardware:
> %d!\n", x); else
>  			dcon->asleep = sleep;
>  
> @@ -303,12 +299,11 @@ static void dcon_source_switch(struct
> work_struct *work) 
>  	switch (source) {
>  	case DCON_SOURCE_CPU:
> -		printk(KERN_INFO "dcon_source_switch to CPU\n");
> +		pr_info("dcon_source_switch to CPU\n");
>  		/* Enable the scanline interrupt bit */
>  		if (dcon_write(dcon, DCON_REG_MODE,
>  				dcon->disp_mode | MODE_SCAN_INT))
> -			printk(KERN_ERR
> -			       "olpc-dcon:  couldn't enable scanline
> interrupt!\n");
> +			pr_err("couldn't enable scanline
> interrupt!\n"); else {
>  			/* Wait up to one second for the scanline
> interrupt */ wait_event_timeout(dcon_wait_queue,
> @@ -316,11 +311,11 @@ static void dcon_source_switch(struct
> work_struct *work) }
>  
>  		if (!dcon->switched)
> -			printk(KERN_ERR "olpc-dcon:  Timeout
> entering CPU mode; expect a screen glitch.\n");
> +			pr_err("Timeout entering CPU mode; expect a
> screen glitch.\n"); 
>  		/* Turn off the scanline interrupt */
>  		if (dcon_write(dcon, DCON_REG_MODE, dcon->disp_mode))
> -			printk(KERN_ERR "olpc-dcon:  couldn't
> disable scanline interrupt!\n");
> +			pr_err("couldn't disable scanline
> interrupt!\n"); 
>  		/*
>  		 * Ideally we'd like to disable interrupts here so
> that the @@ -331,7 +326,7 @@ static void dcon_source_switch(struct
> work_struct *work)
>  		 * For now, we just hope..
>  		 */
>  		if (!dcon_blank_fb(dcon, false)) {
> -			printk(KERN_ERR "olpc-dcon:  Failed to enter
> CPU mode\n");
> +			pr_err("Failed to enter CPU mode\n");
>  			dcon->pending_src = DCON_SOURCE_DCON;
>  			return;
>  		}
> @@ -340,14 +335,14 @@ static void dcon_source_switch(struct
> work_struct *work) pdata->set_dconload(1);
>  		getnstimeofday(&dcon->load_time);
>  
> -		printk(KERN_INFO "olpc-dcon: The CPU has control\n");
> +		pr_info("The CPU has control\n");
>  		break;
>  	case DCON_SOURCE_DCON:
>  	{
>  		int t;
>  		struct timespec delta_t;
>  
> -		printk(KERN_INFO "dcon_source_switch to DCON\n");
> +		pr_info("dcon_source_switch to DCON\n");
>  
>  		add_wait_queue(&dcon_wait_queue, &wait);
>  		set_current_state(TASK_UNINTERRUPTIBLE);
> @@ -361,7 +356,7 @@ static void dcon_source_switch(struct work_struct
> *work) set_current_state(TASK_RUNNING);
>  
>  		if (!dcon->switched) {
> -			printk(KERN_ERR "olpc-dcon: Timeout entering
> DCON mode; expect a screen glitch.\n");
> +			pr_err("Timeout entering DCON mode; expect a
> screen glitch.\n"); } else {
>  			/* sometimes the DCON doesn't follow its own
> rules,
>  			 * and doesn't wait for two vsync pulses
> before @@ -377,7 +372,7 @@ static void dcon_source_switch(struct
> work_struct *work) delta_t = timespec_sub(dcon->irq_time,
> dcon->load_time); if (dcon->switched && delta_t.tv_sec == 0 &&
>  					delta_t.tv_nsec <
> NSEC_PER_MSEC * 20) {
> -				printk(KERN_ERR "olpc-dcon: missed
> loading, retrying\n");
> +				pr_err("missed loading, retrying\n");
>  				pdata->set_dconload(1);
>  				mdelay(41);
>  				pdata->set_dconload(0);
> @@ -387,7 +382,7 @@ static void dcon_source_switch(struct work_struct
> *work) }
>  
>  		dcon_blank_fb(dcon, true);
> -		printk(KERN_INFO "olpc-dcon: The DCON has
> control\n");
> +		pr_info("The DCON has control\n");
>  		break;
>  	}
>  	default:
> @@ -475,7 +470,7 @@ static ssize_t dcon_freeze_store(struct device
> *dev, if (ret)
>  		return ret;
>  
> -	printk(KERN_INFO "dcon_freeze_store: %lu\n", output);
> +	pr_info("dcon_freeze_store: %lu\n", output);
>  
>  	switch (output) {
>  	case 0:
> @@ -649,7 +644,7 @@ static int dcon_probe(struct i2c_client *client,
> const struct i2c_device_id *id) dcon_device =
> platform_device_alloc("dcon", -1); 
>  	if (dcon_device == NULL) {
> -		printk(KERN_ERR "dcon:  Unable to create the DCON
> device\n");
> +		pr_err("Unable to create the DCON device\n");
>  		rc = -ENOMEM;
>  		goto eirq;
>  	}
> @@ -657,7 +652,7 @@ static int dcon_probe(struct i2c_client *client,
> const struct i2c_device_id *id) platform_set_drvdata(dcon_device,
> dcon); 
>  	if (rc) {
> -		printk(KERN_ERR "dcon:  Unable to add the DCON
> device\n");
> +		pr_err("Unable to add the DCON device\n");
>  		goto edev;
>  	}
>  
> @@ -761,7 +756,7 @@ irqreturn_t dcon_interrupt(int irq, void *id)
>  
>  	switch (status & 3) {
>  	case 3:
> -		printk(KERN_DEBUG "olpc-dcon: DCONLOAD_MISSED
> interrupt\n");
> +		pr_debug("DCONLOAD_MISSED interrupt\n");
>  		break;
>  
>  	case 2:	/* switch to DCON mode */
> @@ -783,9 +778,9 @@ irqreturn_t dcon_interrupt(int irq, void *id)
>  			dcon->switched = true;
>  			getnstimeofday(&dcon->irq_time);
>  			wake_up(&dcon_wait_queue);
> -			printk(KERN_DEBUG "olpc-dcon: switching w/
> status 0/0\n");
> +			pr_debug("switching w/ status 0/0\n");
>  		} else {
> -			printk(KERN_DEBUG "olpc-dcon: scanline
> interrupt w/CPU\n");
> +			pr_debug("scanline interrupt w/CPU\n");
>  		}
>  	}
>  
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
> b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c index c87fdfa..77e8eb5
> 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
> @@ -10,6 +10,9 @@
>   * modify it under the terms of version 2 of the GNU General Public
>   * License as published by the Free Software Foundation.
>   */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/cs5535.h>
>  #include <linux/gpio.h>
>  #include <linux/delay.h>
> @@ -22,23 +25,23 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
>  	unsigned char lob;
>  
>  	if (gpio_request(OLPC_GPIO_DCON_STAT0, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request STAT0
> GPIO\n");
> +		pr_err("failed to request STAT0 GPIO\n");
>  		return -EIO;
>  	}
>  	if (gpio_request(OLPC_GPIO_DCON_STAT1, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request STAT1
> GPIO\n");
> +		pr_err("failed to request STAT1 GPIO\n");
>  		goto err_gp_stat1;
>  	}
>  	if (gpio_request(OLPC_GPIO_DCON_IRQ, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request IRQ
> GPIO\n");
> +		pr_err("failed to request IRQ GPIO\n");
>  		goto err_gp_irq;
>  	}
>  	if (gpio_request(OLPC_GPIO_DCON_LOAD, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request LOAD
> GPIO\n");
> +		pr_err("failed to request LOAD GPIO\n");
>  		goto err_gp_load;
>  	}
>  	if (gpio_request(OLPC_GPIO_DCON_BLANK, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request BLANK
> GPIO\n");
> +		pr_err("failed to request BLANK GPIO\n");
>  		goto err_gp_blank;
>  	}
>  
> @@ -83,7 +86,7 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
>  
>  	/* Register the interrupt handler */
>  	if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon))
> {
> -		printk(KERN_ERR "olpc-dcon: failed to request DCON's
> irq\n");
> +		pr_err("failed to request DCON's irq\n");
>  		goto err_req_irq;
>  	}
>  
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
> b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c index 69415ee..352dd3d
> 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
> @@ -6,6 +6,8 @@
>   * License as published by the Free Software Foundation.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/acpi.h>
>  #include <linux/delay.h>
>  #include <linux/pci.h>
> @@ -66,7 +68,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
>  	pdev = pci_get_device(PCI_VENDOR_ID_VIA,
>  			      PCI_DEVICE_ID_VIA_VX855, NULL);
>  	if (!pdev) {
> -		printk(KERN_ERR "cannot find VX855 PCI ID\n");
> +		pr_err("cannot find VX855 PCI ID\n");
>  		return 1;
>  	}
>  
> @@ -104,7 +106,7 @@ static int dcon_init_xo_1_5(struct dcon_priv
> *dcon) /* we're sharing the IRQ with ACPI */
>  	irq = acpi_gbl_FADT.sci_interrupt;
>  	if (request_irq(irq, &dcon_interrupt, IRQF_SHARED, "DCON",
> dcon)) {
> -		printk(KERN_ERR PREFIX "DCON (IRQ%d) allocation
> failed\n", irq);
> +		pr_err("DCON (IRQ%d) allocation failed\n", irq);
>  		return 1;
>  	}
>  


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-27 11:45 ` Toshiaki Yamane
  2012-07-27 18:25   ` Andres Salomon
@ 2012-08-14  2:21   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-14  2:21 UTC (permalink / raw)
  To: Toshiaki Yamane
  Cc: Andres Salomon, Chris Ball, Jon Nettleton, Joe Perches,
	linux-kernel

On Fri, Jul 27, 2012 at 08:45:52PM +0900, Toshiaki Yamane wrote:
> fixed some checkpatch warnings.
> (Excluding -WARNING: msleep < 20ms can sleep for up to 20ms-)

Then fix your changelog entry:

> 
> $ find drivers/staging/olpc_dcon/ -name "*.[ch]"|xargs ./scripts/checkpatch.pl \
> -f --terse --nosummary|cut -f3- -d":"|sort |uniq -c|sort -n
>       2  WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt

That shouldn't be there.

greg k-h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-07-26 23:49 [PATCH] staging/olpc_dcon: fix checkpatch warnings Toshiaki Yamane
                   ` (3 preceding siblings ...)
  2012-07-27 11:45 ` Toshiaki Yamane
@ 2012-08-17  5:37 ` Toshiaki Yamane
  2012-08-17  7:02   ` Andres Salomon
  4 siblings, 1 reply; 13+ messages in thread
From: Toshiaki Yamane @ 2012-08-17  5:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andres Salomon, Chris Ball, Jon Nettleton, linux-kernel,
	Toshiaki Yamane

The below checkpatch warnings was fixed,

-  WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
-  WARNING: Prefer pr_warn(... to printk(KERN_WARNING, ...
-  WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
-  WARNING: Prefer pr_err(... to printk(KERN_ERR, ...

And added pr_fmt.

Signed-off-by: Toshiaki Yamane <yamanetoshi@gmail.com>
---
 drivers/staging/olpc_dcon/olpc_dcon.c        |   53 ++++++++++++--------------
 drivers/staging/olpc_dcon/olpc_dcon_xo_1.c   |   15 ++++---
 drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c |    6 ++-
 3 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
index 992275c..280751a 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -11,6 +11,7 @@
  * License as published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
 #include <linux/fb.h>
@@ -71,18 +72,16 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
 
 	ver = dcon_read(dcon, DCON_REG_ID);
 	if ((ver >> 8) != 0xDC) {
-		printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx: 0x%04x instead.\n",
-			ver);
+		pr_err("DCON ID not 0xDCxx: 0x%04x instead.\n", ver);
 		rc = -ENXIO;
 		goto err;
 	}
 
 	if (is_init) {
-		printk(KERN_INFO "olpc-dcon:  Discovered DCON version %x\n",
-				ver & 0xFF);
+		pr_info("Discovered DCON version %x\n", ver & 0xFF);
 		rc = pdata->init(dcon);
 		if (rc != 0) {
-			printk(KERN_ERR "olpc-dcon:  Unable to init.\n");
+			pr_err("Unable to init.\n");
 			goto err;
 		}
 	}
@@ -136,8 +135,7 @@ power_up:
 		x = 1;
 		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
 		if (x) {
-			printk(KERN_WARNING "olpc-dcon:  unable to force dcon to power up: %d!\n",
-				x);
+			pr_warn("unable to force dcon to power up: %d!\n", x);
 			return x;
 		}
 		msleep(10); /* we'll be conservative */
@@ -150,7 +148,7 @@ power_up:
 		x = dcon_read(dcon, DCON_REG_ID);
 	}
 	if (x < 0) {
-		printk(KERN_ERR "olpc-dcon:  unable to stabilize dcon's smbus, reasserting power and praying.\n");
+		pr_err("unable to stabilize dcon's smbus, reasserting power and praying.\n");
 		BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
 		x = 0;
 		olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
@@ -221,8 +219,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
 		x = 0;
 		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
 		if (x)
-			printk(KERN_WARNING "olpc-dcon:  unable to force dcon to power down: %d!\n",
-				x);
+			pr_warn("unable to force dcon to power down: %d!\n", x);
 		else
 			dcon->asleep = sleep;
 	} else {
@@ -231,8 +228,7 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
 			dcon->disp_mode |= MODE_BL_ENABLE;
 		x = dcon_bus_stabilize(dcon, 1);
 		if (x)
-			printk(KERN_WARNING "olpc-dcon:  unable to reinit dcon hardware: %d!\n",
-				x);
+			pr_warn("unable to reinit dcon hardware: %d!\n", x);
 		else
 			dcon->asleep = sleep;
 
@@ -303,12 +299,11 @@ static void dcon_source_switch(struct work_struct *work)
 
 	switch (source) {
 	case DCON_SOURCE_CPU:
-		printk(KERN_INFO "dcon_source_switch to CPU\n");
+		pr_info("dcon_source_switch to CPU\n");
 		/* Enable the scanline interrupt bit */
 		if (dcon_write(dcon, DCON_REG_MODE,
 				dcon->disp_mode | MODE_SCAN_INT))
-			printk(KERN_ERR
-			       "olpc-dcon:  couldn't enable scanline interrupt!\n");
+			pr_err("couldn't enable scanline interrupt!\n");
 		else {
 			/* Wait up to one second for the scanline interrupt */
 			wait_event_timeout(dcon_wait_queue,
@@ -316,11 +311,11 @@ static void dcon_source_switch(struct work_struct *work)
 		}
 
 		if (!dcon->switched)
-			printk(KERN_ERR "olpc-dcon:  Timeout entering CPU mode; expect a screen glitch.\n");
+			pr_err("Timeout entering CPU mode; expect a screen glitch.\n");
 
 		/* Turn off the scanline interrupt */
 		if (dcon_write(dcon, DCON_REG_MODE, dcon->disp_mode))
-			printk(KERN_ERR "olpc-dcon:  couldn't disable scanline interrupt!\n");
+			pr_err("couldn't disable scanline interrupt!\n");
 
 		/*
 		 * Ideally we'd like to disable interrupts here so that the
@@ -331,7 +326,7 @@ static void dcon_source_switch(struct work_struct *work)
 		 * For now, we just hope..
 		 */
 		if (!dcon_blank_fb(dcon, false)) {
-			printk(KERN_ERR "olpc-dcon:  Failed to enter CPU mode\n");
+			pr_err("Failed to enter CPU mode\n");
 			dcon->pending_src = DCON_SOURCE_DCON;
 			return;
 		}
@@ -340,14 +335,14 @@ static void dcon_source_switch(struct work_struct *work)
 		pdata->set_dconload(1);
 		getnstimeofday(&dcon->load_time);
 
-		printk(KERN_INFO "olpc-dcon: The CPU has control\n");
+		pr_info("The CPU has control\n");
 		break;
 	case DCON_SOURCE_DCON:
 	{
 		int t;
 		struct timespec delta_t;
 
-		printk(KERN_INFO "dcon_source_switch to DCON\n");
+		pr_info("dcon_source_switch to DCON\n");
 
 		add_wait_queue(&dcon_wait_queue, &wait);
 		set_current_state(TASK_UNINTERRUPTIBLE);
@@ -361,7 +356,7 @@ static void dcon_source_switch(struct work_struct *work)
 		set_current_state(TASK_RUNNING);
 
 		if (!dcon->switched) {
-			printk(KERN_ERR "olpc-dcon: Timeout entering DCON mode; expect a screen glitch.\n");
+			pr_err("Timeout entering DCON mode; expect a screen glitch.\n");
 		} else {
 			/* sometimes the DCON doesn't follow its own rules,
 			 * and doesn't wait for two vsync pulses before
@@ -377,7 +372,7 @@ static void dcon_source_switch(struct work_struct *work)
 			delta_t = timespec_sub(dcon->irq_time, dcon->load_time);
 			if (dcon->switched && delta_t.tv_sec == 0 &&
 					delta_t.tv_nsec < NSEC_PER_MSEC * 20) {
-				printk(KERN_ERR "olpc-dcon: missed loading, retrying\n");
+				pr_err("missed loading, retrying\n");
 				pdata->set_dconload(1);
 				mdelay(41);
 				pdata->set_dconload(0);
@@ -387,7 +382,7 @@ static void dcon_source_switch(struct work_struct *work)
 		}
 
 		dcon_blank_fb(dcon, true);
-		printk(KERN_INFO "olpc-dcon: The DCON has control\n");
+		pr_info("The DCON has control\n");
 		break;
 	}
 	default:
@@ -475,7 +470,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
 	if (ret)
 		return ret;
 
-	printk(KERN_INFO "dcon_freeze_store: %lu\n", output);
+	pr_info("dcon_freeze_store: %lu\n", output);
 
 	switch (output) {
 	case 0:
@@ -649,7 +644,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	dcon_device = platform_device_alloc("dcon", -1);
 
 	if (dcon_device == NULL) {
-		printk(KERN_ERR "dcon:  Unable to create the DCON device\n");
+		pr_err("Unable to create the DCON device\n");
 		rc = -ENOMEM;
 		goto eirq;
 	}
@@ -657,7 +652,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	platform_set_drvdata(dcon_device, dcon);
 
 	if (rc) {
-		printk(KERN_ERR "dcon:  Unable to add the DCON device\n");
+		pr_err("Unable to add the DCON device\n");
 		goto edev;
 	}
 
@@ -761,7 +756,7 @@ irqreturn_t dcon_interrupt(int irq, void *id)
 
 	switch (status & 3) {
 	case 3:
-		printk(KERN_DEBUG "olpc-dcon: DCONLOAD_MISSED interrupt\n");
+		pr_debug("DCONLOAD_MISSED interrupt\n");
 		break;
 
 	case 2:	/* switch to DCON mode */
@@ -783,9 +778,9 @@ irqreturn_t dcon_interrupt(int irq, void *id)
 			dcon->switched = true;
 			getnstimeofday(&dcon->irq_time);
 			wake_up(&dcon_wait_queue);
-			printk(KERN_DEBUG "olpc-dcon: switching w/ status 0/0\n");
+			pr_debug("switching w/ status 0/0\n");
 		} else {
-			printk(KERN_DEBUG "olpc-dcon: scanline interrupt w/CPU\n");
+			pr_debug("scanline interrupt w/CPU\n");
 		}
 	}
 
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
index c87fdfa..77e8eb5 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
@@ -10,6 +10,9 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/cs5535.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
@@ -22,23 +25,23 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 	unsigned char lob;
 
 	if (gpio_request(OLPC_GPIO_DCON_STAT0, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request STAT0 GPIO\n");
+		pr_err("failed to request STAT0 GPIO\n");
 		return -EIO;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_STAT1, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request STAT1 GPIO\n");
+		pr_err("failed to request STAT1 GPIO\n");
 		goto err_gp_stat1;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_IRQ, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request IRQ GPIO\n");
+		pr_err("failed to request IRQ GPIO\n");
 		goto err_gp_irq;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_LOAD, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request LOAD GPIO\n");
+		pr_err("failed to request LOAD GPIO\n");
 		goto err_gp_load;
 	}
 	if (gpio_request(OLPC_GPIO_DCON_BLANK, "OLPC-DCON")) {
-		printk(KERN_ERR "olpc-dcon: failed to request BLANK GPIO\n");
+		pr_err("failed to request BLANK GPIO\n");
 		goto err_gp_blank;
 	}
 
@@ -83,7 +86,7 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 
 	/* Register the interrupt handler */
 	if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon)) {
-		printk(KERN_ERR "olpc-dcon: failed to request DCON's irq\n");
+		pr_err("failed to request DCON's irq\n");
 		goto err_req_irq;
 	}
 
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
index 69415ee..352dd3d 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
@@ -6,6 +6,8 @@
  * License as published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/acpi.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
@@ -66,7 +68,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
 	pdev = pci_get_device(PCI_VENDOR_ID_VIA,
 			      PCI_DEVICE_ID_VIA_VX855, NULL);
 	if (!pdev) {
-		printk(KERN_ERR "cannot find VX855 PCI ID\n");
+		pr_err("cannot find VX855 PCI ID\n");
 		return 1;
 	}
 
@@ -104,7 +106,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
 	/* we're sharing the IRQ with ACPI */
 	irq = acpi_gbl_FADT.sci_interrupt;
 	if (request_irq(irq, &dcon_interrupt, IRQF_SHARED, "DCON", dcon)) {
-		printk(KERN_ERR PREFIX "DCON (IRQ%d) allocation failed\n", irq);
+		pr_err("DCON (IRQ%d) allocation failed\n", irq);
 		return 1;
 	}
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] staging/olpc_dcon: fix checkpatch warnings
  2012-08-17  5:37 ` Toshiaki Yamane
@ 2012-08-17  7:02   ` Andres Salomon
  0 siblings, 0 replies; 13+ messages in thread
From: Andres Salomon @ 2012-08-17  7:02 UTC (permalink / raw)
  To: Toshiaki Yamane
  Cc: Greg Kroah-Hartman, Chris Ball, Jon Nettleton, linux-kernel

Looks good to me, thanks.

Acked-by: Andres Salomon <dilinger@queued.net>

On Fri, 17 Aug 2012 14:37:21 +0900
Toshiaki Yamane <yamanetoshi@gmail.com> wrote:

> The below checkpatch warnings was fixed,
> 
> -  WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
> -  WARNING: Prefer pr_warn(... to printk(KERN_WARNING, ...
> -  WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
> -  WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
> 
> And added pr_fmt.
> 
> Signed-off-by: Toshiaki Yamane <yamanetoshi@gmail.com>
> ---
>  drivers/staging/olpc_dcon/olpc_dcon.c        |   53
> ++++++++++++--------------
> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c   |   15 ++++---
> drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c |    6 ++- 3 files
> changed, 37 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c
> b/drivers/staging/olpc_dcon/olpc_dcon.c index 992275c..280751a 100644
> --- a/drivers/staging/olpc_dcon/olpc_dcon.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon.c
> @@ -11,6 +11,7 @@
>   * License as published by the Free Software Foundation.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>  
>  #include <linux/kernel.h>
>  #include <linux/fb.h>
> @@ -71,18 +72,16 @@ static int dcon_hw_init(struct dcon_priv *dcon,
> int is_init) 
>  	ver = dcon_read(dcon, DCON_REG_ID);
>  	if ((ver >> 8) != 0xDC) {
> -		printk(KERN_ERR "olpc-dcon:  DCON ID not 0xDCxx:
> 0x%04x instead.\n",
> -			ver);
> +		pr_err("DCON ID not 0xDCxx: 0x%04x instead.\n", ver);
>  		rc = -ENXIO;
>  		goto err;
>  	}
>  
>  	if (is_init) {
> -		printk(KERN_INFO "olpc-dcon:  Discovered DCON
> version %x\n",
> -				ver & 0xFF);
> +		pr_info("Discovered DCON version %x\n", ver & 0xFF);
>  		rc = pdata->init(dcon);
>  		if (rc != 0) {
> -			printk(KERN_ERR "olpc-dcon:  Unable to
> init.\n");
> +			pr_err("Unable to init.\n");
>  			goto err;
>  		}
>  	}
> @@ -136,8 +135,7 @@ power_up:
>  		x = 1;
>  		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL,
> 0); if (x) {
> -			printk(KERN_WARNING "olpc-dcon:  unable to
> force dcon to power up: %d!\n",
> -				x);
> +			pr_warn("unable to force dcon to power up:
> %d!\n", x); return x;
>  		}
>  		msleep(10); /* we'll be conservative */
> @@ -150,7 +148,7 @@ power_up:
>  		x = dcon_read(dcon, DCON_REG_ID);
>  	}
>  	if (x < 0) {
> -		printk(KERN_ERR "olpc-dcon:  unable to stabilize
> dcon's smbus, reasserting power and praying.\n");
> +		pr_err("unable to stabilize dcon's smbus,
> reasserting power and praying.\n");
> BUG_ON(olpc_board_at_least(olpc_board(0xc2))); x = 0;
>  		olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL, 0);
> @@ -221,8 +219,7 @@ static void dcon_sleep(struct dcon_priv *dcon,
> bool sleep) x = 0;
>  		x = olpc_ec_cmd(0x26, (unsigned char *)&x, 1, NULL,
> 0); if (x)
> -			printk(KERN_WARNING "olpc-dcon:  unable to
> force dcon to power down: %d!\n",
> -				x);
> +			pr_warn("unable to force dcon to power down:
> %d!\n", x); else
>  			dcon->asleep = sleep;
>  	} else {
> @@ -231,8 +228,7 @@ static void dcon_sleep(struct dcon_priv *dcon,
> bool sleep) dcon->disp_mode |= MODE_BL_ENABLE;
>  		x = dcon_bus_stabilize(dcon, 1);
>  		if (x)
> -			printk(KERN_WARNING "olpc-dcon:  unable to
> reinit dcon hardware: %d!\n",
> -				x);
> +			pr_warn("unable to reinit dcon hardware:
> %d!\n", x); else
>  			dcon->asleep = sleep;
>  
> @@ -303,12 +299,11 @@ static void dcon_source_switch(struct
> work_struct *work) 
>  	switch (source) {
>  	case DCON_SOURCE_CPU:
> -		printk(KERN_INFO "dcon_source_switch to CPU\n");
> +		pr_info("dcon_source_switch to CPU\n");
>  		/* Enable the scanline interrupt bit */
>  		if (dcon_write(dcon, DCON_REG_MODE,
>  				dcon->disp_mode | MODE_SCAN_INT))
> -			printk(KERN_ERR
> -			       "olpc-dcon:  couldn't enable scanline
> interrupt!\n");
> +			pr_err("couldn't enable scanline
> interrupt!\n"); else {
>  			/* Wait up to one second for the scanline
> interrupt */ wait_event_timeout(dcon_wait_queue,
> @@ -316,11 +311,11 @@ static void dcon_source_switch(struct
> work_struct *work) }
>  
>  		if (!dcon->switched)
> -			printk(KERN_ERR "olpc-dcon:  Timeout
> entering CPU mode; expect a screen glitch.\n");
> +			pr_err("Timeout entering CPU mode; expect a
> screen glitch.\n"); 
>  		/* Turn off the scanline interrupt */
>  		if (dcon_write(dcon, DCON_REG_MODE, dcon->disp_mode))
> -			printk(KERN_ERR "olpc-dcon:  couldn't
> disable scanline interrupt!\n");
> +			pr_err("couldn't disable scanline
> interrupt!\n"); 
>  		/*
>  		 * Ideally we'd like to disable interrupts here so
> that the @@ -331,7 +326,7 @@ static void dcon_source_switch(struct
> work_struct *work)
>  		 * For now, we just hope..
>  		 */
>  		if (!dcon_blank_fb(dcon, false)) {
> -			printk(KERN_ERR "olpc-dcon:  Failed to enter
> CPU mode\n");
> +			pr_err("Failed to enter CPU mode\n");
>  			dcon->pending_src = DCON_SOURCE_DCON;
>  			return;
>  		}
> @@ -340,14 +335,14 @@ static void dcon_source_switch(struct
> work_struct *work) pdata->set_dconload(1);
>  		getnstimeofday(&dcon->load_time);
>  
> -		printk(KERN_INFO "olpc-dcon: The CPU has control\n");
> +		pr_info("The CPU has control\n");
>  		break;
>  	case DCON_SOURCE_DCON:
>  	{
>  		int t;
>  		struct timespec delta_t;
>  
> -		printk(KERN_INFO "dcon_source_switch to DCON\n");
> +		pr_info("dcon_source_switch to DCON\n");
>  
>  		add_wait_queue(&dcon_wait_queue, &wait);
>  		set_current_state(TASK_UNINTERRUPTIBLE);
> @@ -361,7 +356,7 @@ static void dcon_source_switch(struct work_struct
> *work) set_current_state(TASK_RUNNING);
>  
>  		if (!dcon->switched) {
> -			printk(KERN_ERR "olpc-dcon: Timeout entering
> DCON mode; expect a screen glitch.\n");
> +			pr_err("Timeout entering DCON mode; expect a
> screen glitch.\n"); } else {
>  			/* sometimes the DCON doesn't follow its own
> rules,
>  			 * and doesn't wait for two vsync pulses
> before @@ -377,7 +372,7 @@ static void dcon_source_switch(struct
> work_struct *work) delta_t = timespec_sub(dcon->irq_time,
> dcon->load_time); if (dcon->switched && delta_t.tv_sec == 0 &&
>  					delta_t.tv_nsec <
> NSEC_PER_MSEC * 20) {
> -				printk(KERN_ERR "olpc-dcon: missed
> loading, retrying\n");
> +				pr_err("missed loading, retrying\n");
>  				pdata->set_dconload(1);
>  				mdelay(41);
>  				pdata->set_dconload(0);
> @@ -387,7 +382,7 @@ static void dcon_source_switch(struct work_struct
> *work) }
>  
>  		dcon_blank_fb(dcon, true);
> -		printk(KERN_INFO "olpc-dcon: The DCON has
> control\n");
> +		pr_info("The DCON has control\n");
>  		break;
>  	}
>  	default:
> @@ -475,7 +470,7 @@ static ssize_t dcon_freeze_store(struct device
> *dev, if (ret)
>  		return ret;
>  
> -	printk(KERN_INFO "dcon_freeze_store: %lu\n", output);
> +	pr_info("dcon_freeze_store: %lu\n", output);
>  
>  	switch (output) {
>  	case 0:
> @@ -649,7 +644,7 @@ static int dcon_probe(struct i2c_client *client,
> const struct i2c_device_id *id) dcon_device =
> platform_device_alloc("dcon", -1); 
>  	if (dcon_device == NULL) {
> -		printk(KERN_ERR "dcon:  Unable to create the DCON
> device\n");
> +		pr_err("Unable to create the DCON device\n");
>  		rc = -ENOMEM;
>  		goto eirq;
>  	}
> @@ -657,7 +652,7 @@ static int dcon_probe(struct i2c_client *client,
> const struct i2c_device_id *id) platform_set_drvdata(dcon_device,
> dcon); 
>  	if (rc) {
> -		printk(KERN_ERR "dcon:  Unable to add the DCON
> device\n");
> +		pr_err("Unable to add the DCON device\n");
>  		goto edev;
>  	}
>  
> @@ -761,7 +756,7 @@ irqreturn_t dcon_interrupt(int irq, void *id)
>  
>  	switch (status & 3) {
>  	case 3:
> -		printk(KERN_DEBUG "olpc-dcon: DCONLOAD_MISSED
> interrupt\n");
> +		pr_debug("DCONLOAD_MISSED interrupt\n");
>  		break;
>  
>  	case 2:	/* switch to DCON mode */
> @@ -783,9 +778,9 @@ irqreturn_t dcon_interrupt(int irq, void *id)
>  			dcon->switched = true;
>  			getnstimeofday(&dcon->irq_time);
>  			wake_up(&dcon_wait_queue);
> -			printk(KERN_DEBUG "olpc-dcon: switching w/
> status 0/0\n");
> +			pr_debug("switching w/ status 0/0\n");
>  		} else {
> -			printk(KERN_DEBUG "olpc-dcon: scanline
> interrupt w/CPU\n");
> +			pr_debug("scanline interrupt w/CPU\n");
>  		}
>  	}
>  
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
> b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c index c87fdfa..77e8eb5
> 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
> @@ -10,6 +10,9 @@
>   * modify it under the terms of version 2 of the GNU General Public
>   * License as published by the Free Software Foundation.
>   */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/cs5535.h>
>  #include <linux/gpio.h>
>  #include <linux/delay.h>
> @@ -22,23 +25,23 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
>  	unsigned char lob;
>  
>  	if (gpio_request(OLPC_GPIO_DCON_STAT0, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request STAT0
> GPIO\n");
> +		pr_err("failed to request STAT0 GPIO\n");
>  		return -EIO;
>  	}
>  	if (gpio_request(OLPC_GPIO_DCON_STAT1, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request STAT1
> GPIO\n");
> +		pr_err("failed to request STAT1 GPIO\n");
>  		goto err_gp_stat1;
>  	}
>  	if (gpio_request(OLPC_GPIO_DCON_IRQ, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request IRQ
> GPIO\n");
> +		pr_err("failed to request IRQ GPIO\n");
>  		goto err_gp_irq;
>  	}
>  	if (gpio_request(OLPC_GPIO_DCON_LOAD, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request LOAD
> GPIO\n");
> +		pr_err("failed to request LOAD GPIO\n");
>  		goto err_gp_load;
>  	}
>  	if (gpio_request(OLPC_GPIO_DCON_BLANK, "OLPC-DCON")) {
> -		printk(KERN_ERR "olpc-dcon: failed to request BLANK
> GPIO\n");
> +		pr_err("failed to request BLANK GPIO\n");
>  		goto err_gp_blank;
>  	}
>  
> @@ -83,7 +86,7 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
>  
>  	/* Register the interrupt handler */
>  	if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon))
> {
> -		printk(KERN_ERR "olpc-dcon: failed to request DCON's
> irq\n");
> +		pr_err("failed to request DCON's irq\n");
>  		goto err_req_irq;
>  	}
>  
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
> b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c index 69415ee..352dd3d
> 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
> @@ -6,6 +6,8 @@
>   * License as published by the Free Software Foundation.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/acpi.h>
>  #include <linux/delay.h>
>  #include <linux/pci.h>
> @@ -66,7 +68,7 @@ static int dcon_init_xo_1_5(struct dcon_priv *dcon)
>  	pdev = pci_get_device(PCI_VENDOR_ID_VIA,
>  			      PCI_DEVICE_ID_VIA_VX855, NULL);
>  	if (!pdev) {
> -		printk(KERN_ERR "cannot find VX855 PCI ID\n");
> +		pr_err("cannot find VX855 PCI ID\n");
>  		return 1;
>  	}
>  
> @@ -104,7 +106,7 @@ static int dcon_init_xo_1_5(struct dcon_priv
> *dcon) /* we're sharing the IRQ with ACPI */
>  	irq = acpi_gbl_FADT.sci_interrupt;
>  	if (request_irq(irq, &dcon_interrupt, IRQF_SHARED, "DCON",
> dcon)) {
> -		printk(KERN_ERR PREFIX "DCON (IRQ%d) allocation
> failed\n", irq);
> +		pr_err("DCON (IRQ%d) allocation failed\n", irq);
>  		return 1;
>  	}
>  


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-08-17  7:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-26 23:49 [PATCH] staging/olpc_dcon: fix checkpatch warnings Toshiaki Yamane
2012-07-27  1:40 ` Joe Perches
2012-07-27  2:14   ` Toshiaki Yamane
2012-07-27  2:28 ` Andres Salomon
2012-07-27  2:42   ` Toshiaki Yamane
2012-07-27  4:46 ` Toshiaki Yamane
2012-07-27  5:03   ` Joe Perches
2012-07-27  5:05     ` Toshiaki Yamane
2012-07-27 11:45 ` Toshiaki Yamane
2012-07-27 18:25   ` Andres Salomon
2012-08-14  2:21   ` Greg Kroah-Hartman
2012-08-17  5:37 ` Toshiaki Yamane
2012-08-17  7:02   ` Andres Salomon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).