aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-27 01:11:55 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:25 -0500
commit37b0c020343080241984d978981d6caf877b278a (patch)
tree6a602f153ac0713cdecd4f8b355844387fba90bf /drivers/base
parent822a89ed1ea0f7a2d8079307426fbeeac0370138 (diff)
driver core: clean up device_shutdown
device_shutdown does not need to be in a separate file. Move it into the driver core file where it belongs. This also moves us one more step closer to making devices_kset static, now only the crazy sysdevs are keeping that from happening... Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c20
-rw-r--r--drivers/base/power/Makefile1
-rw-r--r--drivers/base/power/shutdown.c43
3 files changed, 19 insertions, 45 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index d2de2d59af42..b3a931fe6b16 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1415,5 +1415,23 @@ out:
1415 put_device(dev); 1415 put_device(dev);
1416 return error; 1416 return error;
1417} 1417}
1418
1419EXPORT_SYMBOL_GPL(device_move); 1418EXPORT_SYMBOL_GPL(device_move);
1419
1420/**
1421 * device_shutdown - call ->shutdown() on each device to shutdown.
1422 */
1423void device_shutdown(void)
1424{
1425 struct device * dev, *devn;
1426
1427 list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list,
1428 kobj.entry) {
1429 if (dev->bus && dev->bus->shutdown) {
1430 dev_dbg(dev, "shutdown\n");
1431 dev->bus->shutdown(dev);
1432 } else if (dev->driver && dev->driver->shutdown) {
1433 dev_dbg(dev, "shutdown\n");
1434 dev->driver->shutdown(dev);
1435 }
1436 }
1437}
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile
index 44504e6618fb..06a86fe6a78d 100644
--- a/drivers/base/power/Makefile
+++ b/drivers/base/power/Makefile
@@ -1,4 +1,3 @@
1obj-y := shutdown.o
2obj-$(CONFIG_PM) += sysfs.o 1obj-$(CONFIG_PM) += sysfs.o
3obj-$(CONFIG_PM_SLEEP) += main.o 2obj-$(CONFIG_PM_SLEEP) += main.o
4obj-$(CONFIG_PM_TRACE) += trace.o 3obj-$(CONFIG_PM_TRACE) += trace.o
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
deleted file mode 100644
index 5b6bc168ffba..000000000000
--- a/drivers/base/power/shutdown.c
+++ /dev/null
@@ -1,43 +0,0 @@
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
16/**
17 * We handle system devices differently - we suspend and shut them
18 * down last and resume them first. That way, we don't do anything stupid like
19 * shutting down the interrupt controller before any devices..
20 *
21 * Note that there are not different stages for power management calls -
22 * they only get one called once when interrupts are disabled.
23 */
24
25
26/**
27 * device_shutdown - call ->shutdown() on each device to shutdown.
28 */
29void device_shutdown(void)
30{
31 struct device * dev, *devn;
32
33 list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list,
34 kobj.entry) {
35 if (dev->bus && dev->bus->shutdown) {
36 dev_dbg(dev, "shutdown\n");
37 dev->bus->shutdown(dev);
38 } else if (dev->driver && dev->driver->shutdown) {
39 dev_dbg(dev, "shutdown\n");
40 dev->driver->shutdown(dev);
41 }
42 }
43}