public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [DRIVER CORE] drivers/base/dd.c incorrect pr_debug() parameters
@ 2014-04-17  0:12 Frank Rowand
  2014-04-17  0:48 ` Joe Perches
  2014-04-17  2:34 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 5+ messages in thread
From: Frank Rowand @ 2014-04-17  0:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Linux Kernel list

pr_debug() parameters are reverse order of format string

Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
---

 drivers/base/dd.c |    4 	2 +	2 -	0 !
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/drivers/base/dd.c
===================================================================
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -187,8 +187,8 @@ static void driver_bound(struct device *
 		return;
 	}
 
-	pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev),
-		 __func__, dev->driver->name);
+	pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->driver->name,
+		 __func__, dev_name(dev));
 
 	klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
 

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

* Re: [DRIVER CORE] drivers/base/dd.c incorrect pr_debug() parameters
  2014-04-17  0:12 [DRIVER CORE] drivers/base/dd.c incorrect pr_debug() parameters Frank Rowand
@ 2014-04-17  0:48 ` Joe Perches
  2014-04-17  1:12   ` Frank Rowand
  2014-04-17  2:34 ` Greg Kroah-Hartman
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-04-17  0:48 UTC (permalink / raw)
  To: frowand.list; +Cc: Greg Kroah-Hartman, Linux Kernel list

On Wed, 2014-04-16 at 17:12 -0700, Frank Rowand wrote:
> pr_debug() parameters are reverse order of format string

Another way to do this might be to change all the
printks/pr_debugs to dev_<level>

Something like:
---
 drivers/base/dd.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 0605176..454df77 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -182,13 +182,12 @@ late_initcall(deferred_probe_initcall);
 static void driver_bound(struct device *dev)
 {
 	if (klist_node_attached(&dev->p->knode_driver)) {
-		printk(KERN_WARNING "%s: device %s already bound\n",
-			__func__, kobject_name(&dev->kobj));
+		dev_warn(dev, "%s: device already bound\n", __func__);
 		return;
 	}
 
-	pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev),
-		 __func__, dev->driver->name);
+	dev_dbg(dev, "%s: driver '%s' bound to device\n",
+		__func__, dev->driver->name);
 
 	klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
 
@@ -267,8 +266,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 	int ret = 0;
 
 	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));
+	dev_dbg(dev, "%s: bus: '%s': probing driver '%s'\n",
+		__func__, drv->bus->name, drv->name);
 	WARN_ON(!list_empty(&dev->devres_head));
 
 	dev->driver = drv;
@@ -279,8 +278,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 		goto probe_failed;
 
 	if (driver_sysfs_add(dev)) {
-		printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
-			__func__, dev_name(dev));
+		dev_err(dev, "%s: driver '%s' - driver_sysfs_add failed\n",
+			__func__, drv->name);
 		goto probe_failed;
 	}
 
@@ -296,8 +295,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);
+	dev_dbg(dev, "%s: bus: '%s' - bound to driver '%s'\n",
+		__func__, drv->bus->name, drv->name);
 	goto done;
 
 probe_failed:
