0b405a0f7e
The driver model has a "detach_state" mechanism that: - Has never been used by any in-kernel drive; - Is superfluous, since driver remove() methods can do the same thing; - Became buggy when the suspend() parameter changed semantics and type; - Could self-deadlock when called from certain suspend contexts; - Is effectively wasted documentation, object code, and headspace. This removes that "detach_state" mechanism; net code shrink, as well as a per-device saving in the driver model and sysfs. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
53 lines
1.2 KiB
C
53 lines
1.2 KiB
C
/*
|
|
* shutdown.c - power management functions for the device tree.
|
|
*
|
|
* Copyright (c) 2002-3 Patrick Mochel
|
|
* 2002-3 Open Source Development Lab
|
|
*
|
|
* This file is released under the GPLv2
|
|
*
|
|
*/
|
|
|
|
#include <linux/config.h>
|
|
#include <linux/device.h>
|
|
#include <asm/semaphore.h>
|
|
|
|
#include "power.h"
|
|
|
|
#define to_dev(node) container_of(node, struct device, kobj.entry)
|
|
|
|
extern struct subsystem devices_subsys;
|
|
|
|
|
|
/**
|
|
* We handle system devices differently - we suspend and shut them
|
|
* down last and resume them first. That way, we don't do anything stupid like
|
|
* shutting down the interrupt controller before any devices..
|
|
*
|
|
* Note that there are not different stages for power management calls -
|
|
* they only get one called once when interrupts are disabled.
|
|
*/
|
|
|
|
extern int sysdev_shutdown(void);
|
|
|
|
/**
|
|
* device_shutdown - call ->shutdown() on each device to shutdown.
|
|
*/
|
|
void device_shutdown(void)
|
|
{
|
|
struct device * dev;
|
|
|
|
down_write(&devices_subsys.rwsem);
|
|
list_for_each_entry_reverse(dev, &devices_subsys.kset.list,
|
|
kobj.entry) {
|
|
if (dev->driver && dev->driver->shutdown) {
|
|
dev_dbg(dev, "shutdown\n");
|
|
dev->driver->shutdown(dev);
|
|
}
|
|
}
|
|
up_write(&devices_subsys.rwsem);
|
|
|
|
sysdev_shutdown();
|
|
}
|
|
|