Here's a more complete patch for that driver binding problem. Now (a) when scanning for a driver to handle a new device, scanning stops after the first successful probe not the first successful match; and (b) new drivers get every chance to bind to additional devices, even after the first one succeeds.
Please merge. This will help resolve some of the USB flakies in recent kernels. Note that (a) was noticed independently by me and Andries Brouwer, and AFAIK this is the first patch to also fix failure (b) which was uncovered by fixing (a). - Dave
--- ./drivers-dist/base/core.c Wed Oct 16 14:00:52 2002 +++ ./drivers/base/core.c Thu Oct 17 18:17:25 2002 @@ -27,5 +27,5 @@ { dev->driver = drv; - return drv->probe ? drv->probe(dev) : 0; + return drv->probe ? drv->probe(dev) : -ENODEV; } @@ -55,5 +55,5 @@ static int found_match(struct device * dev, struct device_driver * drv) { - int error = 0; + int error; if (!(error = probe(dev,get_driver(drv)))) { @@ -65,5 +65,6 @@ dev->driver = NULL; } - return error; + /* return boolean: did driver bind? */ + return error == 0; } @@ -85,4 +86,5 @@ if (drv->bus->match && drv->bus->match(dev,drv)) error = found_match(dev,drv); + /* stop bus_for_each_drv() once a driver binds to the device */ return error; } @@ -114,11 +116,11 @@ { struct device_driver * drv = (struct device_driver *)data; - int error = 0; if (!dev->driver) { if (dev->bus->match && dev->bus->match(dev,drv)) - error = found_match(dev,drv); + found_match(dev,drv); } - return error; + /* continue bus_for_each_dev(), to attach to other devices */ + return 0; }