summaryrefslogtreecommitdiffstats
path: root/drivers/base/power/shutdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/shutdown.c')
-rw-r--r--drivers/base/power/shutdown.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index f50a08be424b..c2475f3134ea 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -35,12 +35,15 @@ extern int sysdev_shutdown(void);
*/
void device_shutdown(void)
{
- struct device * dev;
+ struct device * dev, *devn;
down_write(&devices_subsys.rwsem);
- list_for_each_entry_reverse(dev, &devices_subsys.kset.list,
+ list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list,
kobj.entry) {
- if (dev->driver && dev->driver->shutdown) {
+ 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);
}
OpenPOWER on IntegriCloud