From foo@baz Tue Apr 9 12:12:43 2002 To: Greg KH <gregkh@suse.de> Date: 31 Mar 2005 12:53:00 -08:00 From: gregkh@suse.de Subject: 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 diff -Nru a/drivers/base/dd.c b/drivers/base/dd.c --- a/drivers/base/dd.c 2005-04-05 10:51:10 -07:00 +++ b/drivers/base/dd.c 2005-04-05 10:51:10 -07:00 @@ -91,20 +91,23 @@ 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 @@ drv->name, dev->bus_id, error); } else error = 0; + return error; } + /* stop looking, this driver is attached */ + return 1; } return 0; }