public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Janice M Girouard <janiceg@us.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] testing for probe errors in base/bus.c
Date: Fri, 08 Aug 2003 13:47:25 -0500	[thread overview]
Message-ID: <3F33F03D.7030903@us.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]


Currently if an error is detected when probing a device,
this error is not reported.  Generally, an error value from
errno.h will be returned when the driver->probe function
fails.  However these errors are not logged, and the device
fails silently.

I've looked at e1000, tg3, 3c59x, acenic, hp, and many
others... all of whom exibit this behaviour.

The attached patch logs all errors, with the exception
of -ENODEV, since it is normal to receive this error when
matching drivers to devices.



[-- Attachment #2: bus.patch --]
[-- Type: text/plain, Size: 1874 bytes --]

diff -Naur linux-2.6.0-test2.orig.bus/drivers/base/bus.c linux-2.6.0-test2.my.bus/drivers/base/bus.c
--- linux-2.6.0-test2.orig.bus/drivers/base/bus.c	2003-08-07 16:14:31.000000000 -0500
+++ linux-2.6.0-test2.my.bus/drivers/base/bus.c	2003-08-07 21:14:32.000000000 -0500
@@ -287,6 +287,7 @@
 {
  	struct bus_type * bus = dev->bus;
 	struct list_head * entry;
+	int error;
 
 	if (dev->driver) {
 		device_bind_driver(dev);
@@ -296,8 +297,15 @@
 	if (bus->match) {
 		list_for_each(entry,&bus->drivers.list) {
 			struct device_driver * drv = to_drv(entry);
-			if (!bus_match(dev,drv))
-				return 1;
+			error = bus_match(dev,drv);
+			if (!error )  
+				/* success, driver matched */
+				return 1; 
+			if (error != -ENODEV) 
+				/* driver matched but the probe failed */
+				printk(KERN_WARNING 
+				    "%s: probe of %s failed with error %d\n",
+				    drv->name, dev->bus_id, error);
 		}
 	}
 
@@ -314,13 +322,14 @@
  *	If bus_match() returns 0 and the @dev->driver is set, we've found
  *	a compatible pair.
  *
- *	Note that we ignore the error from bus_match(), since it's perfectly
- *	valid for a driver not to bind to any devices.
+ *	Note that we ignore the -ENODEV error from bus_match(), since it's 
+ *	perfectly valid for a driver not to bind to any devices.
  */
 void driver_attach(struct device_driver * drv)
 {
 	struct bus_type * bus = drv->bus;
 	struct list_head * entry;
+	int error;
 
 	if (!bus->match)
 		return;
@@ -328,7 +337,12 @@
 	list_for_each(entry,&bus->devices.list) {
 		struct device * dev = container_of(entry,struct device,bus_list);
 		if (!dev->driver) {
-			bus_match(dev,drv);
+			error = bus_match(dev,drv);
+			if (error && (error != -ENODEV))
+				/* driver matched but the probe failed */
+				printk(KERN_WARNING 
+				    "%s: probe of %s failed with error %d\n",
+				    drv->name, dev->bus_id, error);
 		}
 	}
 }

                 reply	other threads:[~2003-08-08 18:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F33F03D.7030903@us.ibm.com \
    --to=janiceg@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox