From patchwork Sat Nov 5 21:48:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 16037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1186523wru; Sat, 5 Nov 2022 14:49:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5w7CZ3MOkUst340z782rWwXJqclyoo5GQpE0u1lGpzojaHWmHCngym5u/8tvbSbx6Zg2Jf X-Received: by 2002:a17:90b:4f4c:b0:216:cdf6:5c39 with SMTP id pj12-20020a17090b4f4c00b00216cdf65c39mr11774107pjb.237.1667684975001; Sat, 05 Nov 2022 14:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667684974; cv=none; d=google.com; s=arc-20160816; b=seuIj9KNzbgTj2rM0b7TcrjqcjbzA0c+T+EYLWYsj4QeZXPHBLu2ylvYFJxcHqrunD YRbvuEJlc67No8OWDfixbvy728E3hNhClbXOcZUYTAta2dzXLwO0uDcnuPbdvCFqSGFC R1Ev3PFV4yNwpk7IO/OPGDte6P5VWp64nTfEH8CoYiyw+c5w8v0PKHBoWPkGAj0KYcQ4 nhG/1LnUd6aFBS2KJ9D4bEPmh0rKqX+wSxP5QyoTNZD7vRapkisdocir9e8Si9qSlIb0 BDeRIUFwM2Ncw+0YINjiGVNtrrof/JbZpujpykjHsqliCAIkMXHcwwNk7GUCclTpNpvj aluw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=ZcG1ArcUeKGaZd5PrcG3/1gsyCRPoz0HrnVVRDFda8o=; b=K2RZAf4/s3I0lYh1GM2FqNivRjG3YaMCLXHa6SEg9DXZKLq2IxeeqZ/9Fd42OGbc2p wjPFRHgWTp12JyS0GT3uoVbWPlWHrdYXTb9segTRx+wNLWPsGYdqN0TG4cv/2Ez+wxuR bVClJJPxdXHVzLponGFmYSsC5vTJ/q/wfzq7GemoUqG2MWGh5xyb3RuXwsAx5cJsodYR iuBvepy5+17m5sIZPiP6hT7FBgCB1WcNZ92zEZ4t8xUwoIUe22Z+R0VUISzU8RfzckHU OSq5bc1M9W2xne1nL3NJpf3xq98DOFikqkFaGzmKc7DFibKGA9NOyg8lXXJsS6HoDNT1 K0mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=lt1OxjWm; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QxhX3TCn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 2-20020a621902000000b0054ed3047ee2si3927260pfz.22.2022.11.05.14.49.22; Sat, 05 Nov 2022 14:49:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=lt1OxjWm; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QxhX3TCn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229479AbiKEVtD (ORCPT + 99 others); Sat, 5 Nov 2022 17:49:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbiKEVss (ORCPT ); Sat, 5 Nov 2022 17:48:48 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 787E6DEBB for ; Sat, 5 Nov 2022 14:48:47 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 8D843320034E; Sat, 5 Nov 2022 17:48:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 05 Nov 2022 17:48:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1667684926; x=1667771326; bh=Zc G1ArcUeKGaZd5PrcG3/1gsyCRPoz0HrnVVRDFda8o=; b=lt1OxjWmL1nd76byHp +iLUkjYf1FXz50/TIKpxCQ32IFhvnOi/5U6n/6LITuWcWty1X17uEPFrIkgP4J0X +zdzkEkXl3zqra9oQR3jcHgXUa5d/5xkHDhie31xFsRbN0Xduv2mRh4HHpULzyzN nvXloCvUet97MqU/X+toReAG5kVJe3vTpfGOmpe1VoRmKYGraaXOmKXwphZJ4sBj ZJKHdyJ7dTnJK30Hclt3Im9/ouLr5oiZl/kDS/ewBmzzDzmKTe1zCpoioG3tikBj X9UwDv6xQ/IpFOuiF3F5j2sAih1p0dZ4kmP3qOQkWBiXdBzsiqd5vijbajDVJBhI Mx0g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1667684926; x=1667771326; bh=ZcG1ArcUeKGaZ d5PrcG3/1gsyCRPoz0HrnVVRDFda8o=; b=QxhX3TCnyL73D6/2ikOn311BWBU4F tyQcJAH7rIOr1ptw+OjFf5fdT8sZiNY42764LEbZIHxlLNfEr0fBw68M3a0k2y9P qlzX/A3NmkKqGnewHldOq0USkGFTCVwUbCrYEl6COC9/NKRnHDJ1wqNtzQIWKsrE tvhrjFfwb6cRRHyPlarOw2rL4TEdX7QfFW9MeM9I85BcXg3CLtt+IBY3YOIFap84 qhe+C2gY3aK+tOsIW11JwELtlk2fSnxe7Td25r1HS/Q/zI6HdZmqxNjYnHIXJNPK 8r4UwWO3ohG0tgHeYYY5KzzMynlsXo4x4a/TEEPEMYTQzJj2m2A3EzjSA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvdeggdefkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 5 Nov 2022 17:48:45 -0400 (EDT) From: Samuel Holland To: Dmitry Osipenko , "Rafael J . Wysocki" , Mark Rutland , Lorenzo Pieralisi Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Samuel Holland Subject: [PATCH 1/2] kernel/reboot: Use the static sys-off handler for any priority Date: Sat, 5 Nov 2022 16:48:39 -0500 Message-Id: <20221105214841.7828-2-samuel@sholland.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221105214841.7828-1-samuel@sholland.org> References: <20221105214841.7828-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748694440452934380?= X-GMAIL-MSGID: =?utf-8?q?1748694440452934380?= commit 587b9bfe0668 ("kernel/reboot: Use static handler for register_platform_power_off()") addded a statically-allocated handler so register_sys_off_handler() could be called before the slab allocator is available. That behavior was limited to the SYS_OFF_PRIO_PLATFORM priority. However, it is also required for handlers such as PSCI on ARM, which needs to be registered at SYS_OFF_PRIO_FIRMWARE. Currently, this call stack crashes: start_kernel() setup_arch() psci_dt_init() psci_0_2_init() register_sys_off_handler() kmem_cache_alloc() Generalize the code to use the statically-allocated handler for the first registration, regardless of priority. Check .sys_off_cb for conflicts instead of .cb_data; some callbacks (e.g. firmware) do not need any per-instance data, so .cb_data could be NULL. Signed-off-by: Samuel Holland Reviewed-by: Dmitry Osipenko --- kernel/reboot.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kernel/reboot.c b/kernel/reboot.c index 3bba88c7ffc6..38c18d4f0a36 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -327,7 +327,7 @@ static int sys_off_notify(struct notifier_block *nb, return handler->sys_off_cb(&data); } -static struct sys_off_handler platform_sys_off_handler; +static struct sys_off_handler early_sys_off_handler; static struct sys_off_handler *alloc_sys_off_handler(int priority) { @@ -338,10 +338,8 @@ static struct sys_off_handler *alloc_sys_off_handler(int priority) * Platforms like m68k can't allocate sys_off handler dynamically * at the early boot time because memory allocator isn't available yet. */ - if (priority == SYS_OFF_PRIO_PLATFORM) { - handler = &platform_sys_off_handler; - if (handler->cb_data) - return ERR_PTR(-EBUSY); + if (!early_sys_off_handler.sys_off_cb) { + handler = &early_sys_off_handler; } else { if (system_state > SYSTEM_RUNNING) flags = GFP_ATOMIC; @@ -358,7 +356,7 @@ static struct sys_off_handler *alloc_sys_off_handler(int priority) static void free_sys_off_handler(struct sys_off_handler *handler) { - if (handler == &platform_sys_off_handler) + if (handler == &early_sys_off_handler) memset(handler, 0, sizeof(*handler)); else kfree(handler); From patchwork Sat Nov 5 21:48:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 16038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1186737wru; Sat, 5 Nov 2022 14:50:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4NTx53NsdOgvAyP+Y0bZUeaWGpFNzB0V8a6GpB9on0rTvBW6HNxjKlLVC3hiwl+9RCSb5V X-Received: by 2002:a62:cec8:0:b0:56c:235:8399 with SMTP id y191-20020a62cec8000000b0056c02358399mr43151488pfg.64.1667685009706; Sat, 05 Nov 2022 14:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667685009; cv=none; d=google.com; s=arc-20160816; b=BquaSIZ/d3PF0vER4ZaYGFXcc8hJNeWJ0ImryxZAxZifAW6QyqYrnXRGvlil0euFC+ VuT0W2UWLYzdeTThkj+Royu0cJRAcxfzR+54Qjs1Isis8fvEdkuqWU8zc5BIitj0TFwc zXmhY0UOloY4XDbcooTXc9XK2f85VbcPRxN5weNy3LuxVrP/28cWbcm1JFXR/GCr3Vm1 2P/jJ7trVVLbhnBx27jYT+MKPHyIWqhWdToVM+N/5E5x9ZlvbqkcRu/GOfoU2fVa6+p8 QypC8NgVeoGfBDpJ/AJDaEnxU/zwqgdS/LqW0OQsHn4xFIIboilSwJ/xI4E5zJCB8Cao 3upQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=H8veXpvoO34Pl6tFHer7gYF/PO/WldpA4cjeFDX9dV0=; b=shhxvDGfGuci7AA3VcogHVfjFpj6Bp++KwC5Y5LxQqXaLyxYGXqyEKuxlVErZ20mTg /SCY94jc/pRvHWYMndCqHWM/asH+Whq2GjcNO9dUImje/NGx8qxbxeLGJokio0K09Vtt HxAlF7acghxh0Tgm3w//aD2k7i/cKjmYL7CAdnFe1ioAlykZiX3vO3q8BW7PdbEbEgIx bHa+/p/1H5A+WSsEH1CRtUW/Dzc1iPBeaGi1jwaCkZnmEWGUbAGYUKxfgRK9LM1oQ+6P BohFoKGuWOs34rK06U9HikqyvOR5NLsP+z14pl3nChP9u2DqrtP5zjnwmaO/tf2wzyM/ w5Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=BOQ+xVr9; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ttfz6Ev9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020a65690f000000b0046ebaed8e45si4465905pgq.62.2022.11.05.14.49.57; Sat, 05 Nov 2022 14:50:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=BOQ+xVr9; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ttfz6Ev9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230088AbiKEVtJ (ORCPT + 99 others); Sat, 5 Nov 2022 17:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbiKEVsu (ORCPT ); Sat, 5 Nov 2022 17:48:50 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD77213DE7 for ; Sat, 5 Nov 2022 14:48:49 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id DF302320027A; Sat, 5 Nov 2022 17:48:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 05 Nov 2022 17:48:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1667684928; x=1667771328; bh=H8 veXpvoO34Pl6tFHer7gYF/PO/WldpA4cjeFDX9dV0=; b=BOQ+xVr9BgNBJ53Np2 2GVbC01Gy1k7LsisJ6a4HuFQ3aNwUYuzdzm3kSYYjx33wwfxPd0z3fECkRdEfz4F 62Ckj0vTqo+3S0f1R73TNu9D4AXuFNon1dbIpj9aF4IKjZk2tDFoPyojbI0oQ5Ix g4FwJgG5IO77IGz6Jr3cpRjq8dhQogtGz1IRhP3LwNipbhXviPOBoGB0/NIncCQX U6qCvJNceg91LP93s5iTTQdXCfCxWf/1fTzpJYAwa0dbpMGBt99el8lLAPM6Yp7U 8YPb8yfCQd5ZeWTXhK6J515XXEX+UQMNrnHpZaMMKsQ//xhb7epA0EqIw7JVLRUT T8bQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1667684928; x=1667771328; bh=H8veXpvoO34Pl 6tFHer7gYF/PO/WldpA4cjeFDX9dV0=; b=ttfz6Ev9+nb8DRzIFbSUQXXoxy9ds MqMYAiRBBZ3/WgwsScVNN2kM2Sgat6JoK3cuvMFUt1Aoicg3XsJDkqDiCmPBy2CE xVzfbYRrCAn7ViWfA2DrzmRnqphG4AkBaJqKRIpfjTH3FZs6uwmdxs1RKs0MPlYY obe6NpNuqQ7Flq1zyG6ykN3p32xcz59OpwqWmcetbOYO38K/MBODaAO6H7SSz5a3 ZwZYYEKPHLxBZ5QkpWMj9Ehqi9tFw8tX6MgvREmHH1+IqcDUZtVj5K6BJLrIQb3l U9cQtO+CZYTwm+FzVVabUcWH9lVZBKk/yzLK2u3Qvnti3H5yt22pP7a3g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvdeggdefkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 5 Nov 2022 17:48:47 -0400 (EDT) From: Samuel Holland To: Dmitry Osipenko , "Rafael J . Wysocki" , Mark Rutland , Lorenzo Pieralisi Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Samuel Holland Subject: [PATCH 2/2] firmware/psci: Switch to the sys-off handler API Date: Sat, 5 Nov 2022 16:48:40 -0500 Message-Id: <20221105214841.7828-3-samuel@sholland.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221105214841.7828-1-samuel@sholland.org> References: <20221105214841.7828-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748694447166646006?= X-GMAIL-MSGID: =?utf-8?q?1748694476700633749?= Any other poweroff handlers registered at the default priority will run before the legacy pm_power_off() function. Register the PSCI poweroff handler with the correct priority to ensure it runs first. Signed-off-by: Samuel Holland --- drivers/firmware/psci/psci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index e7bcfca4159f..6d528021925d 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -322,9 +321,11 @@ static struct notifier_block psci_sys_reset_nb = { .priority = 129, }; -static void psci_sys_poweroff(void) +static int psci_sys_poweroff(struct sys_off_data *data) { invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); + + return NOTIFY_DONE; } static int psci_features(u32 psci_func_id) @@ -603,7 +604,9 @@ static void __init psci_0_2_set_functions(void) register_restart_handler(&psci_sys_reset_nb); - pm_power_off = psci_sys_poweroff; + register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_FIRMWARE, + psci_sys_poweroff, NULL); } /*