Commit 268a3cf5 authored by Patrick Mochel's avatar Patrick Mochel Committed by Patrick Mochel

Add device_shutdown() calls to reboot and power off transitions (and let the user know)

parent 456f5a1c
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment