public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* syslog loves the new driver core code
@ 2005-03-31  8:28 Greg KH
  2005-03-31 18:04 ` Patrick Mochel
  0 siblings, 1 reply; 2+ messages in thread
From: Greg KH @ 2005-03-31  8:28 UTC (permalink / raw)
  To: Patrick Mochel, Andrew Morton; +Cc: linux-kernel

Andrew pointed out to me that the new driver core code spewes a lot of
stuff in the syslog for every device it tries to match up with a driver
(if you look closely, it seems that the if check in __device_attach()
will never not trigger...)

Everything still seems to work properly, but it's good if we don't alarm
people with messages that are incorrect and unneeded. :)

So, here's a patch that seems to work for me.  It stops trying to loop
through drivers or devices once it finds a match, and it only tells the
syslog when we have a real error.

Look acceptable to you?

thanks,

greg k-h

-----------
Driver core: Fix up the driver and device iterators to be quieter

Also stops looping over the lists when a match is found.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

--- 1.4/drivers/base/dd.c	2005-03-25 09:52:38 -08:00
+++ edited/drivers/base/dd.c	2005-03-31 00:22:50 -08:00
@@ -91,20 +91,23 @@ static int __device_attach(struct device
 	int error;
 
 	error = driver_probe_device(drv, dev);
-
-	if (error == -ENODEV && error == -ENXIO) {
-		/* Driver matched, but didn't support device 
-		 * or device not found.
-		 * Not an error; keep going.
-		 */
-		error = 0;
-	} else {
-		/* driver matched but the probe failed */
-		printk(KERN_WARNING
-		       "%s: probe of %s failed with error %d\n",
-		       drv->name, dev->bus_id, error);
+	if (error) {
+		if ((error == -ENODEV) || (error == -ENXIO)) {
+			/* Driver matched, but didn't support device 
+			 * or device not found.
+			 * Not an error; keep going.
+			 */
+			error = 0;
+		} else {
+			/* driver matched but the probe failed */
+			printk(KERN_WARNING
+			       "%s: probe of %s failed with error %d\n",
+			       drv->name, dev->bus_id, error);
+		}
+		return error;
 	}
-	return 0;
+	/* stop looking, this device is attached */
+	return 1;
 }
 
 
@@ -142,7 +145,10 @@ static int __driver_attach(struct device
 				       drv->name, dev->bus_id, error);
 			} else
 				error = 0;
+			return error;
 		}
+		/* stop looking, this driver is attached */
+		return 1;
 	}
 	return 0;
 }

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

* Re: syslog loves the new driver core code
  2005-03-31  8:28 syslog loves the new driver core code Greg KH
@ 2005-03-31 18:04 ` Patrick Mochel
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick Mochel @ 2005-03-31 18:04 UTC (permalink / raw)
  To: Greg KH; +Cc: Andrew Morton, linux-kernel


On Thu, 31 Mar 2005, Greg KH wrote:

> Andrew pointed out to me that the new driver core code spewes a lot of
> stuff in the syslog for every device it tries to match up with a driver
> (if you look closely, it seems that the if check in __device_attach()
> will never not trigger...)
>
> Everything still seems to work properly, but it's good if we don't alarm
> people with messages that are incorrect and unneeded. :)
>
> So, here's a patch that seems to work for me.  It stops trying to loop
> through drivers or devices once it finds a match, and it only tells the
> syslog when we have a real error.
>
> Look acceptable to you?

Yes. Sorry about that.


	Pat

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

end of thread, other threads:[~2005-03-31 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-31  8:28 syslog loves the new driver core code Greg KH
2005-03-31 18:04 ` Patrick Mochel

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