Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28283
b: refs/heads/master
c: 53877d0
h: refs/heads/master
i:
  28281: 668835f
  28279: 429a2d3
v: v3
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent a2cbbe1 commit b278aff
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 27c0ff868f2ad3c9732ce45abbb8dd7e1723931f
refs/heads/master: 53877d06d53a412d901bb323f080296c363d8b51
1 change: 1 addition & 0 deletions trunk/drivers/base/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extern int cpu_dev_init(void);
extern int attribute_container_init(void);

extern int bus_add_device(struct device * dev);
extern void bus_attach_device(struct device * dev);
extern void bus_remove_device(struct device * dev);

extern int bus_add_driver(struct device_driver *);
Expand Down
22 changes: 18 additions & 4 deletions trunk/drivers/base/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand All @@ -383,6 +380,22 @@ int bus_add_device(struct device * dev)
return error;
}

/**
* 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
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,12 @@ int device_add(struct device *dev)
dev->uevent_attr.store = store_uevent;
device_create_file(dev, &dev->uevent_attr);

kobject_uevent(&dev->kobj, KOBJ_ADD);
if ((error = device_pm_add(dev)))
goto PMError;
if ((error = bus_add_device(dev)))
goto BusError;
kobject_uevent(&dev->kobj, KOBJ_ADD);
bus_attach_device(dev);
if (parent)
klist_add_tail(&dev->knode_parent, &parent->klist_children);

Expand Down

0 comments on commit b278aff

Please sign in to comment.