driver core: convert printk(KERN_<LEVEL> ...) to pr_<level>
PATCH 1/1 driver core: convert printk(KERN_<LEVEL> ...) to pr_<level>
Convert printk:s to pr_* format.
Note, printk(KERN_DEBUG ...) is left untouched due to side effects
of pr_debug().
--- drivers/base/dd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/base/dd.c +6 -7
@@ -321,8 +321,8 @@ bool device_is_bound(struct device *dev)static void driver_bound (struct device *dev) {if (device_is_bound (dev)) { -printk (KERN_WARNING "%s: device %s already bound\n" , - __func__,kobject_name (&dev->kobj)); +pr_warn ("%s: device %s already bound\n" , __func__, +kobject_name (&dev->kobj));return ; }
@@ -485,8 +485,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto dma_failed;if (driver_sysfs_add (dev)) { -printk (KERN_ERR "%s: driver_sysfs_add(%s) failed\n" , - __func__,dev_name (dev)); +pr_err ("%s: driver_sysfs_add(%s) failed\n" , __func__, +dev_name (dev)); goto probe_failed; }
@@ -566,9 +566,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)break ;default :/* driver matched but the probe failed */ -printk (KERN_WARNING -"%s: probe of %s failed with error %d\n" , - drv->name,dev_name (dev), ret); +pr_warn ("%s: probe of %s failed with error %d\n" , + drv->name,dev_name (dev), ret); }/* * Ignore errors returned by ->probe so that the next driver can try
Signature · 1 line
2.18.0
Quoted 15 lines · Andy Shevchenko
Convert printk:s to pr_* format.
Note,
printk(KERN_DEBUG ...)is left untouched due to side effectsof pr_debug().Signed-off-by Andy Shevchenko <[email protected]>--- drivers/base/dd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)drivers/base/dd.c +0
-0
drivers/base/dd.c bool device_is_bound(struct device *dev) · line 325
Quoted 7 lines
drivers/base/dd.c +2
-2@@ -321,8 +321,8 @@ bool device_is_bound(struct device *dev)static void driver_bound (struct device *dev) {if (device_is_bound (dev)) { -printk (KERN_WARNING "%s: device %s already bound\n" , - __func__,kobject_name (&dev->kobj)); +pr_warn ("%s: device %s already bound\n" , __func__, +kobject_name (&dev->kobj));
_
While I believe adding __func__ to printks is not generally useful, perhaps it's better to use pr_fmt like:
#define pr_fmt(fmt) "%s: " fmt, __func__
to make it easier to remove the __func__ uses too.
Maybe
--- drivers/base/dd.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/base/dd.c +15 -17
@@ -16,6 +16,8 @@* Copyright (c) 2007-2009 Novell Inc. */ +#define pr_fmt (fmt) "%s: " fmt, __func__ +#include <linux/debugfs.h> #include <linux/device.h> #include <linux/delay.h>
@@ -321,13 +323,12 @@ bool device_is_bound(struct device *dev)static void driver_bound (struct device *dev) {if (device_is_bound (dev)) { -printk (KERN_WARNING "%s: device %s already bound\n" , - __func__,kobject_name (&dev->kobj)); +pr_warn ("device %s already bound\n" ,kobject_name (&dev->kobj));return ; } -pr_debug ("driver: '%s': %s: bound to device '%s'\n" , dev->driver->name, - __func__,dev_name (dev)); +pr_debug ("driver: '%s': bound to device '%s'\n" , + dev->driver->name,dev_name (dev));klist_add_tail (&dev->p->knode_driver, &dev->driver->p->klist_devices);device_links_driver_bound (dev);
@@ -468,8 +469,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)return ret;atomic_inc (&probe_count); -pr_debug ("bus: '%s': %s: probing driver %s with device %s\n" , - drv->bus->name, __func__, drv->name,dev_name (dev)); +pr_debug ("bus: '%s': probing driver %s with device %s\n" , + drv->bus->name, drv->name,dev_name (dev));WARN_ON (!list_empty (&dev->devres_head)); re_probe:
@@ -485,8 +486,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto dma_failed;if (driver_sysfs_add (dev)) { -printk (KERN_ERR "%s: driver_sysfs_add(%s) failed\n" , - __func__,dev_name (dev)); +pr_err ("driver_sysfs_add(%s) failed\n" ,dev_name (dev)); goto probe_failed; }
@@ -532,8 +532,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)driver_bound (dev); ret =1 ; -pr_debug ("bus: '%s': %s: bound device %s to driver %s\n" , - drv->bus->name, __func__,dev_name (dev), drv->name); +pr_debug ("bus: '%s': bound device %s to driver %s\n" , + drv->bus->name,dev_name (dev), drv->name); goto done; probe_failed:
@@ -566,9 +566,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)break ;default :/* driver matched but the probe failed */ -printk (KERN_WARNING -"%s: probe of %s failed with error %d\n" , - drv->name,dev_name (dev), ret); +pr_warn ("probe of %s failed with error %d\n" , + drv->name,dev_name (dev), ret); }/* * Ignore errors returned by ->probe so that the next driver can try
@@ -606,8 +605,7 @@ static int really_probe_debug(struct device *dev, struct device_driver *drv)*/ int driver_probe_done (void ) { -pr_debug ("%s: probe_count = %d\n" , __func__, -atomic_read (&probe_count)); +pr_debug ("probe_count = %d\n" ,atomic_read (&probe_count));if (atomic_read (&probe_count))return -EBUSY ;return 0 ;
@@ -648,8 +646,8 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)if (!device_is_registered (dev))return -ENODEV ; -pr_debug ("bus: '%s': %s: matched device %s with driver %s\n" , - drv->bus->name, __func__,dev_name (dev), drv->name); +pr_debug ("bus: '%s': matched device %s with driver %s\n" , + drv->bus->name,dev_name (dev), drv->name);pm_runtime_get_suppliers (dev);if (dev->parent)
Quoted 27 lines · Joe Perches
Quoted 15 lines · Andy Shevchenko
Convert printk:s to pr_* format.
Note,
printk(KERN_DEBUG ...)is left untouched due to side effectsof pr_debug().Signed-off-by Andy Shevchenko <[email protected]>--- drivers/base/dd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)drivers/base/dd.c +0
-0drivers/base/dd.c bool device_is_bound(struct device *dev) · line 325
Quoted 7 lines
drivers/base/dd.c +2
-2@@ -321,8 +321,8 @@ bool device_is_bound(struct device *dev)static void driver_bound (struct device *dev) {if (device_is_bound (dev)) { -printk (KERN_WARNING "%s: device %s already bound\n" , - __func__,kobject_name (&dev->kobj)); +pr_warn ("%s: device %s already bound\n" , __func__, +kobject_name (&dev->kobj));_
While I believe adding__func__to printks is not generally useful, perhaps it's better to usepr_fmtlike:
Quoted 5 lines
#define
pr_fmt(fmt)"%s: " fmt,__func__to make it easier to remove the
__func__uses too.Maybe
Your patch LGTM.
Feel free to resend properly with my either Rb or SoB tags.
Quoted 100 lines
--- drivers/base/dd.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)drivers/base/dd.c +15
-17@@ -16,6 +16,8 @@* Copyright (c) 2007-2009 Novell Inc. */ +#define pr_fmt (fmt) "%s: " fmt, __func__ +#include <linux/debugfs.h> #include <linux/device.h> #include <linux/delay.h> @@ -321,13 +323,12 @@ bool device_is_bound(struct device *dev)static void driver_bound (struct device *dev) {if (device_is_bound (dev)) { -printk (KERN_WARNING "%s: device %s already bound\n" , - __func__,kobject_name (&dev->kobj)); +pr_warn ("device %s already bound\n" ,kobject_name (&dev->kobj));return ; } -pr_debug ("driver: '%s': %s: bound to device '%s'\n" , dev->driver->name, - __func__,dev_name (dev)); +pr_debug ("driver: '%s': bound to device '%s'\n" , + dev->driver->name,dev_name (dev));klist_add_tail (&dev->p->knode_driver, &dev->driver->p->klist_devices);device_links_driver_bound (dev);@@ -468,8 +469,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)return ret;atomic_inc (&probe_count); -pr_debug ("bus: '%s': %s: probing driver %s with device %s\n" , - drv->bus->name, __func__, drv->name,dev_name (dev)); +pr_debug ("bus: '%s': probing driver %s with device %s\n" , + drv->bus->name, drv->name,dev_name (dev));WARN_ON (!list_empty (&dev->devres_head)); re_probe:@@ -485,8 +486,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto dma_failed;if (driver_sysfs_add (dev)) { -printk (KERN_ERR "%s: driver_sysfs_add(%s) failed\n" , - __func__,dev_name (dev)); +pr_err ("driver_sysfs_add(%s) failed\n" ,dev_name (dev)); goto probe_failed; }@@ -532,8 +532,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)driver_bound (dev); ret =1 ; -pr_debug ("bus: '%s': %s: bound device %s to driver %s\n" , - drv->bus->name, __func__,dev_name (dev), drv->name); +pr_debug ("bus: '%s': bound device %s to driver %s\n" , + drv->bus->name,dev_name (dev), drv->name); goto done; probe_failed:@@ -566,9 +566,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)break ;default :/* driver matched but the probe failed */ -printk (KERN_WARNING -"%s: probe of %s failed with error %d\n" , - drv->name,dev_name (dev), ret); +pr_warn ("probe of %s failed with error %d\n" , + drv->name,dev_name (dev), ret); }/* * Ignore errors returned by ->probe so that the next driver can try @@ -606,8 +605,7 @@ static int really_probe_debug(struct device *dev, struct device_driver *drv)*/ int driver_probe_done (void ) { -pr_debug ("%s: probe_count = %d\n" , __func__, -atomic_read (&probe_count)); +pr_debug ("probe_count = %d\n" ,atomic_read (&probe_count));if (atomic_read (&probe_count))return -EBUSY ;return 0 ;@@ -648,8 +646,8 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)if (!device_is_registered (dev))return -ENODEV ; -pr_debug ("bus: '%s': %s: matched device %s with driver %s\n" , - drv->bus->name, __func__,dev_name (dev), drv->name); +pr_debug ("bus: '%s': matched device %s with driver %s\n" , + drv->bus->name,dev_name (dev), drv->name);pm_runtime_get_suppliers (dev);if (dev->parent)
Signature · 2 lines
With Best Regards, Andy Shevchenko