summaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-04-04 20:42:26 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 12:40:47 -0700
commit53877d06d53a412d901bb323f080296c363d8b51 (patch)
treeceffbd4dd9342e1742bf59165880888f7f961f33 /drivers/base/bus.c
parent27c0ff868f2ad3c9732ce45abbb8dd7e1723931f (diff)
downloadlinux-53877d06d53a412d901bb323f080296c363d8b51.tar.bz2
[PATCH] Driver core: bus device event delay
split bus_add_device() and send device uevents after sysfs population Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 76656acd00d4..b27a6067e5a4 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -362,8 +362,7 @@ static void device_remove_attrs(struct bus_type * bus, struct device * dev)
* @dev: device being added
*
* - Add the device to its bus's list of devices.
- * - Try to attach to driver.
- * - Create link to device's physical location.
+ * - Create link to device's bus.
*/
int bus_add_device(struct device * dev)
{
@@ -372,8 +371,6 @@ 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);
@@ -384,6 +381,22 @@ int bus_add_device(struct device * dev)
}
/**
+ * bus_attach_device - add device to bus
+ * @dev: device tried to attach to a driver
+ *
+ * - Try to attach to driver.
+ */
+void bus_attach_device(struct device * dev)
+{
+ struct bus_type * bus = dev->bus;
+
+ if (bus) {
+ device_attach(dev);
+ klist_add_tail(&dev->knode_bus, &bus->klist_devices);
+ }
+}
+
+/**
* bus_remove_device - remove device from bus
* @dev: device to be removed
*
@@ -733,6 +746,7 @@ EXPORT_SYMBOL_GPL(bus_find_device);
EXPORT_SYMBOL_GPL(bus_for_each_drv);
EXPORT_SYMBOL_GPL(bus_add_device);
+EXPORT_SYMBOL_GPL(bus_attach_device);
EXPORT_SYMBOL_GPL(bus_remove_device);
EXPORT_SYMBOL_GPL(bus_register);
EXPORT_SYMBOL_GPL(bus_unregister);