From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bh-25.webhostbox.net (bh-25.webhostbox.net [208.91.199.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id A0DF61A0B1C for ; Tue, 7 Oct 2014 16:30:26 +1100 (EST) Received: from mailnull by bh-25.webhostbox.net with sa-checked (Exim 4.82) (envelope-from ) id 1XbNLs-002fCb-Gt for linuxppc-dev@lists.ozlabs.org; Tue, 07 Oct 2014 05:30:24 +0000 From: Guenter Roeck To: linux-kernel@vger.kernel.org Subject: [PATCH 30/44] acpi: Register poweroff handler with kernel poweroff handler Date: Mon, 6 Oct 2014 22:28:32 -0700 Message-Id: <1412659726-29957-31-git-send-email-linux@roeck-us.net> In-Reply-To: <1412659726-29957-1-git-send-email-linux@roeck-us.net> References: <1412659726-29957-1-git-send-email-linux@roeck-us.net> Cc: linux-m32r-ja@ml.linux-m32r.org, linux-mips@linux-mips.org, linux-efi@vger.kernel.org, linux-ia64@vger.kernel.org, linux-xtensa@linux-xtensa.org, devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, lguest@lists.ozlabs.org, linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org, linux-sh@vger.kernel.org, linux-acpi@vger.kernel.org, xen-devel@lists.xenproject.org, Guenter Roeck , Len Brown , devicetree@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net, linux-pm@vger.kernel.org, adi-buildroot-devel@lists.sourceforge.net, linux-m68k@lists.linux-m68k.org, linux-am33-list@redhat.com, linux-tegra@vger.kernel.org, openipmi-developer@lists.sourceforge.net, linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com, "Rafael J. Wysocki" , linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the driver explicitly overrides existing poweroff handlers. Cc: Rafael J. Wysocki Cc: Len Brown Signed-off-by: Guenter Roeck --- drivers/acpi/sleep.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 54da4a3..25aad22 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include #include @@ -811,14 +813,22 @@ static void acpi_power_off_prepare(void) acpi_disable_all_gpes(); } -static void acpi_power_off(void) +static int acpi_power_off(struct notifier_block *this, + unsigned long unused1, void *unused2) { /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ printk(KERN_DEBUG "%s called\n", __func__); local_irq_disable(); acpi_enter_sleep_state(ACPI_STATE_S5); + + return NOTIFY_DONE; } +static struct notifier_block acpi_poweroff_nb = { + .notifier_call = acpi_power_off, + .priority = 192, +}; + int __init acpi_sleep_init(void) { char supported[ACPI_S_STATE_COUNT * 3 + 1]; @@ -835,7 +845,8 @@ int __init acpi_sleep_init(void) if (acpi_sleep_state_supported(ACPI_STATE_S5)) { sleep_states[ACPI_STATE_S5] = 1; pm_power_off_prepare = acpi_power_off_prepare; - pm_power_off = acpi_power_off; + if (register_poweroff_handler(&acpi_poweroff_nb)) + pr_err("acpi: Failed to register poweroff handler\n"); } supported[0] = 0; -- 1.9.1