summaryrefslogtreecommitdiffstats
path: root/drivers/base/dd.c
diff options
context:
space:
mode:
authorgregkh@suse.de <gregkh@suse.de>2005-03-31 22:53:00 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-21 00:15:27 +0200
commitb86c1df1f98d16c999423a3907eb40a9423f481e (patch)
tree02cf0b54f3c1d9b987268f2d4737af1a67dd4056 /drivers/base/dd.c
parent[PATCH] use device_for_each_child() to properly access child devices. (diff)
downloadlinux-b86c1df1f98d16c999423a3907eb40a9423f481e.tar.xz
linux-b86c1df1f98d16c999423a3907eb40a9423f481e.zip
[PATCH] 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
Diffstat (limited to 'drivers/base/dd.c')
-rw-r--r--drivers/base/dd.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 159e0623a681..dd2a8a79c121 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -88,20 +88,23 @@ static int __device_attach(struct device_driver * drv, void * data)
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;
}
/**
@@ -137,7 +140,10 @@ static int __driver_attach(struct device * dev, void * data)
drv->name, dev->bus_id, error);
} else
error = 0;
+ return error;
}
+ /* stop looking, this driver is attached */
+ return 1;
}
return 0;
}