2 * shutdown.c - power management functions for the device tree.
4 * Copyright (c) 2002-3 Patrick Mochel
5 * 2002-3 Open Source Development Lab
7 * This file is released under the GPLv2
11 #include <linux/device.h>
12 #include <asm/semaphore.h>
17 #define to_dev(node) container_of(node, struct device, kobj.entry)
21 * We handle system devices differently - we suspend and shut them
22 * down last and resume them first. That way, we don't do anything stupid like
23 * shutting down the interrupt controller before any devices..
25 * Note that there are not different stages for power management calls -
26 * they only get one called once when interrupts are disabled.
31 * device_shutdown - call ->shutdown() on each device to shutdown.
33 void device_shutdown(void)
35 struct device * dev, *devn;
37 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.list,
39 if (dev->bus && dev->bus->shutdown) {
40 dev_dbg(dev, "shutdown\n");
41 dev->bus->shutdown(dev);
42 } else if (dev->driver && dev->driver->shutdown) {
43 dev_dbg(dev, "shutdown\n");
44 dev->driver->shutdown(dev);