Commit 58b3b71d authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Linus Torvalds

Fix ThinkPad T42 poweroff failure introduced by by "PM: Introduce pm_power_off_prepare"

Commit bd804eba ("PM: Introduce
pm_power_off_prepare") caused problems in the poweroff path, as reported by
YOSHIFUJI Hideaki / 吉藤英明.

Generally, sysdev_shutdown() should be called after the ACPI preparation for
powering the system off.  To make it happen, we can separate sysdev_shutdown()
from device_shutdown() and call it directly wherever necessary.
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Tested-by: default avatarYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 602033ed
...@@ -44,7 +44,5 @@ void device_shutdown(void) ...@@ -44,7 +44,5 @@ void device_shutdown(void)
dev->driver->shutdown(dev); dev->driver->shutdown(dev);
} }
} }
sysdev_shutdown();
} }
...@@ -551,6 +551,9 @@ extern void put_device(struct device * dev); ...@@ -551,6 +551,9 @@ extern void put_device(struct device * dev);
/* drivers/base/power/shutdown.c */ /* drivers/base/power/shutdown.c */
extern void device_shutdown(void); extern void device_shutdown(void);
/* drivers/base/sys.c */
extern void sysdev_shutdown(void);
/* drivers/base/firmware.c */ /* drivers/base/firmware.c */
extern int __must_check firmware_register(struct kset *); extern int __must_check firmware_register(struct kset *);
......
...@@ -216,6 +216,7 @@ int hibernation_platform_enter(void) ...@@ -216,6 +216,7 @@ int hibernation_platform_enter(void)
* sleep state after all * sleep state after all
*/ */
error = hibernation_ops->prepare(); error = hibernation_ops->prepare();
sysdev_shutdown();
if (!error) if (!error)
error = hibernation_ops->enter(); error = hibernation_ops->enter();
} else { } else {
......
...@@ -804,6 +804,7 @@ static void kernel_restart_prepare(char *cmd) ...@@ -804,6 +804,7 @@ static void kernel_restart_prepare(char *cmd)
blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd); blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
system_state = SYSTEM_RESTART; system_state = SYSTEM_RESTART;
device_shutdown(); device_shutdown();
sysdev_shutdown();
} }
/** /**
...@@ -860,6 +861,7 @@ void kernel_shutdown_prepare(enum system_states state) ...@@ -860,6 +861,7 @@ void kernel_shutdown_prepare(enum system_states state)
void kernel_halt(void) void kernel_halt(void)
{ {
kernel_shutdown_prepare(SYSTEM_HALT); kernel_shutdown_prepare(SYSTEM_HALT);
sysdev_shutdown();
printk(KERN_EMERG "System halted.\n"); printk(KERN_EMERG "System halted.\n");
machine_halt(); machine_halt();
} }
...@@ -876,6 +878,7 @@ void kernel_power_off(void) ...@@ -876,6 +878,7 @@ void kernel_power_off(void)
kernel_shutdown_prepare(SYSTEM_POWER_OFF); kernel_shutdown_prepare(SYSTEM_POWER_OFF);
if (pm_power_off_prepare) if (pm_power_off_prepare)
pm_power_off_prepare(); pm_power_off_prepare();
sysdev_shutdown();
printk(KERN_EMERG "Power down.\n"); printk(KERN_EMERG "Power down.\n");
machine_power_off(); machine_power_off();
} }
......
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