]> git.hungrycats.org Git - linux/commitdiff
Add device_shutdown() calls to reboot and power off transitions (and let the user...
authorPatrick Mochel <mochel@segfault.osdl.org>
Fri, 5 Apr 2002 01:22:45 +0000 (17:22 -0800)
committerPatrick Mochel <mochel@hera.kernel.org>
Fri, 5 Apr 2002 01:22:45 +0000 (17:22 -0800)
drivers/base/power.c
kernel/sys.c

index 92633070f2548a7a1c9b82d605e09d906808919c..68f6ba5ffad2bfeb55fa303cc6535b1fcbf3f109 100644 (file)
@@ -29,6 +29,8 @@ int device_suspend(u32 state, u32 level)
        struct device * prev = &device_root;
        int error = 0;
 
+       printk(KERN_EMERG "Suspending Devices\n");
+
        get_device(prev);
 
        spin_lock(&device_lock);
@@ -82,6 +84,8 @@ void device_resume(u32 level)
        }
        spin_unlock(&device_root);
        put_device(prev);
+
+       printk(KERN_EMERG "Devices Resumed\n");
 }
 
 /**
@@ -97,6 +101,8 @@ void device_shutdown(void)
        struct device * dev;
        struct device * prev = &device_root;
 
+       printk(KERN_EMERG "Shutting down devices\n");
+
        get_device(prev);
 
        spin_lock(&device_lock);
index 54f018e69bf5a31df4e055a56c72c6a01b388c19..1642e115d2b0ec59e44b679c7165f9e4841c151e 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/highuid.h>
 #include <linux/fs.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -298,6 +299,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
        switch (cmd) {
        case LINUX_REBOOT_CMD_RESTART:
                notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
+               device_shutdown();
                printk(KERN_EMERG "Restarting system.\n");
                machine_restart(NULL);
                break;
@@ -312,6 +314,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
 
        case LINUX_REBOOT_CMD_HALT:
                notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
+               device_shutdown();
                printk(KERN_EMERG "System halted.\n");
                machine_halt();
                do_exit(0);
@@ -319,6 +322,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
 
        case LINUX_REBOOT_CMD_POWER_OFF:
                notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
+               device_shutdown();
                printk(KERN_EMERG "Power down.\n");
                machine_power_off();
                do_exit(0);
@@ -332,6 +336,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
                buffer[sizeof(buffer) - 1] = '\0';
 
                notifier_call_chain(&reboot_notifier_list, SYS_RESTART, buffer);
+               device_shutdown();
                printk(KERN_EMERG "Restarting system with command '%s'.\n", buffer);
                machine_restart(buffer);
                break;