struct device * prev = &device_root;
int error = 0;
+ printk(KERN_EMERG "Suspending Devices\n");
+
get_device(prev);
spin_lock(&device_lock);
}
spin_unlock(&device_root);
put_device(prev);
+
+ printk(KERN_EMERG "Devices Resumed\n");
}
/**
struct device * dev;
struct device * prev = &device_root;
+ printk(KERN_EMERG "Shutting down devices\n");
+
get_device(prev);
spin_lock(&device_lock);
#include <linux/init.h>
#include <linux/highuid.h>
#include <linux/fs.h>
+#include <linux/device.h>
#include <asm/uaccess.h>
#include <asm/io.h>
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;
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);
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);
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;