The patch titled PM: Introduce pm_power_off_prepare has been added to the -mm tree. Its filename is pm-introduce-pm_power_off_prepare.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: PM: Introduce pm_power_off_prepare From: Rafael J. Wysocki <rjw@xxxxxxx> Introduce the pm_power_off_prepare() callback that can be registered by the interested platforms in analogy with pm_idle() and pm_power_off(), used for preparing the system to power off (needed by ACPI). This allows us to drop acpi_sysclass and device_acpi that are only defined in order to register the ACPI power off preparation callback, which is needed by pm_power_off() registered in a much different way. Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx> Acked-by: Pavel Machek <pavel@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/acpi/sleep/poweroff.c | 38 +++++++------------------------- include/linux/pm.h | 1 kernel/sys.c | 9 +++++++ 3 files changed, 19 insertions(+), 29 deletions(-) diff -puN drivers/acpi/sleep/poweroff.c~pm-introduce-pm_power_off_prepare drivers/acpi/sleep/poweroff.c --- a/drivers/acpi/sleep/poweroff.c~pm-introduce-pm_power_off_prepare +++ a/drivers/acpi/sleep/poweroff.c @@ -39,7 +39,13 @@ int acpi_sleep_prepare(u32 acpi_state) #ifdef CONFIG_PM -void acpi_power_off(void) +static void acpi_power_off_prepare(void) +{ + /* Prepare to power off the system */ + acpi_sleep_prepare(ACPI_STATE_S5); +} + +static void acpi_power_off(void) { /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ printk("%s called\n", __FUNCTION__); @@ -48,27 +54,6 @@ void acpi_power_off(void) acpi_enter_sleep_state(ACPI_STATE_S5); } -static int acpi_shutdown(struct sys_device *x) -{ - switch (system_state) { - case SYSTEM_POWER_OFF: - /* Prepare to power off the system */ - return acpi_sleep_prepare(ACPI_STATE_S5); - default: - return 0; - } -} - -static struct sysdev_class acpi_sysclass = { - set_kset_name("acpi"), - .shutdown = acpi_shutdown -}; - -static struct sys_device device_acpi = { - .id = 0, - .cls = &acpi_sysclass, -}; - static int acpi_poweroff_init(void) { if (!acpi_disabled) { @@ -78,13 +63,8 @@ static int acpi_poweroff_init(void) status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); if (ACPI_SUCCESS(status)) { - int error; - error = sysdev_class_register(&acpi_sysclass); - if (!error) - error = sysdev_register(&device_acpi); - if (!error) - pm_power_off = acpi_power_off; - return error; + pm_power_off_prepare = acpi_power_off_prepare; + pm_power_off = acpi_power_off; } } return 0; diff -puN include/linux/pm.h~pm-introduce-pm_power_off_prepare include/linux/pm.h --- a/include/linux/pm.h~pm-introduce-pm_power_off_prepare +++ a/include/linux/pm.h @@ -101,6 +101,7 @@ struct pm_dev */ extern void (*pm_idle)(void); extern void (*pm_power_off)(void); +extern void (*pm_power_off_prepare)(void); typedef int __bitwise suspend_state_t; diff -puN kernel/sys.c~pm-introduce-pm_power_off_prepare kernel/sys.c --- a/kernel/sys.c~pm-introduce-pm_power_off_prepare +++ a/kernel/sys.c @@ -98,6 +98,13 @@ struct pid *cad_pid; EXPORT_SYMBOL(cad_pid); /* + * If set, this is used for preparing the system to power off. + */ + +void (*pm_power_off_prepare)(void); +EXPORT_SYMBOL(pm_power_off_prepare); + +/* * Notifier list for kernel code which wants to be called * at shutdown. This is used to stop any idling DMA operations * and the like. @@ -865,6 +872,8 @@ EXPORT_SYMBOL_GPL(kernel_halt); void kernel_power_off(void) { kernel_shutdown_prepare(SYSTEM_POWER_OFF); + if (pm_power_off_prepare) + pm_power_off_prepare(); printk(KERN_EMERG "Power down.\n"); machine_power_off(); } _ Patches currently in -mm which might be from rjw@xxxxxxx are pm-do-not-use-saved_state-from-struct-dev_pm_info-on-arm.patch pm-do-not-use-saved_state-from-struct-dev_pm_info-on-arm-update.patch x86_64-pm_trace-support.patch i386-do-not-restore-reserved-memory-after-hibernation.patch i386-do-not-restore-reserved-memory-after-hibernation-fix.patch freezer-make-kernel-threads-nonfreezable-by-default.patch freezer-make-kernel-threads-nonfreezable-by-default-fix.patch freezer-make-kernel-threads-nonfreezable-by-default-fix-fix.patch freezer-make-kernel-threads-nonfreezable-by-default-fix-2.patch freezer-run-show_state-when-freezing-times-out.patch pm-do-not-require-dev-spew-to-get-pm_debug.patch swsusp-remove-incorrect-code-from-userc.patch swsusp-remove-code-duplication-between-diskc-and-userc.patch swsusp-remove-code-duplication-between-diskc-and-userc-fix.patch swsusp-introduce-restore-platform-operations.patch swsusp-fix-hibernation-code-ordering.patch hibernation-prepare-to-enter-the-low-power-state.patch freezer-avoid-freezing-kernel-threads-prematurely.patch freezer-use-__set_current_state-in-refrigerator.patch freezer-return-int-from-freeze_processes.patch freezer-remove-redundant-check-in-try_to_freeze_tasks.patch pm-introduce-hibernation-and-suspend-notifiers.patch pm-introduce-hibernation-and-suspend-notifiers-fix.patch pm-introduce-hibernation-and-suspend-notifiers-tidy.patch pm-introduce-hibernation-and-suspend-notifiers-fix-fix.patch pm-disable-usermode-helper-before-hibernation-and-suspend.patch pm-disable-usermode-helper-before-hibernation-and-suspend-fix.patch pm-prevent-frozen-user-mode-helpers-from-failing-the-freezing-of-tasks-rev-2.patch pm-reduce-code-duplication-between-mainc-and-userc-updated.patch acpi-do-not-prepare-for-hibernation-in-acpi_shutdown.patch pm-introduce-pm_power_off_prepare.patch shrink_slab-handle-bad-shrinkers.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html