Commit 3fac0314 authored by Andi Shyti's avatar Andi Shyti Committed by Mauro Carvalho Chehab

[media] lirc_dev: replace printk with pr_* or dev_*

This patch mutes also all the checkpatch warnings related to
printk.

Reword all the printouts so that the string doesn't need to be
split, which fixes the following checkpatch warning:

  WARNING: quoted string split across lines
Signed-off-by: default avatarAndi Shyti <andi.shyti@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent fe084c7e
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -240,59 +242,51 @@ static int lirc_allocate_driver(struct lirc_driver *d) ...@@ -240,59 +242,51 @@ static int lirc_allocate_driver(struct lirc_driver *d)
int err; int err;
if (!d) { if (!d) {
printk(KERN_ERR "lirc_dev: lirc_register_driver: " pr_err("driver pointer must be not NULL!\n");
"driver pointer must be not NULL!\n");
err = -EBADRQC; err = -EBADRQC;
goto out; goto out;
} }
if (!d->dev) { if (!d->dev) {
printk(KERN_ERR "%s: dev pointer not filled in!\n", __func__); pr_err("dev pointer not filled in!\n");
err = -EINVAL; err = -EINVAL;
goto out; goto out;
} }
if (MAX_IRCTL_DEVICES <= d->minor) { if (MAX_IRCTL_DEVICES <= d->minor) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "minor must be between 0 and %d!\n",
"\"minor\" must be between 0 and %d (%d)!\n", MAX_IRCTL_DEVICES - 1);
MAX_IRCTL_DEVICES - 1, d->minor);
err = -EBADRQC; err = -EBADRQC;
goto out; goto out;
} }
if (1 > d->code_length || (BUFLEN * 8) < d->code_length) { if (1 > d->code_length || (BUFLEN * 8) < d->code_length) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "code length must be less than %d bits\n",
"code length in bits for minor (%d) " BUFLEN * 8);
"must be less than %d!\n",
d->minor, BUFLEN * 8);
err = -EBADRQC; err = -EBADRQC;
goto out; goto out;
} }
if (d->sample_rate) { if (d->sample_rate) {
if (2 > d->sample_rate || HZ < d->sample_rate) { if (2 > d->sample_rate || HZ < d->sample_rate) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "invalid %d sample rate\n",
"sample_rate must be between 2 and %d!\n", HZ); d->sample_rate);
err = -EBADRQC; err = -EBADRQC;
goto out; goto out;
} }
if (!d->add_to_buf) { if (!d->add_to_buf) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "add_to_buf not set\n");
"add_to_buf cannot be NULL when "
"sample_rate is set\n");
err = -EBADRQC; err = -EBADRQC;
goto out; goto out;
} }
} else if (!(d->fops && d->fops->read) && !d->rbuf) { } else if (!(d->fops && d->fops->read) && !d->rbuf) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "fops->read and rbuf are NULL!\n");
"fops->read and rbuf cannot all be NULL!\n");
err = -EBADRQC; err = -EBADRQC;
goto out; goto out;
} else if (!d->rbuf) { } else if (!d->rbuf) {
if (!(d->fops && d->fops->read && d->fops->poll && if (!(d->fops && d->fops->read && d->fops->poll &&
d->fops->unlocked_ioctl)) { d->fops->unlocked_ioctl)) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "undefined read, poll, ioctl\n");
"neither read, poll nor unlocked_ioctl can be NULL!\n");
err = -EBADRQC; err = -EBADRQC;
goto out; goto out;
} }
...@@ -308,14 +302,12 @@ static int lirc_allocate_driver(struct lirc_driver *d) ...@@ -308,14 +302,12 @@ static int lirc_allocate_driver(struct lirc_driver *d)
if (!irctls[minor]) if (!irctls[minor])
break; break;
if (MAX_IRCTL_DEVICES == minor) { if (MAX_IRCTL_DEVICES == minor) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "no free slots for drivers!\n");
"no free slots for drivers!\n");
err = -ENOMEM; err = -ENOMEM;
goto out_lock; goto out_lock;
} }
} else if (irctls[minor]) { } else if (irctls[minor]) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "minor (%d) just registered!\n", minor);
"minor (%d) just registered!\n", minor);
err = -EBUSY; err = -EBUSY;
goto out_lock; goto out_lock;
} }
...@@ -352,8 +344,7 @@ static int lirc_allocate_driver(struct lirc_driver *d) ...@@ -352,8 +344,7 @@ static int lirc_allocate_driver(struct lirc_driver *d)
/* try to fire up polling thread */ /* try to fire up polling thread */
ir->task = kthread_run(lirc_thread, (void *)ir, "lirc_dev"); ir->task = kthread_run(lirc_thread, (void *)ir, "lirc_dev");
if (IS_ERR(ir->task)) { if (IS_ERR(ir->task)) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "cannot run thread for minor = %d\n",
"cannot run poll thread for minor = %d\n",
d->minor); d->minor);
err = -ECHILD; err = -ECHILD;
goto out_sysfs; goto out_sysfs;
...@@ -403,15 +394,14 @@ int lirc_unregister_driver(int minor) ...@@ -403,15 +394,14 @@ int lirc_unregister_driver(int minor)
struct cdev *cdev; struct cdev *cdev;
if (minor < 0 || minor >= MAX_IRCTL_DEVICES) { if (minor < 0 || minor >= MAX_IRCTL_DEVICES) {
printk(KERN_ERR "lirc_dev: %s: minor (%d) must be between " pr_err("minor (%d) must be between 0 and %d!\n",
"0 and %d!\n", __func__, minor, MAX_IRCTL_DEVICES - 1); minor, MAX_IRCTL_DEVICES - 1);
return -EBADRQC; return -EBADRQC;
} }
ir = irctls[minor]; ir = irctls[minor];
if (!ir) { if (!ir) {
printk(KERN_ERR "lirc_dev: %s: failed to get irctl struct " pr_err("failed to get irctl\n");
"for minor %d!\n", __func__, minor);
return -ENOENT; return -ENOENT;
} }
...@@ -420,8 +410,8 @@ int lirc_unregister_driver(int minor) ...@@ -420,8 +410,8 @@ int lirc_unregister_driver(int minor)
mutex_lock(&lirc_dev_lock); mutex_lock(&lirc_dev_lock);
if (ir->d.minor != minor) { if (ir->d.minor != minor) {
printk(KERN_ERR "lirc_dev: %s: minor (%d) device not " dev_err(ir->d.dev, "lirc_dev: minor %d device not registered\n",
"registered!\n", __func__, minor); minor);
mutex_unlock(&lirc_dev_lock); mutex_unlock(&lirc_dev_lock);
return -ENOENT; return -ENOENT;
} }
...@@ -463,8 +453,7 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file) ...@@ -463,8 +453,7 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file)
int retval = 0; int retval = 0;
if (iminor(inode) >= MAX_IRCTL_DEVICES) { if (iminor(inode) >= MAX_IRCTL_DEVICES) {
printk(KERN_WARNING "lirc_dev [%d]: open result = -ENODEV\n", pr_err("open result for %d is -ENODEV\n", iminor(inode));
iminor(inode));
return -ENODEV; return -ENODEV;
} }
...@@ -526,7 +515,7 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file) ...@@ -526,7 +515,7 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file)
int ret; int ret;
if (!ir) { if (!ir) {
printk(KERN_ERR "%s: called with invalid irctl\n", __func__); pr_err("called with invalid irctl\n");
return -EINVAL; return -EINVAL;
} }
...@@ -562,7 +551,7 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) ...@@ -562,7 +551,7 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait)
unsigned int ret; unsigned int ret;
if (!ir) { if (!ir) {
printk(KERN_ERR "%s: called with invalid irctl\n", __func__); pr_err("called with invalid irctl\n");
return POLLERR; return POLLERR;
} }
...@@ -593,7 +582,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -593,7 +582,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct irctl *ir = irctls[iminor(file_inode(file))]; struct irctl *ir = irctls[iminor(file_inode(file))];
if (!ir) { if (!ir) {
printk(KERN_ERR "lirc_dev: %s: no irctl found!\n", __func__); pr_err("no irctl found!\n");
return -ENODEV; return -ENODEV;
} }
...@@ -601,7 +590,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -601,7 +590,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ir->d.name, ir->d.minor, cmd); ir->d.name, ir->d.minor, cmd);
if (ir->d.minor == NOPLUG || !ir->attached) { if (ir->d.minor == NOPLUG || !ir->attached) {
dev_dbg(ir->d.dev, LOGHEAD "ioctl result = -ENODEV\n", dev_err(ir->d.dev, LOGHEAD "ioctl result = -ENODEV\n",
ir->d.name, ir->d.minor); ir->d.name, ir->d.minor);
return -ENODEV; return -ENODEV;
} }
...@@ -678,7 +667,7 @@ ssize_t lirc_dev_fop_read(struct file *file, ...@@ -678,7 +667,7 @@ ssize_t lirc_dev_fop_read(struct file *file,
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
if (!ir) { if (!ir) {
printk(KERN_ERR "%s: called with invalid irctl\n", __func__); pr_err("called with invalid irctl\n");
return -ENODEV; return -ENODEV;
} }
...@@ -783,7 +772,7 @@ ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer, ...@@ -783,7 +772,7 @@ ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer,
struct irctl *ir = irctls[iminor(file_inode(file))]; struct irctl *ir = irctls[iminor(file_inode(file))];
if (!ir) { if (!ir) {
printk(KERN_ERR "%s: called with invalid irctl\n", __func__); pr_err("called with invalid irctl\n");
return -ENODEV; return -ENODEV;
} }
...@@ -802,7 +791,7 @@ static int __init lirc_dev_init(void) ...@@ -802,7 +791,7 @@ static int __init lirc_dev_init(void)
lirc_class = class_create(THIS_MODULE, "lirc"); lirc_class = class_create(THIS_MODULE, "lirc");
if (IS_ERR(lirc_class)) { if (IS_ERR(lirc_class)) {
retval = PTR_ERR(lirc_class); retval = PTR_ERR(lirc_class);
printk(KERN_ERR "lirc_dev: class_create failed\n"); pr_err("class_create failed\n");
goto error; goto error;
} }
...@@ -810,13 +799,13 @@ static int __init lirc_dev_init(void) ...@@ -810,13 +799,13 @@ static int __init lirc_dev_init(void)
IRCTL_DEV_NAME); IRCTL_DEV_NAME);
if (retval) { if (retval) {
class_destroy(lirc_class); class_destroy(lirc_class);
printk(KERN_ERR "lirc_dev: alloc_chrdev_region failed\n"); pr_err("alloc_chrdev_region failed\n");
goto error; goto error;
} }
printk(KERN_INFO "lirc_dev: IR Remote Control driver registered, " pr_info("IR Remote Control driver registered, major %d\n",
"major %d \n", MAJOR(lirc_base_dev)); MAJOR(lirc_base_dev));
error: error:
return retval; return retval;
...@@ -828,7 +817,7 @@ static void __exit lirc_dev_exit(void) ...@@ -828,7 +817,7 @@ static void __exit lirc_dev_exit(void)
{ {
class_destroy(lirc_class); class_destroy(lirc_class);
unregister_chrdev_region(lirc_base_dev, MAX_IRCTL_DEVICES); unregister_chrdev_region(lirc_base_dev, MAX_IRCTL_DEVICES);
printk(KERN_INFO "lirc_dev: module unloaded\n"); pr_info("module unloaded\n");
} }
module_init(lirc_dev_init); module_init(lirc_dev_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment