aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/sleep/poweroff.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c
index 240dde9cf13a..39e40d56b034 100644
--- a/drivers/acpi/sleep/poweroff.c
+++ b/drivers/acpi/sleep/poweroff.c
@@ -39,7 +39,13 @@ int acpi_sleep_prepare(u32 acpi_state)
39 39
40#ifdef CONFIG_PM 40#ifdef CONFIG_PM
41 41
42void acpi_power_off(void) 42static void acpi_power_off_prepare(void)
43{
44 /* Prepare to power off the system */
45 acpi_sleep_prepare(ACPI_STATE_S5);
46}
47
48static void acpi_power_off(void)
43{ 49{
44 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 50 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
45 printk("%s called\n", __FUNCTION__); 51 printk("%s called\n", __FUNCTION__);
@@ -48,27 +54,6 @@ void acpi_power_off(void)
48 acpi_enter_sleep_state(ACPI_STATE_S5); 54 acpi_enter_sleep_state(ACPI_STATE_S5);
49} 55}
50 56
51static int acpi_shutdown(struct sys_device *x)
52{
53 switch (system_state) {
54 case SYSTEM_POWER_OFF:
55 /* Prepare to power off the system */
56 return acpi_sleep_prepare(ACPI_STATE_S5);
57 default:
58 return 0;
59 }
60}
61
62static struct sysdev_class acpi_sysclass = {
63 set_kset_name("acpi"),
64 .shutdown = acpi_shutdown
65};
66
67static struct sys_device device_acpi = {
68 .id = 0,
69 .cls = &acpi_sysclass,
70};
71
72static int acpi_poweroff_init(void) 57static int acpi_poweroff_init(void)
73{ 58{
74 if (!acpi_disabled) { 59 if (!acpi_disabled) {
@@ -78,13 +63,8 @@ static int acpi_poweroff_init(void)
78 status = 63 status =
79 acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); 64 acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
80 if (ACPI_SUCCESS(status)) { 65 if (ACPI_SUCCESS(status)) {
81 int error; 66 pm_power_off_prepare = acpi_power_off_prepare;
82 error = sysdev_class_register(&acpi_sysclass); 67 pm_power_off = acpi_power_off;
83 if (!error)
84 error = sysdev_register(&device_acpi);
85 if (!error)
86 pm_power_off = acpi_power_off;
87 return error;
88 } 68 }
89 } 69 }
90 return 0; 70 return 0;