On Tue, Jan 14, 2003 at 05:51:31PM -0800, David Brownell wrote:
> Kari Hameenaho wrote:
> 
> >This seems to have started in 2.5.57, finding the devices at boot used to 
> >work in 2.5.56.
> 
> I was wonder if the probing logic (driver core) got something
> wrong ... I just saw a situation where modprobing the driver
> wouldn't make it bind to devices that were already present.
> It had to be the other way around:  driver first, then device.

Yes, something changed there.  Here's a patch from Pat Mochel to
possibly fix this problem.  I haven't tested it yet, so use it at your
own risk (and let me know if it works for you...)

thanks,

greg k-h



===== drivers/base/bus.c 1.38 vs edited =====
--- 1.38/drivers/base/bus.c     Mon Jan 13 10:34:12 2003
+++ edited/drivers/base/bus.c   Tue Jan 14 16:41:22 2003
@@ -256,22 +256,27 @@
  *     
  *     If we find a match, we call @drv->probe(@dev) if it exists, and 
  *     call attach() above.
+ *
+ *     If the deivce is bound to the driver, we return 1. If the bus
+ *     reports that they do not match (bus->match() returns FALSE), we
+ *     return 0. Otherwise, we return the error that drv->probe() 
+ *     returns.
  */
 static int bus_match(struct device * dev, struct device_driver * drv)
 {
-       int error = -ENODEV;
+       int ret = 0;
        if (dev->bus->match(dev,drv)) {
                dev->driver = drv;
                if (drv->probe) {
-                       if ((error = drv->probe(dev))) {
+                       if ((ret = drv->probe(dev))) {
                                dev->driver = NULL;
-                               return error;
+                               return ret;
                        }
                }
                device_bind_driver(dev);
-               error = 0;
+               ret = 1;
        }
-       return error;
+       return ret;
 }
 
 
@@ -298,8 +303,11 @@
 
        list_for_each(entry,&bus->drivers.list) {
                struct device_driver * drv = to_drv(entry);
-               if (!(error = bus_match(dev,drv)))
+               if ((error = bus_match(dev,drv))) {
+                       if (error > 1)
+                               error = 0;
                        break;
+               }
        }
        return error;
 }
@@ -322,6 +330,7 @@
 {
        struct bus_type * bus = drv->bus;
        struct list_head * entry;
+       int error = 0;
 
        if (!bus->match)
                return 0;
@@ -329,8 +338,12 @@
        list_for_each(entry,&bus->devices.list) {
                struct device * dev = container_of(entry,struct device,bus_list);
                if (!dev->driver) {
-                       if (!bus_match(dev,drv) && dev->driver)
-                               devclass_add_device(dev);
+                       if ((error = bus_match(dev,drv))) {
+                               if (error > 0)
+                                       error = devclass_add_device(dev);
+                               else
+                                       break;
+                       }
                }
        }
        return 0;
@@ -396,7 +409,8 @@
                if ((error = device_attach(dev)))
                        list_del_init(&dev->bus_list);
                up_write(&dev->bus->subsys.rwsem);
-               sysfs_create_link(&bus->devices.kobj,&dev->kobj,dev->bus_id);
+               if (!error)
+                       sysfs_create_link(&bus->devices.kobj,&dev->kobj,dev->bus_id);
        }
        return error;
 }



-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving 
your online business a competitive advantage. Test-drive a Thawte SSL 
certificate - our easy online guide will show you how. Click here to get 
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to