]> cvs.zerfleddert.de Git - ms2-kexec/blob - core.c
call real kernel_restart_prepare
[ms2-kexec] / core.c
1 /*
2 * drivers/base/core.c - core driver model code (device registration, etc)
3 *
4 * Copyright (c) 2002-3 Patrick Mochel
5 * Copyright (c) 2002-3 Open Source Development Labs
6 * Copyright (c) 2006 Greg Kroah-Hartman <gregkh@suse.de>
7 * Copyright (c) 2006 Novell, Inc.
8 * This Edition is maintained by Matthew Veety (aliasxerog) <mveety@gmail.com>
9 *
10 * This file is released under the GPLv2
11 *
12 */
13
14 #include <linux/list.h>
15 #include <linux/device.h>
16 #include <linux/err.h>
17 #include <linux/init.h>
18 #include <linux/module.h>
19 #include <linux/slab.h>
20 #include <linux/string.h>
21 #include <linux/kdev_t.h>
22 #include <linux/notifier.h>
23 #include <linux/genhd.h>
24 #include <linux/kallsyms.h>
25 #include <linux/semaphore.h>
26 #include <linux/mutex.h>
27
28 /**
29 * device_shutdown - call ->shutdown() on each device to shutdown.
30 */
31 void device_shutdown(void)
32 {
33 struct device *dev, *devn, *dummy_device;
34 struct kset *devices_kset;
35
36 dummy_device = kzalloc(sizeof(*dummy_device), GFP_KERNEL);
37
38 /* init a dummy device to get to the devices kset */
39 device_initialize(dummy_device);
40 devices_kset=dummy_device->kobj.kset;
41 put_device(dummy_device);
42
43 list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list,
44 kobj.entry) {
45 if (dev->bus && dev->bus->shutdown) {
46 dev_dbg(dev, "shutdown\n");
47 dev->bus->shutdown(dev);
48 } else if (dev->driver && dev->driver->shutdown) {
49 dev_dbg(dev, "shutdown\n");
50 dev->driver->shutdown(dev);
51 }
52 }
53 }
Impressum, Datenschutz