@@ -308,16 +307,16 @@ probe_failed:
 
 	if (ret == -EPROBE_DEFER) {
 		/* Driver requested deferred probing */
-		dev_info(dev, "Driver %s requests probe deferral\n", drv->name);
+		dev_info(dev, "driver '%s' requests probe deferral\n",
+			 drv->name);
 		driver_deferred_probe_add(dev);
 	} else if (ret != -ENODEV && ret != -ENXIO) {
 		/* driver matched but the probe failed */
-		printk(KERN_WARNING
-		       "%s: probe of %s failed with error %d\n",
-		       drv->name, dev_name(dev), ret);
+		dev_warn(dev, "probe of driver '%s' failed with error %d\n",
+			 drv->name, ret);
 	} else {
-		pr_debug("%s: probe of %s rejects match %d\n",
-		       drv->name, dev_name(dev), ret);
+		dev_dbg(dev, "probe of driver '%s' rejects match %d\n",
+			drv->name, ret);
 	}
 	/*
 	 * Ignore errors returned by ->probe so that the next driver can try
@@ -375,8 +374,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);
+	dev_dbg(dev, "%s: bus: '%s' - matched with driver '%s'\n",
+		__func__, drv->bus->name, drv->name);
 
 	pm_runtime_barrier(dev);
 	ret = really_probe(dev, drv);



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

* Re: [DRIVER CORE] drivers/base/dd.c incorrect pr_debug() parameters
  2014-04-17  0:48 ` Joe Perches
@ 2014-04-17  1:12   ` Frank Rowand
  2014-04-17  1:23     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Rowand @ 2014-04-17  1:12 UTC (permalink / raw)
  To: Joe Perches; +Cc: Greg Kroah-Hartman, Linux Kernel list

On 4/16/2014 5:48 PM, Joe Perches wrote:
> On Wed, 2014-04-16 at 17:12 -0700, Frank Rowand wrote:
>> pr_debug() parameters are reverse order of format string
> 
> Another way to do this might be to change all the
> printks/pr_debugs to dev_<level>

Yes, but if that is done, one may as well do all of drivers/base/*.c
and drivers/base/*/*.c

I was only trying to fix incorrectly reported information from one
pr_debug().  If someone else want to do a big conversion, they are
free to.  :-)

> 
> Something like:
> ---
>  drivers/base/dd.c | 35 +++++++++++++++++------------------
>  1 file changed, 17 insertions(+), 18 deletions(-)
> 
< snip >

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

* Re: [DRIVER CORE] drivers/base/dd.c incorrect pr_debug() parameters
  2014-04-17  1:12   ` Frank Rowand
@ 2014-04-17  1:23     ` Joe Perches
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2014-04-17  1:23 UTC (permalink / raw)
  To: frowand.list; +Cc: Greg Kroah-Hartman, Linux Kernel list

On Wed, 2014-04-16 at 18:12 -0700, Frank Rowand wrote:
> On 4/16/2014 5:48 PM, Joe Perches wrote:
> > On Wed, 2014-04-16 at 17:12 -0700, Frank Rowand wrote:
> >> pr_debug() parameters are reverse order of format string
> > 
> > Another way to do this might be to change all the
> > printks/pr_debugs to dev_<level>
> 
> Yes, but if that is done, one may as well do all of drivers/base/*.c
> and drivers/base/*/*.c

Actually, I don't think so, no.

These are the ones that have a struct device attached
to them.  Many of the others are device free and are
prefixed differently, like power and devtmpfs and bus.

> I was only trying to fix incorrectly reported information from one
> pr_debug().  If someone else want to do a big conversion, they are
> free to.  :-)

Always true...

cheers, Joe


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

* Re: [DRIVER CORE] drivers/base/dd.c incorrect pr_debug() parameters
  2014-04-17  0:12 [DRIVER CORE] drivers/base/dd.c incorrect pr_debug() parameters Frank Rowand
  2014-04-17  0:48 ` Joe Perches
@ 2014-04-17  2:34 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2014-04-17  2:34 UTC (permalink / raw)
  To: Frank Rowand; +Cc: Linux Kernel list

On Wed, Apr 16, 2014 at 05:12:30PM -0700, Frank Rowand wrote:
> pr_debug() parameters are reverse order of format string
> 
> Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
> ---
> 
>  drivers/base/dd.c |    4 	2 +	2 -	0 !
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: b/drivers/base/dd.c
> ===================================================================

What is this, cvs?  :)

> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -187,8 +187,8 @@ static void driver_bound(struct device *
>  		return;
>  	}
>  
> -	pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev),
> -		 __func__, dev->driver->name);
> +	pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->driver->name,
> +		 __func__, dev_name(dev));

Thanks, I'll queue this up.

greg k-h

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

end of thread, other threads:[~2014-04-17  2:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-17  0:12 [DRIVER CORE] drivers/base/dd.c incorrect pr_debug() parameters Frank Rowand
2014-04-17  0:48 ` Joe Perches
2014-04-17  1:12   ` Frank Rowand
2014-04-17  1:23     ` Joe Perches
2014-04-17  2:34 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox