aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorgregkh@suse.de <gregkh@suse.de>2005-03-31 15:53:00 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-20 18:15:27 -0400
commitb86c1df1f98d16c999423a3907eb40a9423f481e (patch)
tree02cf0b54f3c1d9b987268f2d4737af1a67dd4056 /drivers/base
parentd0e2b4a0a9dd3eed71b56c47268bf4e40cff6d0f (diff)
[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')
-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)
88 int error; 88 int error;
89 89
90 error = driver_probe_device(drv, dev); 90 error = driver_probe_device(drv, dev);
91 91 if (error) {
92 if (error == -ENODEV && error == -ENXIO) { 92 if ((error == -ENODEV) || (error == -ENXIO)) {
93 /* Driver matched, but didn't support device 93 /* Driver matched, but didn't support device
94 * or device not found. 94 * or device not found.
95 * Not an error; keep going. 95 * Not an error; keep going.
96 */ 96 */
97 error = 0; 97 error = 0;
98 } else { 98 } else {
99 /* driver matched but the probe failed */ 99 /* driver matched but the probe failed */
100 printk(KERN_WARNING 100 printk(KERN_WARNING
101 "%s: probe of %s failed with error %d\n", 101 "%s: probe of %s failed with error %d\n",
102 drv->name, dev->bus_id, error); 102 drv->name, dev->bus_id, error);
103 }
104 return error;
103 } 105 }
104 return 0; 106 /* stop looking, this device is attached */
107 return 1;
105} 108}
106 109
107/** 110/**
@@ -137,7 +140,10 @@ static int __driver_attach(struct device * dev, void * data)
137 drv->name, dev->bus_id, error); 140 drv->name, dev->bus_id, error);
138 } else 141 } else
139 error = 0; 142 error = 0;
143 return error;
140 } 144 }
145 /* stop looking, this driver is attached */
146 return 1;
141 } 147 }
142 return 0; 148 return 0;
143} 149}