[dm-devel] patch to bus_add_device to delay call to device_attach till after "bus" and bus id sym links are set up

goggin, edward egoggin at emc.com
Thu Nov 10 19:01:27 UTC 2005


Patch to drivers/base/bus.c:bus_add_device to delay the driver_attach
call until after the "bus" and bus_id symbolic links for the device exist
so that a hotplug/uevent handler will not fail to find these links already
established for a newly added device.

--- ../base/linux-2.6.14-rc4/drivers/base/bus.c	2005-10-10
20:19:19.000000000 -0500
+++ drivers/base/bus.c	2005-11-03 13:32:02.000000000 -0600
@@ -359,13 +359,13 @@ int bus_add_device(struct device * dev)
 
 	if (bus) {
 		pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
-		device_attach(dev);
 		klist_add_tail(&dev->knode_bus, &bus->klist_devices);
 		error = device_add_attrs(bus, dev);
 		if (!error) {
 			sysfs_create_link(&bus->devices.kobj, &dev->kobj,
dev->bus_id);
 			sysfs_create_link(&dev->kobj,
&dev->bus->subsys.kset.kobj, "bus");
 		}
+		device_attach(dev);
 	}
 	return error;
 }




More information about the dm-devel mailing list