Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.19-rc2 54 lines 1.3 kB view raw
1/* 2 * shutdown.c - power management functions for the device tree. 3 * 4 * Copyright (c) 2002-3 Patrick Mochel 5 * 2002-3 Open Source Development Lab 6 * 7 * This file is released under the GPLv2 8 * 9 */ 10 11#include <linux/device.h> 12#include <asm/semaphore.h> 13 14#include "../base.h" 15#include "power.h" 16 17#define to_dev(node) container_of(node, struct device, kobj.entry) 18 19extern struct subsystem devices_subsys; 20 21 22/** 23 * We handle system devices differently - we suspend and shut them 24 * down last and resume them first. That way, we don't do anything stupid like 25 * shutting down the interrupt controller before any devices.. 26 * 27 * Note that there are not different stages for power management calls - 28 * they only get one called once when interrupts are disabled. 29 */ 30 31 32/** 33 * device_shutdown - call ->shutdown() on each device to shutdown. 34 */ 35void device_shutdown(void) 36{ 37 struct device * dev, *devn; 38 39 down_write(&devices_subsys.rwsem); 40 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list, 41 kobj.entry) { 42 if (dev->bus && dev->bus->shutdown) { 43 dev_dbg(dev, "shutdown\n"); 44 dev->bus->shutdown(dev); 45 } else if (dev->driver && dev->driver->shutdown) { 46 dev_dbg(dev, "shutdown\n"); 47 dev->driver->shutdown(dev); 48 } 49 } 50 up_write(&devices_subsys.rwsem); 51 52 sysdev_shutdown(); 53} 54