Fix ThinkPad T42 poweroff failure introduced by by "PM: Introduce pm_power_off_prepare"
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 26 Jul 2007 14:29:55 +0000 (16:29 +0200)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 26 Jul 2007 19:13:06 +0000 (12:13 -0700)
Commit bd804eba1c8597cbb7cd5a5f9fe886aae16a079a ("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: Rafael J. Wysocki <rjw@sisk.pl>
Tested-by: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/base/power/shutdown.c
include/linux/device.h
kernel/power/disk.c
kernel/sys.c

index a47ee1b70d2086b76bf41852650dc236fc483e38..56e8eaaac012cd544f69df0823aef84b023cfaaf 100644 (file)
@@ -44,7 +44,5 @@ void device_shutdown(void)
                        dev->driver->shutdown(dev);
                }
        }
-
-       sysdev_shutdown();
 }
 
index d9f0a57f5a2f1f530e9e63c6f9e7ddb4f395f6c2..3a38d1f70cb7c070faa253a2173db130a43917b6 100644 (file)
@@ -551,6 +551,9 @@ extern void put_device(struct device * dev);
 /* drivers/base/power/shutdown.c */
 extern void device_shutdown(void);
 
+/* drivers/base/sys.c */
+extern void sysdev_shutdown(void);
+
 
 /* drivers/base/firmware.c */
 extern int __must_check firmware_register(struct kset *);
index 324ac0188ce1cb89608f729f1321813f4bf2339d..eb72255b5c86049d1c31f0c9d6ca09b5b653fdca 100644 (file)
@@ -216,6 +216,7 @@ int hibernation_platform_enter(void)
                 * sleep state after all
                 */
                error = hibernation_ops->prepare();
+               sysdev_shutdown();
                if (!error)
                        error = hibernation_ops->enter();
        } else {
index 08562f419768464c867537cd278ffe8b965e6bbe..14f8adcfffd98ea1acc2387ffafdf348b900834b 100644 (file)
@@ -804,6 +804,7 @@ static void kernel_restart_prepare(char *cmd)
        blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
        system_state = SYSTEM_RESTART;
        device_shutdown();
+       sysdev_shutdown();
 }
 
 /**
@@ -860,6 +861,7 @@ void kernel_shutdown_prepare(enum system_states state)
 void kernel_halt(void)
 {
        kernel_shutdown_prepare(SYSTEM_HALT);
+       sysdev_shutdown();
        printk(KERN_EMERG "System halted.\n");
        machine_halt();
 }
@@ -876,6 +878,7 @@ void kernel_power_off(void)
        kernel_shutdown_prepare(SYSTEM_POWER_OFF);
        if (pm_power_off_prepare)
                pm_power_off_prepare();
+       sysdev_shutdown();
        printk(KERN_EMERG "Power down.\n");
        machine_power_off();
 }