Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196048
b: refs/heads/master
c: 6245838
h: refs/heads/master
v: v3
  • Loading branch information
Hugh Daschbach authored and Greg Kroah-Hartman committed May 21, 2010
1 parent 59dba99 commit 8e2585a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 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: e177123f0c2d77ed2fde724ca352166ca9464619
refs/heads/master: 6245838fe4d2ce4aab52f543224f7d1212d9155c
25 changes: 22 additions & 3 deletions trunk/drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1734,17 +1734,36 @@ EXPORT_SYMBOL_GPL(device_move);
*/
void device_shutdown(void)
{
struct device *dev, *devn;
struct device *dev;

spin_lock(&devices_kset->list_lock);
/*
* Walk the devices list backward, shutting down each in turn.
* Beware that device unplug events may also start pulling
* devices offline, even as the system is shutting down.
*/
while (!list_empty(&devices_kset->list)) {
dev = list_entry(devices_kset->list.prev, struct device,
kobj.entry);
get_device(dev);
/*
* Make sure the device is off the kset list, in the
* event that dev->*->shutdown() doesn't remove it.
*/
list_del_init(&dev->kobj.entry);
spin_unlock(&devices_kset->list_lock);

list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list,
kobj.entry) {
if (dev->bus && dev->bus->shutdown) {
dev_dbg(dev, "shutdown\n");
dev->bus->shutdown(dev);
} else if (dev->driver && dev->driver->shutdown) {
dev_dbg(dev, "shutdown\n");
dev->driver->shutdown(dev);
}
put_device(dev);

spin_lock(&devices_kset->list_lock);
}
spin_unlock(&devices_kset->list_lock);
async_synchronize_full();
}

0 comments on commit 8e2585a

Please sign in to comment.