Re: [2.6.23-rc1 REGRESSION] ThinkPad T42 poweroff failure by "PM: Introduce pm_power_off_prepare"

From: Rafael J. Wysocki
Date: Thu Jul 26 2007 - 08:04:23 EST


On Wednesday, 25 July 2007 17:28, YOSHIFUJI Hideaki / åèèæ wrote:
> Hello.
>
> In article <200707251446.56809.rjw@xxxxxxx> (at Wed, 25 Jul 2007 14:46:55 +0200), "Rafael J. Wysocki" <rjw@xxxxxxx> says:
>
> > On Wednesday, 25 July 2007 00:19, YOSHIFUJI Hideaki / åèèæ wrote:
> :
> > > Linux 2.6.23-rc1 fails to power off my ThinkPad T42.
> > > Git-bisect told me that the following commit is to blame,
> > > and by reverting that commit, it works appropriately.
> >
> > (1) Can you please apply the appended patch and see if the message gets
> > printed when you try to power off the system?
>
> Yup, I got it. Last lines are:

Hmm, it looks like we have a code ordering issue in there.

Can you please check if the appended patch helps?

Greetings,
Rafael


---
drivers/base/power/shutdown.c | 2 --
include/linux/device.h | 3 +++
kernel/power/disk.c | 1 +
kernel/sys.c | 3 +++
4 files changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.23-rc1/drivers/base/power/shutdown.c
===================================================================
--- linux-2.6.23-rc1.orig/drivers/base/power/shutdown.c 2007-07-09 01:32:17.000000000 +0200
+++ linux-2.6.23-rc1/drivers/base/power/shutdown.c 2007-07-26 12:24:37.000000000 +0200
@@ -44,7 +44,5 @@ void device_shutdown(void)
dev->driver->shutdown(dev);
}
}
-
- sysdev_shutdown();
}

Index: linux-2.6.23-rc1/kernel/sys.c
===================================================================
--- linux-2.6.23-rc1.orig/kernel/sys.c 2007-07-23 22:07:02.000000000 +0200
+++ linux-2.6.23-rc1/kernel/sys.c 2007-07-26 12:08:07.000000000 +0200
@@ -804,6 +804,7 @@ static void kernel_restart_prepare(char
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
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();
}
Index: linux-2.6.23-rc1/kernel/power/disk.c
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/disk.c 2007-07-26 12:13:58.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/disk.c 2007-07-26 12:14:23.000000000 +0200
@@ -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: linux-2.6.23-rc1/include/linux/device.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/device.h 2007-07-23 22:06:59.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/device.h 2007-07-26 12:48:05.000000000 +0200
@@ -551,6 +551,9 @@ extern void put_device(struct device * d
/* 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 *);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/