From: Greg KH <gregkh@suse.de>
To: Patrick Mochel <mochel@digitalimplant.org>,
Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: syslog loves the new driver core code
Date: Thu, 31 Mar 2005 00:28:14 -0800 [thread overview]
Message-ID: <20050331082814.GA26668@kroah.com> (raw)
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;
}
next reply other threads:[~2005-03-31 8:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-31 8:28 Greg KH [this message]
2005-03-31 18:04 ` syslog loves the new driver core code Patrick Mochel
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=20050331082814.GA26668@kroah.com \
--to=gregkh@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.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