From patchwork Fri Apr 8 12:53:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 8783481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CFFD1C0553 for ; Fri, 8 Apr 2016 12:56:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F6322027D for ; Fri, 8 Apr 2016 12:56:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 455C0201ED for ; Fri, 8 Apr 2016 12:56:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aoVvu-0005Q9-5O; Fri, 08 Apr 2016 12:54:42 +0000 Received: from bh-25.webhostbox.net ([208.91.199.152]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aoVvZ-00059F-1a for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2016 12:54:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=e46zuc99oOsud/puqDhJYtHor34oh8iiHzx58tRl/h0=; b=s/dLkJ/qGwPkXq G/tjMVcUcZo2Vat/lhkXI0MUu3GgzmYArYE5X97UXqFHiJANSV20JbpsPr0nzaJfQm5EA/L5vFjzg NuAe9iqLg5teag8iAssnxIP77F82PmdCI8DTOC0RakoS1sE/jgO7YB+EQGwj+d5tKop7Vn6vnO4/D Ywqic8+AMyDTUghcHundCfKvlRfx9p9XGz4Wh64vP+yN1WWhEpgq3NWG62RnFEqTiNLi7HFnajyf5 YbTNAlU0cok48Y1CD+jTJrS5LgdpZaDCBXTLFg2dkaOosZDSr8NHjRaI7VZ2ON7M5ybaUBziIwwSO sWcC6PzJE3HOn9pJkWJA==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:53844 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1aoVvF-001yy9-36; Fri, 08 Apr 2016 12:54:01 +0000 From: Guenter Roeck To: Russell King , Catalin Marinas Subject: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler Date: Fri, 8 Apr 2016 05:53:56 -0700 Message-Id: <1460120039-2497-4-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460120039-2497-1-git-send-email-linux@roeck-us.net> References: <1460120039-2497-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160408_055421_315513_992D03DC X-CRM114-Status: GOOD ( 12.13 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Lorenzo Pieralisi , Wolfram Sang , linux-kernel@vger.kernel.org, Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, Guenter Roeck MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Register with kernel restart handler instead of setting arm_pm_restart directly. This enables support for replacing the PSCI restart handler with a different handler if necessary for a specific board. Select a priority of 129 to indicate a higher than default priority, but keep it as low as possible since PSCI reset is known to fail on some boards. Signed-off-by: Guenter Roeck --- It might make sense to introduce a restart-priority property for devicetree based configurations, but I am not sure if this would be acceptable. drivers/firmware/psci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 11bfee8b79a9..99fab3ac3fd5 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -231,11 +231,18 @@ static int get_set_conduit_method(struct device_node *np) return 0; } -static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) +static int psci_sys_reset(struct notifier_block *np, unsigned long action, + void *data) { invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); + return NOTIFY_DONE; } +static struct notifier_block psci_sys_reset_nb = { + .notifier_call = psci_sys_reset, + .priority = 129, +}; + static void psci_sys_poweroff(void) { invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); @@ -461,7 +468,7 @@ static void __init psci_0_2_set_functions(void) psci_ops.migrate_info_type = psci_migrate_info_type; - arm_pm_restart = psci_sys_reset; + register_restart_handler(&psci_sys_reset_nb); pm_power_off = psci_sys_poweroff; }