[media] staging/media: Use pr_ printks in lirc/lirc_parallel.c
authorYAMANE Toshiaki <yamanetoshi@gmail.com>
Thu, 8 Nov 2012 18:54:33 +0000 (15:54 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 21 Dec 2012 21:14:54 +0000 (19:14 -0200)
fixed below checkpatch warnings.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
- WARNING: Prefer netdev_notice(netdev, ... then dev_notice(dev, ... then pr_notice(...  to printk(KERN_NOTICE ...
- WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
and add pr_fmt.

Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/media/lirc/lirc_parallel.c

index dd2bca7b56faf4b09afa5f3f6a1207d940507f6a..139920c290caf03d5b6f750700eebd908a16b1e6 100644 (file)
@@ -22,6 +22,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 /*** Includes ***/
 
 #include <linux/module.h>
@@ -115,8 +117,7 @@ static void out(int offset, int value)
                parport_write_control(pport, value);
                break;
        case LIRC_LP_STATUS:
-               printk(KERN_INFO "%s: attempt to write to status register\n",
-                      LIRC_DRIVER_NAME);
+               pr_info("attempt to write to status register\n");
                break;
        }
 }
@@ -166,27 +167,23 @@ static unsigned int init_lirc_timer(void)
                if (default_timer == 0) {
                        /* autodetect timer */
                        newtimer = (1000000*count)/timeelapsed;
-                       printk(KERN_INFO "%s: %u Hz timer detected\n",
-                              LIRC_DRIVER_NAME, newtimer);
+                       pr_info("%u Hz timer detected\n", newtimer);
                        return newtimer;
                }  else {
                        newtimer = (1000000*count)/timeelapsed;
                        if (abs(newtimer - default_timer) > default_timer/10) {
                                /* bad timer */
-                               printk(KERN_NOTICE "%s: bad timer: %u Hz\n",
-                                      LIRC_DRIVER_NAME, newtimer);
-                               printk(KERN_NOTICE "%s: using default timer: "
-                                      "%u Hz\n",
-                                      LIRC_DRIVER_NAME, default_timer);
+                               pr_notice("bad timer: %u Hz\n", newtimer);
+                               pr_notice("using default timer: %u Hz\n",
+                                         default_timer);
                                return default_timer;
                        } else {
-                               printk(KERN_INFO "%s: %u Hz timer detected\n",
-                                      LIRC_DRIVER_NAME, newtimer);
+                               pr_info("%u Hz timer detected\n", newtimer);
                                return newtimer; /* use detected value */
                        }
                }
        } else {
-               printk(KERN_NOTICE "%s: no timer detected\n", LIRC_DRIVER_NAME);
+               pr_notice("no timer detected\n");
                return 0;
        }
 }
@@ -194,13 +191,10 @@ static unsigned int init_lirc_timer(void)
 static int lirc_claim(void)
 {
        if (parport_claim(ppdevice) != 0) {
-               printk(KERN_WARNING "%s: could not claim port\n",
-                      LIRC_DRIVER_NAME);
-               printk(KERN_WARNING "%s: waiting for port becoming available"
-                      "\n", LIRC_DRIVER_NAME);
+               pr_warn("could not claim port\n");
+               pr_warn("waiting for port becoming available\n");
                if (parport_claim_or_block(ppdevice) < 0) {
-                       printk(KERN_NOTICE "%s: could not claim port, giving"
-                              " up\n", LIRC_DRIVER_NAME);
+                       pr_notice("could not claim port, giving up\n");
                        return 0;
                }
        }
@@ -219,7 +213,7 @@ static void rbuf_write(int signal)
        if (nwptr == rptr) {
                /* no new signals will be accepted */
                lost_irqs++;
-               printk(KERN_NOTICE "%s: buffer overrun\n", LIRC_DRIVER_NAME);
+               pr_notice("buffer overrun\n");
                return;
        }
        rbuf[wptr] = signal;
@@ -290,7 +284,7 @@ static void irq_handler(void *blah)
                if (signal > timeout
                    || (check_pselecd && (in(1) & LP_PSELECD))) {
                        signal = 0;
-                       printk(KERN_NOTICE "%s: timeout\n", LIRC_DRIVER_NAME);
+                       pr_notice("timeout\n");
                        break;
                }
        } while (lirc_get_signal());
@@ -644,8 +638,7 @@ static int __init lirc_parallel_init(void)
 
        result = platform_driver_register(&lirc_parallel_driver);
        if (result) {
-               printk(KERN_NOTICE "platform_driver_register"
-                                       " returned %d\n", result);
+               pr_notice("platform_driver_register returned %d\n", result);
                return result;
        }
 
@@ -661,8 +654,7 @@ static int __init lirc_parallel_init(void)
 
        pport = parport_find_base(io);
        if (pport == NULL) {
-               printk(KERN_NOTICE "%s: no port at %x found\n",
-                      LIRC_DRIVER_NAME, io);
+               pr_notice("no port at %x found\n", io);
                result = -ENXIO;
                goto exit_device_put;
        }
@@ -670,8 +662,7 @@ static int __init lirc_parallel_init(void)
                                           pf, kf, irq_handler, 0, NULL);
        parport_put_port(pport);
        if (ppdevice == NULL) {
-               printk(KERN_NOTICE "%s: parport_register_device() failed\n",
-                      LIRC_DRIVER_NAME);
+               pr_notice("parport_register_device() failed\n");
                result = -ENXIO;
                goto exit_device_put;
        }
@@ -706,14 +697,12 @@ static int __init lirc_parallel_init(void)
        driver.dev = &lirc_parallel_dev->dev;
        driver.minor = lirc_register_driver(&driver);
        if (driver.minor < 0) {
-               printk(KERN_NOTICE "%s: register_chrdev() failed\n",
-                      LIRC_DRIVER_NAME);
+               pr_notice("register_chrdev() failed\n");
                parport_unregister_device(ppdevice);
                result = -EIO;
                goto exit_device_put;
        }
-       printk(KERN_INFO "%s: installed using port 0x%04x irq %d\n",
-              LIRC_DRIVER_NAME, io, irq);
+       pr_info("installed using port 0x%04x irq %d\n", io, irq);
        return 0;
 
 exit_device_put: