Commit 295e0e7b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Wolfram Sang

i2c: dev: Define pr_fmt() and drop duplication substrings

Define pr_fmt() to print module name as prefix and at the same time
drop duplication substrings in the messages.

While at it, convert printk(<LEVEL>) to pr_<level>().
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 85888376
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
/* The I2C_RDWR ioctl code is written by Kolja Waschk <waschk@telos.de> */ /* The I2C_RDWR ioctl code is written by Kolja Waschk <waschk@telos.de> */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/cdev.h> #include <linux/cdev.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -68,8 +70,7 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap) ...@@ -68,8 +70,7 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap)
struct i2c_dev *i2c_dev; struct i2c_dev *i2c_dev;
if (adap->nr >= I2C_MINORS) { if (adap->nr >= I2C_MINORS) {
printk(KERN_ERR "i2c-dev: Out of device minors (%d)\n", pr_err("Out of device minors (%d)\n", adap->nr);
adap->nr);
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
...@@ -145,8 +146,7 @@ static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count, ...@@ -145,8 +146,7 @@ static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count,
if (tmp == NULL) if (tmp == NULL)
return -ENOMEM; return -ENOMEM;
pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n", pr_debug("i2c-%d reading %zu bytes.\n", iminor(file_inode(file)), count);
iminor(file_inode(file)), count);
ret = i2c_master_recv(client, tmp, count); ret = i2c_master_recv(client, tmp, count);
if (ret >= 0) if (ret >= 0)
...@@ -169,8 +169,7 @@ static ssize_t i2cdev_write(struct file *file, const char __user *buf, ...@@ -169,8 +169,7 @@ static ssize_t i2cdev_write(struct file *file, const char __user *buf,
if (IS_ERR(tmp)) if (IS_ERR(tmp))
return PTR_ERR(tmp); return PTR_ERR(tmp);
pr_debug("i2c-dev: i2c-%d writing %zu bytes.\n", pr_debug("i2c-%d writing %zu bytes.\n", iminor(file_inode(file)), count);
iminor(file_inode(file)), count);
ret = i2c_master_send(client, tmp, count); ret = i2c_master_send(client, tmp, count);
kfree(tmp); kfree(tmp);
...@@ -673,8 +672,7 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy) ...@@ -673,8 +672,7 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy)
return res; return res;
} }
pr_debug("i2c-dev: adapter [%s] registered as minor %d\n", pr_debug("adapter [%s] registered as minor %d\n", adap->name, adap->nr);
adap->name, adap->nr);
return 0; return 0;
} }
...@@ -693,7 +691,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy) ...@@ -693,7 +691,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy)
put_i2c_dev(i2c_dev, true); put_i2c_dev(i2c_dev, true);
pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); pr_debug("adapter [%s] unregistered\n", adap->name);
return 0; return 0;
} }
...@@ -726,7 +724,7 @@ static int __init i2c_dev_init(void) ...@@ -726,7 +724,7 @@ static int __init i2c_dev_init(void)
{ {
int res; int res;
printk(KERN_INFO "i2c /dev entries driver\n"); pr_info("i2c /dev entries driver\n");
res = register_chrdev_region(MKDEV(I2C_MAJOR, 0), I2C_MINORS, "i2c"); res = register_chrdev_region(MKDEV(I2C_MAJOR, 0), I2C_MINORS, "i2c");
if (res) if (res)
...@@ -754,7 +752,7 @@ static int __init i2c_dev_init(void) ...@@ -754,7 +752,7 @@ static int __init i2c_dev_init(void)
out_unreg_chrdev: out_unreg_chrdev:
unregister_chrdev_region(MKDEV(I2C_MAJOR, 0), I2C_MINORS); unregister_chrdev_region(MKDEV(I2C_MAJOR, 0), I2C_MINORS);
out: out:
printk(KERN_ERR "%s: Driver Initialisation failed\n", __FILE__); pr_err("Driver Initialisation failed\n");
return res; return res;
} }
......
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