From patchwork Sun Jan 30 23:36:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15BC1C35275 for ; Sun, 30 Jan 2022 23:37:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262556.454811 (Exim 4.92) (envelope-from ) id 1nEJlC-00041O-Qt; Sun, 30 Jan 2022 23:37:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262556.454811; Sun, 30 Jan 2022 23:37:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlC-00041H-NZ; Sun, 30 Jan 2022 23:37:30 +0000 Received: by outflank-mailman (input) for mailman id 262556; Sun, 30 Jan 2022 23:37:29 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlB-0003lI-4m for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:29 +0000 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [2a00:1450:4864:20::12b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9570ed19-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:27 +0100 (CET) Received: by mail-lf1-x12b.google.com with SMTP id u14so23249771lfo.11 for ; Sun, 30 Jan 2022 15:37:27 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:26 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9570ed19-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6/CD3Yv31GR8y8GlEUTCAOWsPgz1l4zxLQQTTW1e5nA=; b=eMhJF7grCwjcHhcO0w6NJcJWCpwGV9U0gCsMg0TGwobGBXDG7Vx/L97nAcGbsxn/0t lOUlBHMB48PlUMU15vUurm7j0pvN5BFXkJhFXzQtsg8F+BsiLTVvb3ey/9EANWthyhTT we8glm85/CmQP0QZ8+T+Lm4inD6Om2LbGaB9R6csyvcPXIEYpw/bulY/B/lTyYKOPz5Q wxGxNLfaFVrUEh4p7rOa6O9dbsq2pKYOYPMchljsZ3p2oxyKvQjmDp8knc5kaAt3dCPj bpgTHYROYSaO5OyxFwKNgiQ6VFzTC+FU7O5VMWWPycH5YgdBO3xjR5PNbDcl/bJI2s7Z GBBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6/CD3Yv31GR8y8GlEUTCAOWsPgz1l4zxLQQTTW1e5nA=; b=e6WZ6Do4MwhebRncLyDamMXc4JqxHT66p3uyYqEORVoCwY6eBiBKRIiEh56mOviwnL kK+KjWCoXeb8A243O44ylxlj3IKoKONDg+NuqxzTHDn7hY+fQWhyRJWThhDOKi2+bs32 tzBg7TPFTYoXd02CQ9Vn4CwQSyQz4FdP2ZMm6xeL/1JSuLSnlM6TKdLvWLr4Jxpp43UK XY/vivsVxMtNNvLLfjuCr6ItHUuWmXRK4D8Alg2ssUukPdGfCQlSj5ND2nBQCHuYDCDN v6YCjyK7AcnzrZcxcKwQH3vhpqgVxKoAduNcHjiNaqbhf++lQm5ga/BDd7YqvpKSxGUX Ol1A== X-Gm-Message-State: AOAM533QjAOXQQYiBqISbWEX2Ivg1IQGjjrhBxWRw8lnjACdXvzNUuYG 0OLxGlzNKxtaMyfKP4Oy3NY= X-Google-Smtp-Source: ABdhPJx51hnlnQqEq7wZo+FkbVvoWM1PpIEWobaBlkXpSMr/tjqFbuGZX/Rv6DdZhPEAEqmSsBcOEQ== X-Received: by 2002:a05:6512:38a6:: with SMTP id o6mr13194842lft.4.1643585847142; Sun, 30 Jan 2022 15:37:27 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 01/21] notifier: Add blocking_notifier_call_chain_is_empty() Date: Mon, 31 Jan 2022 02:36:58 +0300 Message-Id: <20220130233718.21544-2-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Add blocking_notifier_call_chain_is_empty() that returns true if call chain is empty. Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 2 ++ kernel/notifier.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 87069b8459af..d4717bc0ab85 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -173,6 +173,8 @@ extern int blocking_notifier_call_chain_robust(struct blocking_notifier_head *nh extern int raw_notifier_call_chain_robust(struct raw_notifier_head *nh, unsigned long val_up, unsigned long val_down, void *v); +extern bool blocking_notifier_call_chain_is_empty(struct blocking_notifier_head *nh); + #define NOTIFY_DONE 0x0000 /* Don't care */ #define NOTIFY_OK 0x0001 /* Suits me */ #define NOTIFY_STOP_MASK 0x8000 /* Don't call further */ diff --git a/kernel/notifier.c b/kernel/notifier.c index ba005ebf4730..4ed6bda8f127 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -323,6 +323,19 @@ int blocking_notifier_call_chain(struct blocking_notifier_head *nh, } EXPORT_SYMBOL_GPL(blocking_notifier_call_chain); +/** + * blocking_notifier_call_chain_is_empty - Check whether notifier chain is empty + * @nh: Pointer to head of the blocking notifier chain + * + * Checks whether notifier chain is empty. + * + * Returns true is notifier chain is empty, false otherwise. + */ +bool blocking_notifier_call_chain_is_empty(struct blocking_notifier_head *nh) +{ + return !rcu_access_pointer(nh->head); +} + /* * Raw notifier chain routines. There is no protection; * the caller must provide it. Use at your own risk! From patchwork Sun Jan 30 23:36:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B8FFC35274 for ; Sun, 30 Jan 2022 23:37:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262557.454822 (Exim 4.92) (envelope-from ) id 1nEJlE-0004HA-30; Sun, 30 Jan 2022 23:37:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262557.454822; Sun, 30 Jan 2022 23:37:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlD-0004H2-W2; Sun, 30 Jan 2022 23:37:31 +0000 Received: by outflank-mailman (input) for mailman id 262557; Sun, 30 Jan 2022 23:37:30 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlC-0003l1-8r for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:30 +0000 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [2a00:1450:4864:20::129]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 968408d4-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:37:29 +0100 (CET) Received: by mail-lf1-x129.google.com with SMTP id x23so23419004lfc.0 for ; Sun, 30 Jan 2022 15:37:29 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:28 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 968408d4-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=abZuVOnKYJAOti8qIudzltr7GQTBeB9LiERH+rgMBF4=; b=p0RaoTyud6v2TpDuA71R51f3ompbP9DRaCJYPeyLts5rHK9ixyqkUUhLaSJgb2r2Bg 2TTG5yphU072WSUMSAx/Z+kedFFVoyzjVzcSIYIUbH1Yygh8uhixqRaJerJ4N4thXRrQ oujlk5kkszBM8GgYOLJuChJo6KFJbDZwMBSQdgvwviExvuANo3f0HA/iWpifG7cGjO9P b27LiqDaZyav/RPf+JoXyPtERudU0yiqx/A+AO0NhKUrQUUb079dd3JY2rcLq6SyDepk dR2VkwBl97GbYrFjbl4KaoSrBe6E7PpqgsF7oDcCPQvs2XTA7ek0i6MDjXu+YxCSo722 08Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=abZuVOnKYJAOti8qIudzltr7GQTBeB9LiERH+rgMBF4=; b=Oqp+o/Hqu+qpEaTcas3LENrT0p3zSOeR1ul1Bz4ZvbmNWTbgGSsXvdQo8f/yz8r7/t PEW/kc0vO1YBXOQqeoBWRP2dGdhHu3S2KMshYCVycgJsIwP+UXj2z4+VbGeYxKEnT8FC 05FVe0e0MC4gcDR+9isypjh8bBbLhizXaszakGIQYEnEjOtwKKE6QmS51KZKkjJMQ7wj 41XKG4KsfqfwUOkiQOJaB367J/KhsTwiY6thhiWF/ljOvyb8nwVGXkkXLxYNGGg6TqTT FlwUvEv52lVT4NDEd4xHdrBpIB271HQEymPa7WvzIwMwfMgyCKTSqmf6wa7b8GOn9Ea+ XZVw== X-Gm-Message-State: AOAM532W9fL8XZ99xeVeDMRipSzZt4Xme7V+iE2ir0dh4eSTMsTWrPDJ mLZjme+f4R9DFl1ZtoIMI0E= X-Google-Smtp-Source: ABdhPJwoSJ34ynL6g6uCWlwcTzESsIxMTUNdOjTg1GYgEDzDCVzjTtPXpJhMlyQWeh/100C0s5LuvA== X-Received: by 2002:ac2:554a:: with SMTP id l10mr13295710lfk.534.1643585848967; Sun, 30 Jan 2022 15:37:28 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 02/21] notifier: Add atomic/blocking_notifier_chain_register_unique_prio() Date: Mon, 31 Jan 2022 02:36:59 +0300 Message-Id: <20220130233718.21544-3-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Add variant of atomic/blocking_notifier_chain_register() functions that doesn't allow to register notifier using a duplicated priority. The -EBUSY error code is returned in this case by the new API functions. Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 5 +++ kernel/notifier.c | 88 +++++++++++++++++++++++++++++++--------- 2 files changed, 74 insertions(+), 19 deletions(-) diff --git a/include/linux/notifier.h b/include/linux/notifier.h index d4717bc0ab85..ccce26197dd2 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -150,6 +150,11 @@ extern int raw_notifier_chain_register(struct raw_notifier_head *nh, extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, struct notifier_block *nb); +extern int atomic_notifier_chain_register_unique_prio( + struct atomic_notifier_head *nh, struct notifier_block *nb); +extern int blocking_notifier_chain_register_unique_prio( + struct blocking_notifier_head *nh, struct notifier_block *nb); + extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, struct notifier_block *nb); extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, diff --git a/kernel/notifier.c b/kernel/notifier.c index 4ed6bda8f127..4fc32b1e6cbb 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -20,7 +20,8 @@ BLOCKING_NOTIFIER_HEAD(reboot_notifier_list); */ static int notifier_chain_register(struct notifier_block **nl, - struct notifier_block *n) + struct notifier_block *n, + bool unique_priority) { while ((*nl) != NULL) { if (unlikely((*nl) == n)) { @@ -30,6 +31,8 @@ static int notifier_chain_register(struct notifier_block **nl, } if (n->priority > (*nl)->priority) break; + if (n->priority == (*nl)->priority && unique_priority) + return -EBUSY; nl = &((*nl)->next); } n->next = *nl; @@ -144,12 +147,35 @@ int atomic_notifier_chain_register(struct atomic_notifier_head *nh, int ret; spin_lock_irqsave(&nh->lock, flags); - ret = notifier_chain_register(&nh->head, n); + ret = notifier_chain_register(&nh->head, n, false); spin_unlock_irqrestore(&nh->lock, flags); return ret; } EXPORT_SYMBOL_GPL(atomic_notifier_chain_register); +/** + * atomic_notifier_chain_register_unique_prio - Add notifier to an atomic notifier chain + * @nh: Pointer to head of the atomic notifier chain + * @n: New entry in notifier chain + * + * Adds a notifier to an atomic notifier chain if there is no other + * notifier registered using the same priority. + * + * Returns 0 on success, %-EEXIST or %-EBUSY on error. + */ +int atomic_notifier_chain_register_unique_prio(struct atomic_notifier_head *nh, + struct notifier_block *n) +{ + unsigned long flags; + int ret; + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_register(&nh->head, n, true); + spin_unlock_irqrestore(&nh->lock, flags); + return ret; +} +EXPORT_SYMBOL_GPL(atomic_notifier_chain_register_unique_prio); + /** * atomic_notifier_chain_unregister - Remove notifier from an atomic notifier chain * @nh: Pointer to head of the atomic notifier chain @@ -209,18 +235,9 @@ NOKPROBE_SYMBOL(atomic_notifier_call_chain); * synchronized by an rwsem. */ -/** - * blocking_notifier_chain_register - Add notifier to a blocking notifier chain - * @nh: Pointer to head of the blocking notifier chain - * @n: New entry in notifier chain - * - * Adds a notifier to a blocking notifier chain. - * Must be called in process context. - * - * Returns 0 on success, %-EEXIST on error. - */ -int blocking_notifier_chain_register(struct blocking_notifier_head *nh, - struct notifier_block *n) +static int __blocking_notifier_chain_register(struct blocking_notifier_head *nh, + struct notifier_block *n, + bool unique_priority) { int ret; @@ -230,15 +247,48 @@ int blocking_notifier_chain_register(struct blocking_notifier_head *nh, * such times we must not call down_write(). */ if (unlikely(system_state == SYSTEM_BOOTING)) - return notifier_chain_register(&nh->head, n); + return notifier_chain_register(&nh->head, n, unique_priority); down_write(&nh->rwsem); - ret = notifier_chain_register(&nh->head, n); + ret = notifier_chain_register(&nh->head, n, unique_priority); up_write(&nh->rwsem); return ret; } + +/** + * blocking_notifier_chain_register - Add notifier to a blocking notifier chain + * @nh: Pointer to head of the blocking notifier chain + * @n: New entry in notifier chain + * + * Adds a notifier to a blocking notifier chain. + * Must be called in process context. + * + * Returns 0 on success, %-EEXIST on error. + */ +int blocking_notifier_chain_register(struct blocking_notifier_head *nh, + struct notifier_block *n) +{ + return __blocking_notifier_chain_register(nh, n, false); +} EXPORT_SYMBOL_GPL(blocking_notifier_chain_register); +/** + * blocking_notifier_chain_register_unique_prio - Add notifier to a blocking notifier chain + * @nh: Pointer to head of the blocking notifier chain + * @n: New entry in notifier chain + * + * Adds a notifier to an blocking notifier chain if there is no other + * notifier registered using the same priority. + * + * Returns 0 on success, %-EEXIST or %-EBUSY on error. + */ +int blocking_notifier_chain_register_unique_prio(struct blocking_notifier_head *nh, + struct notifier_block *n) +{ + return __blocking_notifier_chain_register(nh, n, true); +} +EXPORT_SYMBOL_GPL(blocking_notifier_chain_register_unique_prio); + /** * blocking_notifier_chain_unregister - Remove notifier from a blocking notifier chain * @nh: Pointer to head of the blocking notifier chain @@ -354,7 +404,7 @@ bool blocking_notifier_call_chain_is_empty(struct blocking_notifier_head *nh) int raw_notifier_chain_register(struct raw_notifier_head *nh, struct notifier_block *n) { - return notifier_chain_register(&nh->head, n); + return notifier_chain_register(&nh->head, n, false); } EXPORT_SYMBOL_GPL(raw_notifier_chain_register); @@ -433,10 +483,10 @@ int srcu_notifier_chain_register(struct srcu_notifier_head *nh, * such times we must not call mutex_lock(). */ if (unlikely(system_state == SYSTEM_BOOTING)) - return notifier_chain_register(&nh->head, n); + return notifier_chain_register(&nh->head, n, false); mutex_lock(&nh->mutex); - ret = notifier_chain_register(&nh->head, n); + ret = notifier_chain_register(&nh->head, n, false); mutex_unlock(&nh->mutex); return ret; } From patchwork Sun Jan 30 23:37:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3AA9BC35276 for ; Sun, 30 Jan 2022 23:37:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262558.454828 (Exim 4.92) (envelope-from ) id 1nEJlE-0004Jb-Ev; Sun, 30 Jan 2022 23:37:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262558.454828; Sun, 30 Jan 2022 23:37:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlE-0004J5-9I; Sun, 30 Jan 2022 23:37:32 +0000 Received: by outflank-mailman (input) for mailman id 262558; Sun, 30 Jan 2022 23:37:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlD-0003lI-Nv for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:31 +0000 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [2a00:1450:4864:20::233]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 978fc314-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:31 +0100 (CET) Received: by mail-lj1-x233.google.com with SMTP id t14so17068583ljh.8 for ; Sun, 30 Jan 2022 15:37:31 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:30 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 978fc314-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=omD9ii6hdmOPOLz0ZrMYTS/dF5Fa75SnRoAvSUBcMXk=; b=cQofKfpuj96FPKIuElG4JVB5ebsyCGvTeW5J4j2MH7X0WRLgzbVACf4DTute0QixNl XMz7+003bKZlwkXkPIQbN8oTinvwUmojDoYGjYhv7pjY2trTgrMx6mGzRdNnLsY8mkl2 7WmE4naskN1xx+dSFpiWKWqfRvBmvOtiRbW6rsCNAcLJPNEVLDCe91z6iUu5+BFugaT2 bIk9Hfq63C50xsIBoY2u595h9M/qG+2YlE2Nn78b7kg2gyK8fxA4P0H2C4WFKliLAVXZ 7qPk0tNjqYTPF3ucU8/++kKEXP9ZHsFeIbMKK+4hihzAWu5kciFNMvK+pAj6fKNfAPQ5 xmCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=omD9ii6hdmOPOLz0ZrMYTS/dF5Fa75SnRoAvSUBcMXk=; b=TNqFMX/lCN/kF+KdaH2efVW/685vGXbXGrJBEbyapLPS6OyU70/2NekDKjbNtaGZCB VlR84cW1ese7GNzRcyGO+wYdAbv/MODmoWLSmgZOZJSyQ1ysjtLNtHXK73kueWxwmNpg xP5xlIwXWWphIWZa+76m7cBaxxLQBqYvsf/8cZdJewttLCOJY7cDJIoD2R4PCGOWZuTA 5oFtHxS8s5jmwd/flz00rI++Q0qLQqG60N/o+TyzboM0lqee3g01I9Yfv9c+K9tLw+G6 vsmeesRe92CtFuIJdznqSJ13gO4OFhzh5fywRXLlW3gsO/WpZQMyW/oc+RWqi6EM+/Qp /kEQ== X-Gm-Message-State: AOAM533nbiNDcIwZHaHSeQo0bX4miikXIpWTCdYU0skZzsHxe5kMl+T5 Ya+smpP8PEdOCPF/Bom5/6Q= X-Google-Smtp-Source: ABdhPJzH4GGHER1dd7BkRpS9JCpguXkNuEOfM70GPh5pyei2pr3VhMNQQj2zlKMHcg7OCQ6lFFEolA== X-Received: by 2002:a2e:7a06:: with SMTP id v6mr12281006ljc.301.1643585850758; Sun, 30 Jan 2022 15:37:30 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 03/21] reboot: Print error message if restart handler has duplicated priority Date: Mon, 31 Jan 2022 02:37:00 +0300 Message-Id: <20220130233718.21544-4-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Add sanity check which ensures that there are no two restart handlers registered using the same priority. This requirement will become mandatory once all drivers will be converted to the new API and such errors will be fixed. Signed-off-by: Dmitry Osipenko --- kernel/reboot.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/reboot.c b/kernel/reboot.c index 6bcc5d6a6572..35f0cde641c1 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -182,6 +182,21 @@ static ATOMIC_NOTIFIER_HEAD(restart_handler_list); */ int register_restart_handler(struct notifier_block *nb) { + int ret; + + ret = atomic_notifier_chain_register_unique_prio(&restart_handler_list, nb); + if (ret != -EBUSY) + return ret; + + /* + * Handler must have unique priority. Otherwise call order is + * determined by registration order, which is unreliable. + * + * This requirement will become mandatory once all drivers + * will be converted to use new sys-off API. + */ + pr_err("failed to register restart handler using unique priority\n"); + return atomic_notifier_chain_register(&restart_handler_list, nb); } EXPORT_SYMBOL(register_restart_handler); From patchwork Sun Jan 30 23:37:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE835C433FE for ; Sun, 30 Jan 2022 23:37:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262560.454852 (Exim 4.92) (envelope-from ) id 1nEJlJ-0004wL-8y; Sun, 30 Jan 2022 23:37:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262560.454852; Sun, 30 Jan 2022 23:37:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlI-0004vJ-SL; Sun, 30 Jan 2022 23:37:36 +0000 Received: by outflank-mailman (input) for mailman id 262560; Sun, 30 Jan 2022 23:37:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlH-0003l1-6l for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:35 +0000 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [2a00:1450:4864:20::133]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 98f23d79-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:37:33 +0100 (CET) Received: by mail-lf1-x133.google.com with SMTP id a28so23275420lfl.7 for ; Sun, 30 Jan 2022 15:37:33 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:32 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 98f23d79-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=38q4P9PH9nES8RczvE7OnqqkPXztayfrVWMcaUM8s+A=; b=Q5MMOfb7rSODkS2kn3q5XZwf8zqIJ51IQ9xubkbgFUXSkjeQuaWSup3m+O4pqzEDb+ E5n9vGkwG0A9gd4ThXBeoS4gmKX3lE/LDT4c+lQtj8pSMtUOMy+/RfxrZFjXGS7nFwz3 Ea8wdh6MqebEmUMqRIX0pFbIr1vxXIyTdEq6fEBGk8pS5aGMUej1IOxH3mvGTTx8Zb1A p4WtB/fC8HBNV/xxJOVx1rFQqfZwVyB2qQ4QMQgl9eptDSGyK38HXczvAjdOimktb6W5 8rYZQrU03+6DIo9Weao9ASYgqF1QhkVgUfmExWAQVTk5LYoCXz0MemHnQpiOtJnXUQLZ yZeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=38q4P9PH9nES8RczvE7OnqqkPXztayfrVWMcaUM8s+A=; b=JM0FaQk5BEWj/toFbFWOvlONPofVwiNhLoUar0xriMNsK2l83UCDvWtUlMUDwPpafr oAtGfSqIELYCPGFv8s9rCmwKU8rV8gUXwlyUmtwqFAmW4vVNNnr+I3lddjtYFVDBiF3S VE15Kbyf1O4KnRcLEjcjokbh+JEOz3n0q40xOr067ENYZ/SN9fZtB3gJ8Q0hfxvbnYzs fDoHjMnTrTUIsnbz50YHS3q0GPjBGVq21J74kFcr6d4jrExBhSwfeSk9FmploLCtxswk 2QZBVojX7ZWieS/QAYryVC8IjRPCI5+u3Iq3OwuaH+YCv40pAECWVorotrtG48dAvX0n Z5Ng== X-Gm-Message-State: AOAM531rxnrjuUL3/0+52gpVxNOA1Y5YZoRbPDlJMMh2NDXf96cFIBNX izs5YyNkYb8h0oB7zsucyuI= X-Google-Smtp-Source: ABdhPJwx3H1Lxh28u4hkNoEI/kzbRKfVLKfuDBCQcQ68ILBqPiTWY9aJ1dkoCljIJtKgelCY8ITq2Q== X-Received: by 2002:a05:6512:23a2:: with SMTP id c34mr13488689lfv.623.1643585852671; Sun, 30 Jan 2022 15:37:32 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 04/21] kernel: Add combined power-off+restart handler call chain API Date: Mon, 31 Jan 2022 02:37:01 +0300 Message-Id: <20220130233718.21544-5-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 SoC platforms often have multiple ways of how to perform system's power-off and restart operations. Meanwhile today's kernel is limited to a single option. Add combined power-off+restart handler call chain API, which is inspired by the restart API. The new API provides both power-off and restart functionality. The old pm_power_off method will be kept around till all users are converted to the new API. Current restart API will be replaced by the new unified API since new API is its superset. The restart functionality of the sys-off handler API is built upon the existing restart-notifier APIs. In order to ease conversion to the new API, convenient helpers are added for the common use-cases. They will reduce amount of boilerplate code and remove global variables. These helpers preserve old behaviour for cases where only one power-off handler is expected, this is what all existing drivers want, and thus, they could be easily converted to the new API. Users of the new API should explicitly enable power-off chaining by setting corresponding flag of the power_handler structure. Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 265 ++++++++++++++++++- kernel/power/hibernate.c | 2 +- kernel/reboot.c | 555 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 814 insertions(+), 8 deletions(-) diff --git a/include/linux/reboot.h b/include/linux/reboot.h index af907a3d68d1..c2fa8d63c129 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -8,10 +8,35 @@ struct device; -#define SYS_DOWN 0x0001 /* Notify of system down */ -#define SYS_RESTART SYS_DOWN -#define SYS_HALT 0x0002 /* Notify of system halt */ -#define SYS_POWER_OFF 0x0003 /* Notify of system power off */ +enum reboot_prepare_mode { + SYS_DOWN = 1, /* Notify of system down */ + SYS_RESTART = SYS_DOWN, + SYS_HALT, /* Notify of system halt */ + SYS_POWER_OFF, /* Notify of system power off */ +}; + +/* + * Standard restart priority levels. Intended to be set in the + * sys_off_handler.restart_priority field. + * + * Use `RESTART_PRIO_ABC +- prio` style for additional levels. + * + * RESTART_PRIO_RESERVED: Falls back to RESTART_PRIO_DEFAULT. + * Drivers may leave priority initialized + * to zero, to auto-set it to the default level. + * + * RESTART_PRIO_LOW: Use this for handler of last resort. + * + * RESTART_PRIO_DEFAULT: Use this for default/generic handler. + * + * RESTART_PRIO_HIGH: Use this if you have multiple handlers and + * this handler has higher priority than the + * default handler. + */ +#define RESTART_PRIO_RESERVED 0 +#define RESTART_PRIO_LOW 8 +#define RESTART_PRIO_DEFAULT 128 +#define RESTART_PRIO_HIGH 192 enum reboot_mode { REBOOT_UNDEFINED = -1, @@ -49,6 +74,237 @@ extern int register_restart_handler(struct notifier_block *); extern int unregister_restart_handler(struct notifier_block *); extern void do_kernel_restart(char *cmd); +/* + * System power-off and restart API. + */ + +/* + * Standard power-off priority levels. Intended to be set in the + * sys_off_handler.power_off_priority field. + * + * Use `POWEROFF_PRIO_ABC +- prio` style for additional levels. + * + * POWEROFF_PRIO_RESERVED: Falls back to POWEROFF_PRIO_DEFAULT. + * Drivers may leave priority initialized + * to zero, to auto-set it to the default level. + * + * POWEROFF_PRIO_PLATFORM: Intended to be used by platform-level handler. + * Has lowest priority since device drivers are + * expected to take over platform handler which + * doesn't allow further callback chaining. + * + * POWEROFF_PRIO_DEFAULT: Use this for default/generic handler. + * + * POWEROFF_PRIO_FIRMWARE: Use this if handler uses firmware call. + * Has highest priority since firmware is expected + * to know best how to power-off hardware properly. + */ +#define POWEROFF_PRIO_RESERVED 0 +#define POWEROFF_PRIO_PLATFORM 1 +#define POWEROFF_PRIO_DEFAULT 128 +#define POWEROFF_PRIO_HIGH 192 +#define POWEROFF_PRIO_FIRMWARE 224 + +enum poweroff_mode { + POWEROFF_NORMAL = 0, + POWEROFF_PREPARE, +}; + +/** + * struct power_off_data - Power-off callback argument + * + * @cb_data: Callback data. + */ +struct power_off_data { + void *cb_data; +}; + +/** + * struct power_off_prep_data - Power-off preparation callback argument + * + * @cb_data: Callback data. + */ +struct power_off_prep_data { + void *cb_data; +}; + +/** + * struct restart_data - Restart callback argument + * + * @cb_data: Callback data. + * @cmd: Restart command string. + * @stop_chain: Further lower priority callbacks won't be executed if set to + * true. Can be changed within callback. Default is false. + * @mode: Reboot mode ID. + */ +struct restart_data { + void *cb_data; + const char *cmd; + bool stop_chain; + enum reboot_mode mode; +}; + +/** + * struct reboot_prep_data - Reboot and shutdown preparation callback argument + * + * @cb_data: Callback data. + * @cmd: Restart command string. + * @stop_chain: Further lower priority callbacks won't be executed if set to + * true. Can be changed within callback. Default is false. + * @mode: Preparation mode ID. + */ +struct reboot_prep_data { + void *cb_data; + const char *cmd; + bool stop_chain; + enum reboot_prepare_mode mode; +}; + +struct sys_off_handler_private_data { + struct notifier_block power_off_nb; + struct notifier_block restart_nb; + struct notifier_block reboot_nb; + void (*platform_power_off_cb)(void); + void (*simple_power_off_cb)(void *data); + void *simple_power_off_cb_data; + bool registered; +}; + +/** + * struct sys_off_handler - System power-off and restart handler + * + * @cb_data: Pointer to user's data. + * + * @power_off_cb: Callback that powers off this machine. Inactive if NULL. + * + * @power_off_prepare_cb: Power-off preparation callback. All power-off + * preparation callbacks are invoked after @reboot_prepare_cb and before + * @power_off_cb. Inactive if NULL. + * + * @power_off_priority: Power-off callback priority, must be unique. + * Zero value is reserved and auto-reassigned to POWEROFF_PRIO_DEFAULT. + * Inactive if @power_off_cb is NULL. + * + * @power_off_chaining_allowed: Set to false if callback's execution should + * stop when @power_off_cb fails to power off this machine. True if further + * lower priority power-off callback should be executed. False is default + * value. + * + * @restart_cb: Callback that reboots this machine. Inactive if NULL. + * + * @restart_priority: Restart callback priority, must be unique. Zero value + * is reserved and auto-reassigned to RESTART_PRIO_DEFAULT. Inactive if + * @restart_cb is NULL. + * + * @restart_chaining_disallowed: Set to true if callback's execution should + * stop when @restart_cb fails to restart this machine. False if further + * lower priority restart callback should be executed. False is default + * value. + * + * @reboot_prepare_cb: Reboot/shutdown preparation callback. All reboot + * preparation callbacks are invoked before @restart_cb or @power_off_cb, + * depending on the mode. It's registered with register_reboot_notifier(). + * The point is to remove boilerplate code from drivers which use this + * callback in conjunction with the restart/power-off callbacks. + * + * @reboot_priority: Reboot/shutdown preparation callback priority, doesn't + * need to be unique. Zero is default value. Inactive if @reboot_prepare_cb + * is NULL. + * + * @priv: Internal data. Shouldn't be touched. + * + * Describes power-off and restart handlers which are invoked by kernel + * to power off or restart this machine. Supports prioritized chaining for + * both restart and power-off handlers. + * + * Struct sys_off_handler can be static. Members of this structure must not be + * altered while handler is registered. + * + * Fill the structure members and pass it to @register_sys_off_handler(). + */ +struct sys_off_handler { + void *cb_data; + + void (*power_off_cb)(struct power_off_data *data); + void (*power_off_prepare_cb)(struct power_off_prep_data *data); + int power_off_priority; + bool power_off_chaining_allowed; + + void (*restart_cb)(struct restart_data *data); + int restart_priority; + bool restart_chaining_disallowed; + + void (*reboot_prepare_cb)(struct reboot_prep_data *data); + int reboot_priority; + + const struct sys_off_handler_private_data priv; +}; + +int register_sys_off_handler(struct sys_off_handler *handler); +int unregister_sys_off_handler(struct sys_off_handler *handler); + +int devm_register_sys_off_handler(struct device *dev, + struct sys_off_handler *handler); + +int devm_register_prioritized_power_off_handler(struct device *dev, + int priority, + void (*callback)(void *data), + void *cb_data); + +/** + * devm_register_simple_power_off_handler - Register simple power-off callback + * @dev: Device that registers callback + * @callback: Callback function + * @cb_data: Callback's argument + * + * Registers resource-managed power-off callback with default priority. + * It will be invoked as last step of the power-off sequence. Further + * lower priority callbacks won't be executed if this @callback fails. + * + * Returns zero on success, or error code on failure. + */ +static inline int +devm_register_simple_power_off_handler(struct device *dev, + void (*callback)(void *data), + void *cb_data) +{ + return devm_register_prioritized_power_off_handler(dev, + POWEROFF_PRIO_DEFAULT, + callback, cb_data); +} + +int register_platform_power_off(void (*power_off)(void)); +int unregister_platform_power_off(void (*power_off)(void)); + +int devm_register_prioritized_restart_handler(struct device *dev, + int priority, + void (*callback)(struct restart_data *data), + void *cb_data); + +/** + * devm_register_simple_restart_handler - Register simple restart callback + * @dev: Device that registers callback + * @callback: Callback function + * @cb_data: Callback's argument + * + * Registers resource-managed restart callback with default priority. + * It will be invoked as a part of the restart sequence. Further + * lower priority callback will be executed if this @callback fails. + * + * Returns zero on success, or error code on failure. + */ +static inline int +devm_register_simple_restart_handler(struct device *dev, + void (*callback)(struct restart_data *data), + void *cb_data) +{ + return devm_register_prioritized_restart_handler(dev, + RESTART_PRIO_DEFAULT, + callback, cb_data); +} + +void do_kernel_power_off(void); + /* * Architecture-specific implementations of sys_reboot commands. */ @@ -70,6 +326,7 @@ extern void kernel_restart_prepare(char *cmd); extern void kernel_restart(char *cmd); extern void kernel_halt(void); extern void kernel_power_off(void); +extern bool kernel_can_power_off(void); extern int C_A_D; /* for sysctl */ void ctrl_alt_del(void); diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index a94044197c4a..aace22f7a031 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -665,7 +665,7 @@ static void power_down(void) hibernation_platform_enter(); fallthrough; case HIBERNATION_SHUTDOWN: - if (pm_power_off) + if (kernel_can_power_off()) kernel_power_off(); break; } diff --git a/kernel/reboot.c b/kernel/reboot.c index 35f0cde641c1..1ae5ba86b150 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -296,6 +296,546 @@ void kernel_halt(void) } EXPORT_SYMBOL_GPL(kernel_halt); +/* + * Notifier list for kernel code which wants to be called + * to power off the system. + */ +static BLOCKING_NOTIFIER_HEAD(power_off_handler_list); + +/* + * Temporary stub that prevents linkage failure while we're in process + * of removing all uses of legacy pm_power_off() around the kernel. + */ +void __weak (*pm_power_off)(void); + +static void dummy_pm_power_off(void) +{ + /* temporary stub until pm_power_off() is gone, see more below */ +} + +static struct notifier_block *pm_power_off_nb; + +/** + * register_power_off_handler - Register function to be called to power off + * the system + * @nb: Info about handler function to be called + * @nb->priority: Handler priority. Handlers should follow the + * following guidelines for setting priorities. + * 0: Reserved + * 1: Power-off handler of last resort, + * with limited power-off capabilities + * 128: Default power-off handler; use if no other + * power-off handler is expected to be available, + * and/or if power-off functionality is + * sufficient to power-off the entire system + * 255: Highest priority power-off handler, will + * preempt all other power-off handlers + * + * Registers a function with code to be called to power off the + * system. + * + * Registered functions will be called as last step of the power-off + * sequence. + * + * Registered functions are expected to power off the system immediately. + * If more than one function is registered, the power-off handler priority + * selects which function will be called first. + * + * Power-off handlers are expected to be registered from non-architecture + * code, typically from drivers. A typical use case would be a system + * where power-off functionality is provided through a PMIC. Multiple + * power-off handlers may exist; for example, one power-off handler might + * turn off the entire system, while another only turns off part of + * system. In such cases, the power-off handler which only disables part + * of the hardware is expected to register with low priority to ensure + * that it only runs if no other means to power off the system is + * available. + * + * Currently always returns zero, as blocking_notifier_chain_register() + * always returns zero. + */ +static int register_power_off_handler(struct notifier_block *nb) +{ + int ret; + + ret = blocking_notifier_chain_register_unique_prio(&power_off_handler_list, nb); + if (ret && ret != -EBUSY) + return ret; + + if (!ret) + goto set_pm_power_off; + + /* + * Handler must have unique priority. Otherwise call order is + * determined by registration order, which is unreliable. + * + * This requirement will become mandatory once all drivers + * will be converted to use new sys-off API. + */ + pr_err("failed to register power-off handler using unique priority\n"); + + ret = blocking_notifier_chain_register(&power_off_handler_list, nb); + if (ret) + return ret; + + /* + * Some drivers check whether pm_power_off was already installed. + * Install dummy callback using new API to preserve old behaviour + * for those drivers during period of transition to the new API. + */ +set_pm_power_off: + if (!pm_power_off) { + pm_power_off = dummy_pm_power_off; + pm_power_off_nb = nb; + } + + return 0; +} + +static int unregister_power_off_handler(struct notifier_block *nb) +{ + if (nb == pm_power_off_nb) { + if (pm_power_off == dummy_pm_power_off) + pm_power_off = NULL; + + pm_power_off_nb = NULL; + } + + return blocking_notifier_chain_unregister(&power_off_handler_list, nb); +} + +static void devm_unregister_power_off_handler(void *data) +{ + struct notifier_block *nb = data; + + unregister_power_off_handler(nb); +} + +static int devm_register_power_off_handler(struct device *dev, + struct notifier_block *nb) +{ + int err; + + err = register_power_off_handler(nb); + if (err) + return err; + + return devm_add_action_or_reset(dev, devm_unregister_power_off_handler, + nb); +} + +static int sys_off_handler_power_off(struct notifier_block *nb, + unsigned long mode, void *unused) +{ + struct power_off_prep_data prep_data = {}; + struct sys_off_handler_private_data *priv; + struct power_off_data data = {}; + struct sys_off_handler *h; + int ret = NOTIFY_DONE; + + priv = container_of(nb, struct sys_off_handler_private_data, power_off_nb); + h = container_of(priv, struct sys_off_handler, priv); + prep_data.cb_data = h->cb_data; + data.cb_data = h->cb_data; + + switch (mode) { + case POWEROFF_NORMAL: + if (h->power_off_cb) + h->power_off_cb(&data); + + if (priv->simple_power_off_cb) + priv->simple_power_off_cb(priv->simple_power_off_cb_data); + + if (priv->platform_power_off_cb) + priv->platform_power_off_cb(); + + if (!h->power_off_chaining_allowed) + ret = NOTIFY_STOP; + + break; + + case POWEROFF_PREPARE: + if (h->power_off_prepare_cb) + h->power_off_prepare_cb(&prep_data); + + break; + + default: + unreachable(); + } + + return ret; +} + +static int sys_off_handler_restart(struct notifier_block *nb, + unsigned long mode, void *cmd) +{ + struct sys_off_handler_private_data *priv; + struct restart_data data = {}; + struct sys_off_handler *h; + + priv = container_of(nb, struct sys_off_handler_private_data, restart_nb); + h = container_of(priv, struct sys_off_handler, priv); + + data.stop_chain = h->restart_chaining_disallowed; + data.cb_data = h->cb_data; + data.mode = mode; + data.cmd = cmd; + + h->restart_cb(&data); + + return data.stop_chain ? NOTIFY_STOP : NOTIFY_DONE; +} + +static int sys_off_handler_reboot(struct notifier_block *nb, + unsigned long mode, void *cmd) +{ + struct sys_off_handler_private_data *priv; + struct reboot_prep_data data = {}; + struct sys_off_handler *h; + + priv = container_of(nb, struct sys_off_handler_private_data, reboot_nb); + h = container_of(priv, struct sys_off_handler, priv); + + data.cb_data = h->cb_data; + data.stop_chain = false; + data.mode = mode; + data.cmd = cmd; + + h->reboot_prepare_cb(&data); + + return data.stop_chain ? NOTIFY_STOP : NOTIFY_DONE; +} + +static struct sys_off_handler_private_data * +sys_off_handler_private_data(struct sys_off_handler *handler) +{ + return (struct sys_off_handler_private_data *)&handler->priv; +} + +/** + * devm_register_sys_off_handler - Register system power-off/restart handler + * @dev: Device that registers handler + * @handler: System-off handler + * + * Registers handler that will be called as last step of the power-off + * and restart sequences. + * + * Returns zero on success, or error code on failure. + */ +int register_sys_off_handler(struct sys_off_handler *handler) +{ + struct sys_off_handler_private_data *priv; + int err, priority; + + priv = sys_off_handler_private_data(handler); + + /* sanity-check whether handler is registered twice */ + if (priv->registered) + return -EBUSY; + + if (handler->power_off_cb || handler->power_off_prepare_cb) { + if (handler->power_off_priority == POWEROFF_PRIO_RESERVED) + priority = POWEROFF_PRIO_DEFAULT; + else + priority = handler->power_off_priority; + + priv->power_off_nb.notifier_call = sys_off_handler_power_off; + priv->power_off_nb.priority = priority; + + err = register_power_off_handler(&priv->power_off_nb); + if (err) + goto reset_sys_off_handler; + } + + if (handler->restart_cb) { + if (handler->restart_priority == RESTART_PRIO_RESERVED) + priority = RESTART_PRIO_DEFAULT; + else + priority = handler->restart_priority; + + priv->restart_nb.notifier_call = sys_off_handler_restart; + priv->restart_nb.priority = priority; + + err = register_restart_handler(&priv->restart_nb); + if (err) + goto unreg_power_off_handler; + } + + if (handler->reboot_prepare_cb) { + priv->reboot_nb.notifier_call = sys_off_handler_reboot; + priv->reboot_nb.priority = handler->reboot_priority; + + err = register_reboot_notifier(&priv->reboot_nb); + if (err) + goto unreg_restart_handler; + } + + priv->registered = true; + + return 0; + +unreg_restart_handler: + if (handler->restart_cb) + unregister_restart_handler(&priv->restart_nb); + +unreg_power_off_handler: + if (handler->power_off_cb) + unregister_power_off_handler(&priv->power_off_nb); + +reset_sys_off_handler: + memset(priv, 0, sizeof(*priv)); + + return err; +} +EXPORT_SYMBOL(register_sys_off_handler); + +/** + * unregister_sys_off_handler - Unregister system power-off/restart handler + * @handler: System-off handler + * + * Unregisters sys-off handler. Does nothing and returns zero if handler + * is NULL. + * + * Returns zero on success, or error code on failure. + */ +int unregister_sys_off_handler(struct sys_off_handler *handler) +{ + struct sys_off_handler_private_data *priv; + + if (!handler) + return 0; + + priv = sys_off_handler_private_data(handler); + + /* sanity-check whether handler is unregistered twice */ + if (!priv->registered) + return -EINVAL; + + if (handler->reboot_prepare_cb) + unregister_reboot_notifier(&priv->reboot_nb); + + if (handler->restart_cb) + unregister_restart_handler(&priv->restart_nb); + + if (handler->power_off_cb) + unregister_power_off_handler(&priv->power_off_nb); + + memset(priv, 0, sizeof(*priv)); + + return 0; +} +EXPORT_SYMBOL(unregister_sys_off_handler); + +static void devm_unregister_sys_off_handler(void *data) +{ + struct sys_off_handler *handler = data; + + unregister_sys_off_handler(handler); +} + +/** + * devm_register_sys_off_handler - Register system power-off/restart handler + * @dev: Device that registers handler + * @handler: System-off handler + * + * Resource-managed variant of register_sys_off_handler(). + * + * Returns zero on success, or error code on failure. + */ +int devm_register_sys_off_handler(struct device *dev, + struct sys_off_handler *handler) +{ + int err; + + err = register_sys_off_handler(handler); + if (err) + return err; + + return devm_add_action_or_reset(dev, devm_unregister_sys_off_handler, + handler); +} +EXPORT_SYMBOL(devm_register_sys_off_handler); + +/** + * devm_register_prioritized_power_off_handler - Register prioritized power-off callback + * @dev: Device that registers callback + * @priority: Callback's priority + * @callback: Callback function + * @cb_data: Callback's argument + * + * Registers resource-managed power-off callback with a given priority. + * It will be called as last step of the power-off sequence. Callbacks + * chaining is disabled, i.e. further lower priority callbacks won't + * be executed if this @callback will fail to execute. + * + * Returns zero on success, or error code on failure. + */ +int devm_register_prioritized_power_off_handler(struct device *dev, + int priority, + void (*callback)(void *data), + void *cb_data) +{ + struct sys_off_handler_private_data *priv; + struct sys_off_handler *handler; + + handler = devm_kzalloc(dev, sizeof(*handler), GFP_KERNEL); + if (!handler) + return -ENOMEM; + + if (priority == POWEROFF_PRIO_RESERVED) + priority = POWEROFF_PRIO_DEFAULT; + + priv = sys_off_handler_private_data(handler); + + priv->power_off_nb.notifier_call = sys_off_handler_power_off; + priv->power_off_nb.priority = priority; + priv->simple_power_off_cb_data = cb_data; + priv->simple_power_off_cb = callback; + + return devm_register_power_off_handler(dev, &priv->power_off_nb); +} +EXPORT_SYMBOL(devm_register_prioritized_power_off_handler); + +/** + * devm_register_prioritized_restart_handler - Register prioritized restart callback + * @dev: Device that registers callback + * @priority: Callback's priority + * @callback: Callback function + * @cb_data: Callback's argument + * + * Registers resource-managed restart callback with a given priority. + * It will be called as a part of the restart sequence. Callbacks + * chaining is disabled, i.e. further lower priority callbacks won't + * be executed if this @callback will fail to execute. + * + * Returns zero on success, or error code on failure. + */ +int devm_register_prioritized_restart_handler(struct device *dev, + int priority, + void (*callback)(struct restart_data *data), + void *cb_data) +{ + struct sys_off_handler *handler; + + handler = devm_kzalloc(dev, sizeof(*handler), GFP_KERNEL); + if (!handler) + return -ENOMEM; + + if (priority == RESTART_PRIO_RESERVED) + priority = RESTART_PRIO_DEFAULT; + + handler->restart_priority = priority; + handler->restart_cb = callback; + handler->cb_data = cb_data; + + return devm_register_sys_off_handler(dev, handler); +} +EXPORT_SYMBOL(devm_register_prioritized_restart_handler); + +static struct sys_off_handler platform_power_off_handler = { + .priv = { + .power_off_nb = { + .notifier_call = sys_off_handler_power_off, + .priority = POWEROFF_PRIO_PLATFORM, + }, + }, +}; + +static DEFINE_SPINLOCK(platform_power_off_lock); + +/** + * register_platform_power_off - Register platform-level power-off callback + * @power_off: Power-off callback + * + * Registers power-off callback that will be called as last step + * of the power-off sequence. This callback is expected to be invoked + * for the last resort. Further lower priority callbacks won't be + * executed if @power_off fails. Only one platform power-off callback + * is allowed to be registered at a time. + * + * Returns zero on success, or error code on failure. + */ +int register_platform_power_off(void (*power_off)(void)) +{ + struct sys_off_handler_private_data *priv; + int ret = 0; + + priv = sys_off_handler_private_data(&platform_power_off_handler); + + spin_lock(&platform_power_off_lock); + if (priv->platform_power_off_cb) + ret = -EBUSY; + else + priv->platform_power_off_cb = power_off; + spin_unlock(&platform_power_off_lock); + + if (ret) + return ret; + + ret = register_power_off_handler(&priv->power_off_nb); + if (ret) + priv->platform_power_off_cb = NULL; + + return ret; +} +EXPORT_SYMBOL_GPL(register_platform_power_off); + +/** + * unregister_platform_power_off - Unregister platform-level power-off callback + * @power_off: Power-off callback + * + * Unregisters previously registered platform power-off callback. + * + * Returns zero on success, or error code on failure. + */ +int unregister_platform_power_off(void (*power_off)(void)) +{ + struct sys_off_handler_private_data *priv; + int ret; + + priv = sys_off_handler_private_data(&platform_power_off_handler); + + if (priv->platform_power_off_cb != power_off) + return -EINVAL; + + ret = unregister_power_off_handler(&priv->power_off_nb); + priv->platform_power_off_cb = NULL; + + return ret; +} +EXPORT_SYMBOL_GPL(unregister_platform_power_off); + +/** + * do_kernel_power_off - Execute kernel power-off handler call chain + * + * Calls functions registered with register_power_off_handler. + * + * Expected to be called as last step of the power-off sequence. + * + * Powers off the system immediately if a power-off handler function has + * been registered. Otherwise does nothing. + */ +void do_kernel_power_off(void) +{ + /* legacy pm_power_off() is unchained and has highest priority */ + if (pm_power_off && pm_power_off != dummy_pm_power_off) + return pm_power_off(); + + blocking_notifier_call_chain(&power_off_handler_list, POWEROFF_NORMAL, + NULL); +} + +static void do_kernel_power_off_prepare(void) +{ + /* legacy pm_power_off_prepare() is unchained and has highest priority */ + if (pm_power_off_prepare) + return pm_power_off_prepare(); + + blocking_notifier_call_chain(&power_off_handler_list, POWEROFF_PREPARE, + NULL); +} + /** * kernel_power_off - power_off the system * @@ -304,8 +844,7 @@ 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(); + do_kernel_power_off_prepare(); migrate_to_reboot_cpu(); syscore_shutdown(); pr_emerg("Power down\n"); @@ -314,6 +853,16 @@ void kernel_power_off(void) } EXPORT_SYMBOL_GPL(kernel_power_off); +bool kernel_can_power_off(void) +{ + if (!pm_power_off && + blocking_notifier_call_chain_is_empty(&power_off_handler_list)) + return false; + + return true; +} +EXPORT_SYMBOL_GPL(kernel_can_power_off); + DEFINE_MUTEX(system_transition_mutex); /* @@ -355,7 +904,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, /* Instead of trying to make the power_off code look like * halt when pm_power_off is not set do it the easy way. */ - if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off) + if (cmd == LINUX_REBOOT_CMD_POWER_OFF && !kernel_can_power_off()) cmd = LINUX_REBOOT_CMD_HALT; mutex_lock(&system_transition_mutex); From patchwork Sun Jan 30 23:37:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA8A1C4167E for ; Sun, 30 Jan 2022 23:37:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262559.454845 (Exim 4.92) (envelope-from ) id 1nEJlI-0004sc-NE; Sun, 30 Jan 2022 23:37:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262559.454845; Sun, 30 Jan 2022 23:37:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlI-0004sN-Hs; Sun, 30 Jan 2022 23:37:36 +0000 Received: by outflank-mailman (input) for mailman id 262559; Sun, 30 Jan 2022 23:37:35 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlH-0003lI-Cs for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:35 +0000 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [2a00:1450:4864:20::22e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 99c795f6-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:34 +0100 (CET) Received: by mail-lj1-x22e.google.com with SMTP id c15so17066184ljf.11 for ; Sun, 30 Jan 2022 15:37:34 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:34 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 99c795f6-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=330E/wQDWGl4ulxyuRNdR1rr3T8TzXfUiE06Vh/nJ/4=; b=cg3oMBxQjVviL/NNGojcXm2zIQdA1knh2bjCFHcWisBrm24Ky2GZxKJ3rws8Te7/gs gKmhuSiy3i3YAnHFoGCZNUdNK8mgFrgHD+dxBwbG4yZhgFFN7+/vK4MkGE5qXYuXmMVs bUYXaFsNJIzGbHLL09HMWCh53ba9YsZpoLFHMsubj4f9OdgATDVSFw5EXTDeZNrJ+YwD 4i3hO0RlUhqkX+D7hyG57IC2hHmNZLq5o5iowEWUxtxxuAtbxm76BsZH9fLeaXdkEFeP spgNrmHN/fUhCBM448V1raIkNHUkI0ImPa7nT8ODh8UXU57uCGiJ333W57c8FPVtKEon c6Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=330E/wQDWGl4ulxyuRNdR1rr3T8TzXfUiE06Vh/nJ/4=; b=1ly6CiIEPsGOkAW3X8Y3tYdsfcUkytNZ8ayZTyKPpD3VsvmOEqcokyHktEA8I+54Jg yK6bbnZRT1mUDw8vXFYDihEs+lvTd/fqfEzr2BZM1w91TpLrEwHmf0nor4ld4RzvYtY1 J/czaHeWwKUNodT/FGIOqeeYujSNNa+jVENfo+iQ+muvKZsKWDgxI/l4pTH8KAux2dMM Qb2SGgGrj8+PkdcjPvCZ/jJxNhtWWYxWxcNUG7VpqsRFIiBWUei0KUlQulTcAkPLSbU8 wXZ0v+21ILPCsB2OimhwqTEqNkPX0voB/USM6OrMDlht1JsubJmgyWQbZ8hwfCj8YnXU SmYw== X-Gm-Message-State: AOAM533wyJFPJBcSz2vSs+50V85cNKQ1zhefAzCE2sW2VsjleTcpJph/ fjQUUQ6OGPMaWkoAvZuu7w4= X-Google-Smtp-Source: ABdhPJz+BlMXTarUclVIq8qzXV3P6s1WQdhrNGC7YQJ1I4ADKuUOv1DDvqkqis31Xyrq/C6PgvOyzw== X-Received: by 2002:a2e:9cc4:: with SMTP id g4mr12328016ljj.264.1643585854485; Sun, 30 Jan 2022 15:37:34 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 05/21] ARM: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:02 +0300 Message-Id: <20220130233718.21544-6-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Reviewed-by: Russell King (Oracle) Signed-off-by: Dmitry Osipenko --- arch/arm/kernel/reboot.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c index 3044fcb8d073..2cb943422554 100644 --- a/arch/arm/kernel/reboot.c +++ b/arch/arm/kernel/reboot.c @@ -116,9 +116,7 @@ void machine_power_off(void) { local_irq_disable(); smp_send_stop(); - - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } /* From patchwork Sun Jan 30 23:37:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44849C4707E for ; Sun, 30 Jan 2022 23:37:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262561.454867 (Exim 4.92) (envelope-from ) id 1nEJlK-0005RF-Ua; Sun, 30 Jan 2022 23:37:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262561.454867; Sun, 30 Jan 2022 23:37:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlK-0005P3-Ki; Sun, 30 Jan 2022 23:37:38 +0000 Received: by outflank-mailman (input) for mailman id 262561; Sun, 30 Jan 2022 23:37:37 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlJ-0003l1-6m for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:37 +0000 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [2a00:1450:4864:20::12d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9ad34a60-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:37:36 +0100 (CET) Received: by mail-lf1-x12d.google.com with SMTP id p27so23342514lfa.1 for ; Sun, 30 Jan 2022 15:37:36 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:35 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9ad34a60-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1ZrDgi56okXdj0bmuwFyDd+PCBPMTNLxDRZAmCQiy7Q=; b=c3NtOsqbA47a1sJX+GEy+0rTmzy10+oHXKnLf++rqhzO+HkV5EX5GbmXX0syutXx6R 46cFfpCzhcPa31L6Xgo37w0ud+s6MmIVbyT0zR8tDah7CqXCEteg4iWk/eRCwba6mO4V 8W4zc+2KzJhcjNF1j1wVUUcXHT6ObiOakX5p2KYvUVsZQRY7Y82Y6MKvBpcRryxOInUF RxKVqw9v4fGeVOkmtCX3EyiW/0qXGxVzl0X9GRONS3eJ/CiP8qRj0ZyFLbrruPRrmWMZ iKAyqg4ppe9pVvVxKhsjy91ldTFtuqlW7PzcwXhnonKoFQRzsPVvvJpThza+ddSLXVij QBag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1ZrDgi56okXdj0bmuwFyDd+PCBPMTNLxDRZAmCQiy7Q=; b=U2Y6hWm7nFoJ/5FBFP1459i/75cjeMsgFMyntsdEp0Mckb22abs1BC6CXGmhdc5XBY TxBQXWIbNd/3X92Hia0DRJjkR3zcpI266rwfMEAz3UTd6dIGhdqPrB2pIRRbkGzzA94h 7tNRoQTGNu0v3Q0jqLuSQsEuCaFBLnow8t16eXfqYyVpCC63DXF5k3w+9fhFoBAYEMAg dqbfy+FK+uKoIDSnPt0Kw2UZFaOHlEL6Z5bcE60djfGtm+2rjNqc+gVcWtAeHaQFWtfU sWgU9kjKRqz0jMrxw48OTZ10aeXfOMIbq9B4Gr0U//Is0Ko8/lBkGYxP9VtNv7Wmh2af HLOQ== X-Gm-Message-State: AOAM531yzyXiMy+GTsx3Bcr+AhBkx1zRIgliDudREopmw0lFO8hAOorx 2gLbO3TuDPJFOT4CtAX6WbU= X-Google-Smtp-Source: ABdhPJwjH2OF/Lh8B3AhmAwBhRKlkrWOfnqlna+Zr9L+uqZhDMGJf1wpdqmmSlpmTjq1hjKH+//r2w== X-Received: by 2002:a05:6512:1082:: with SMTP id j2mr7550090lfg.371.1643585856261; Sun, 30 Jan 2022 15:37:36 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 06/21] csky: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:03 +0300 Message-Id: <20220130233718.21544-7-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Guo Ren Signed-off-by: Dmitry Osipenko --- arch/csky/kernel/power.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/csky/kernel/power.c b/arch/csky/kernel/power.c index 923ee4e381b8..86ee202906f8 100644 --- a/arch/csky/kernel/power.c +++ b/arch/csky/kernel/power.c @@ -9,16 +9,14 @@ EXPORT_SYMBOL(pm_power_off); void machine_power_off(void) { local_irq_disable(); - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); asm volatile ("bkpt"); } void machine_halt(void) { local_irq_disable(); - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); asm volatile ("bkpt"); } From patchwork Sun Jan 30 23:37:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36E2EC3527B for ; Sun, 30 Jan 2022 23:37:51 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262562.454877 (Exim 4.92) (envelope-from ) id 1nEJlN-0005qv-5M; Sun, 30 Jan 2022 23:37:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262562.454877; Sun, 30 Jan 2022 23:37:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlN-0005qk-00; Sun, 30 Jan 2022 23:37:41 +0000 Received: by outflank-mailman (input) for mailman id 262562; Sun, 30 Jan 2022 23:37:39 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlL-0003l1-1T for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:39 +0000 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [2a00:1450:4864:20::232]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9be99d79-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:37:38 +0100 (CET) Received: by mail-lj1-x232.google.com with SMTP id q22so17106566ljh.7 for ; Sun, 30 Jan 2022 15:37:38 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:37 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9be99d79-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OVg2kfJsVdscnSQmsGQYEfiSB/7tSvJBE6eAcPu7Sek=; b=c4Z1zQFdWlsKxw9UxAzj2ZQzBVH0IlXZ5Q9hlT/o2eauoc+12KgHtyZnfnu9QRCul7 XIq2yfEDvsyi714qK62uqrcXiKbZ83JQlipU755myvbplyaKCzIx8SoEbYZQx1g2QPK1 ZiW0YJxW7z6xKBh2ESJStcRTergJa9YSSKnZXGs2GFxaXBnqnCcNoIMPWorMJ7h8whhy F2xnNh9XSw25BmP4Yp0yjpYr8c279tQye0/GiTHl+WGgBlBd/yKdunLMFcBd5VjP++Bl z5q6iip6mJ3MI/RtrvT6/DwKfRUy9WgbSLddepD6tmbzL6Xf24XNQo71hEy43Zt7gMYI LH7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OVg2kfJsVdscnSQmsGQYEfiSB/7tSvJBE6eAcPu7Sek=; b=xvdZ4LgmQwcuJ953jYyy8g6ZYvIVRkTsHz37m1ApZX0xjJmW96LVcvzmI/9JrFWyGw tjPhF+A2yxsRZLQtLm2lQiI+/p/G0NAsPpPkh/FaFLD/4+67AKLfqINbmUTWyz+JZj2Y X5FYunJxHn+oWzp0UuTYOhw4Pbu8VzDyOsfi1H+F31wgqV0xf8Kcx7HyaDUtpTWqjhRG XDd03qS7k+/eADIkQFIiPedZIo4BGdXWcXLZEeCbDF2w1CZMFjk7Xp4VKNcVC/sVy0iO NqO045eY5C6odGFBNBrh/1E+jZbT3az0s5k9/4n+BvRp3x1+INBxX62HBsDWHLX8u1Ak LPYQ== X-Gm-Message-State: AOAM531kQZQ7TtLXSmZ2QjslMz88l2I33gX2hCRy0R8TdzrB7OOZIy/A IIYsllqOPXQTJnUrJYR43zo= X-Google-Smtp-Source: ABdhPJw0o4UVP5/vUUv/1Chd11yJ2CJCMOQv44y6t1B7x180Ayz+XFBoJsJgXLguCKSrO7B2enZNZA== X-Received: by 2002:a2e:90c7:: with SMTP id o7mr12381352ljg.340.1643585858043; Sun, 30 Jan 2022 15:37:38 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 07/21] riscv: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:04 +0300 Message-Id: <20220130233718.21544-8-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Palmer Dabbelt Signed-off-by: Dmitry Osipenko --- arch/riscv/kernel/reset.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/riscv/kernel/reset.c b/arch/riscv/kernel/reset.c index 9c842c41684a..912288572226 100644 --- a/arch/riscv/kernel/reset.c +++ b/arch/riscv/kernel/reset.c @@ -23,16 +23,12 @@ void machine_restart(char *cmd) void machine_halt(void) { - if (pm_power_off != NULL) - pm_power_off(); - else - default_power_off(); + do_kernel_power_off(); + default_power_off(); } void machine_power_off(void) { - if (pm_power_off != NULL) - pm_power_off(); - else - default_power_off(); + do_kernel_power_off(); + default_power_off(); } From patchwork Sun Jan 30 23:37:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C88EEC3526F for ; Sun, 30 Jan 2022 23:37:52 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262563.454888 (Exim 4.92) (envelope-from ) id 1nEJlP-0006FL-Jq; Sun, 30 Jan 2022 23:37:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262563.454888; Sun, 30 Jan 2022 23:37:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlP-0006F3-Ez; Sun, 30 Jan 2022 23:37:43 +0000 Received: by outflank-mailman (input) for mailman id 262563; Sun, 30 Jan 2022 23:37:41 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlN-0003lI-Bn for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:41 +0000 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [2a00:1450:4864:20::12b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9cfdc69c-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:40 +0100 (CET) Received: by mail-lf1-x12b.google.com with SMTP id z4so23316240lft.3 for ; Sun, 30 Jan 2022 15:37:40 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:39 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9cfdc69c-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y24DENQRtEKdQppbGIKyd5oN0ftjyxygovRkGgk1ggI=; b=iye0IDf8S26dwLx295PYKApjfR1uhOWkwFRwEuTaz7HfVp5gNRTd7PsGZcdNXus2j5 KC4hfRnns4Q3gDw6FYYl2hiGD9zyQ++BtQsUN5sSEIWlqdWsG1HgjgoDbwION7zck9/B S8MhYR0qnGU76YGP6zQCb71/H90UqaQBgBJGYf9Z6F3zA18hOB/JJMmd+MfBgMIf44bI sMILvpsYiXOPyNn3wn8H/3IuNgSMTY5MBK2vT4Gl2WvXF7Wqy+10WxR4R+u39c/0cwYM yj8NA83EDXhIuKdSCp9nssU1hiFyiw4wPTkhvi9jW5WvzZ+itFPqw8PQ5rG3RKpTYBTp Kbhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y24DENQRtEKdQppbGIKyd5oN0ftjyxygovRkGgk1ggI=; b=FRyHIBGX28MvUHi9LU8lGh6UeBaPp8pa6R3CrAkBnUttPvTL8/dwrS67RVIEY9x+Eo /Dpeg8BZAAYVy7/Eq2UFc6DIbZ/xivGJRAdLz1UGm5T9ZG19e6QwxWqTtY1aP0wXJIoe +W8yLePRf99zS4pwBGbWmDei6CWBpVgiOpV3udp+a3saXkugtfW6qI+5Srr1q4EQdKHQ CBUdqon8V0VG+SLHvAPsGrtwUX20/t5movK59NDTbuhLExoR6MpxDe5KM2c9LnbabU1e IimK8jfOyRi1TW43yHeygaA+o9pIidkXKturxgGwRv9aoxJSShJp7m6vY6z+Rq3eti3M KIjw== X-Gm-Message-State: AOAM531UR9URCMqDhjrcrMpS8uK82zB776pwSfmPxJ/Yb2COq68eFO4U xkoDjaKUWHhin+wwYIVXHNU= X-Google-Smtp-Source: ABdhPJwUMukTmRLWxE4WTMsRGXBxMbLNoOfsYOAYvD7oQJog5SiqqQ5VNyGL25QpTozq+s6lOQk2Yw== X-Received: by 2002:ac2:5186:: with SMTP id u6mr14721765lfi.519.1643585859891; Sun, 30 Jan 2022 15:37:39 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 08/21] arm64: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:05 +0300 Message-Id: <20220130233718.21544-9-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Catalin Marinas Signed-off-by: Dmitry Osipenko --- arch/arm64/kernel/process.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 5369e649fa79..6816a23bacc2 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -111,8 +111,7 @@ void machine_power_off(void) { local_irq_disable(); smp_send_stop(); - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } /* From patchwork Sun Jan 30 23:37:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DCAE4C35296 for ; Sun, 30 Jan 2022 23:37:53 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262564.454895 (Exim 4.92) (envelope-from ) id 1nEJlQ-0006Kk-E5; Sun, 30 Jan 2022 23:37:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262564.454895; Sun, 30 Jan 2022 23:37:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlP-0006Jy-Vm; Sun, 30 Jan 2022 23:37:43 +0000 Received: by outflank-mailman (input) for mailman id 262564; Sun, 30 Jan 2022 23:37:42 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlO-0003l1-O6 for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:42 +0000 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [2a00:1450:4864:20::22c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9e1a642d-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:37:42 +0100 (CET) Received: by mail-lj1-x22c.google.com with SMTP id q127so17130788ljq.2 for ; Sun, 30 Jan 2022 15:37:42 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:41 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9e1a642d-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AgUqH21X35PnBCT61HDKwIodN/aq26TmgR9kDSi8+dE=; b=fEIAF9bcuqAzIb/0tvvq3O8BS3Czq/h/Pef82qF5eHHyasojPcfrbzHIoydtxto2wQ wX3GRnvjdbDLsYzgPU//nRHxWx9+vDmqu8vdYaGgwj5L8VR9yxpsog+gt5eJPplHLl4e kqhHMmdlDa++8c9buauTRSwKJ6jfUHn5/JsOh2KUKr7++Tl8q3EC24jzcc+1IqofA7cx yXwlnX+5/2eKeRHjSIgSHEbnUPlgmP3R0LM3AyLuosb/cm9cEGXdYAYHlBtd7sLoPY5e i0MqdVJGdefaKvtADgtcIGnn2Rb9Fp4xI/VcrEBkKlMINocLP6Acwod5XzODcGIEG+vI gglQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AgUqH21X35PnBCT61HDKwIodN/aq26TmgR9kDSi8+dE=; b=w2d1UPjuzP5wFB9uFM+29MGyjev0uCloUf+xJDYArEn3WL8YBT6IYzDjyD2VHHPqdB KKdof7ZRXXLxYrTTXE98KDX7XxF5RtXbEOT8Hqj5aIWUt+R4SwnvgAUKwbnLgFzobMn+ U5BwceR1syfGK2yX7K6dmYokLAnGWhwG3fax81GP7yGmzvCywIQ/PhgSQEX7ruQeWNFm Db3eQbmOJM5MOH57jrwhRVIgHje0MWXyWZbrfJY+zRH6o08j74Kb2oXkFcoEfL1AbHJl y92PTc44EMC1ZuhbnHl1ZPtP42z5wIvmffUwYPylBuCYLrq0lrhUEUttv45JDH4XLjux VUQQ== X-Gm-Message-State: AOAM5305MXnIVDgA9chXdHqD5I874kdjm8aamYyiJopJyobcfBegDCWS AwJfM+zJRSw3fAz1FfHHCuo= X-Google-Smtp-Source: ABdhPJwQcQFogpM/qB5H07sE2bxg4HVgxxJELrz/nZ4JWWpyA2e1jZd2qT8OYjJChyxa9ZABZerkCg== X-Received: by 2002:a2e:8699:: with SMTP id l25mr12382831lji.91.1643585861720; Sun, 30 Jan 2022 15:37:41 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 09/21] parisc: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:06 +0300 Message-Id: <20220130233718.21544-10-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Helge Deller # parisc Signed-off-by: Dmitry Osipenko --- arch/parisc/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index ea3d83b6fb62..928201b1f58f 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -114,8 +115,7 @@ void machine_power_off(void) pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN); /* ipmi_poweroff may have been installed. */ - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); /* It seems we have no way to power the system off via * software. The user has to press the button himself. */ From patchwork Sun Jan 30 23:37:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 555D8C3526C for ; Sun, 30 Jan 2022 23:37:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262565.454908 (Exim 4.92) (envelope-from ) id 1nEJlS-0006q5-C7; Sun, 30 Jan 2022 23:37:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262565.454908; Sun, 30 Jan 2022 23:37:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlR-0006nQ-UP; Sun, 30 Jan 2022 23:37:45 +0000 Received: by outflank-mailman (input) for mailman id 262565; Sun, 30 Jan 2022 23:37:44 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlQ-0003lI-GW for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:44 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9f2bb32f-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:43 +0100 (CET) Received: by mail-lf1-x12a.google.com with SMTP id u6so23257081lfm.10 for ; Sun, 30 Jan 2022 15:37:43 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:43 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9f2bb32f-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=66lCIOUKcPJ2J+m4Cr3ZW94G0lABJXZaED/s9f5QGmA=; b=IaLlORDZoeaYRpO44854hgYk2/vgTJOclvwIF3Vv/dy/WRswOVfYMTb/lgYFF6u20R kgD4kuaMUZhPrzrsrp+1aHUtVBmfCdIQHjkOsK+D3JxP5SLPXm0dCS3YEeqxtX5eYSIx 8EdSobISpvnT22JqnHeoUtNW+EX+/cnH1SeCCQB6STOy1ozdbhelGYqvV1xMpt5YBA99 B/96htM+mne2xjdlCrcPFCtKPM7GzoR7BZlH1OzPT5hR1hE9cLpw2j5lrnPZ7ZPlmwwI nMOCD5Tt0vJ4ks8CXxb7pk/YLn1ILllHgnHrKEVAgGpxNOjR5JCV7EBSVseqXYt1IKk7 FSXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=66lCIOUKcPJ2J+m4Cr3ZW94G0lABJXZaED/s9f5QGmA=; b=1+VpyRluGL3TRkD/agACj8b4J0OuX7Zt3UoKVRQ1PiGS8ekUH9wJTpH2M8EOf55WN0 GyyqrHs31DsmVfJ89nt9ursY1H4SMcVgG4IWTQmT9GobgjIujkcH09+jioC+YwtbJP5o KHKWO5vNHTpnbVz39gt4bwi9vsU2laZUMxpbOOka9lRPlloqb0rWiCp57cv/cq4RLChi LLO+XvkFR7adziMR/gQlQEIZiBDQrrMCvohfIzrExssf91r2VvCIZYdq+IRi/MLnhRi2 WXGpVWlreqZ5dC2oGZP9DP50XWCkd+Ds4EoNpA0hBn5E0Pr1vZbw+OtAy2RE25BfkuPN 1chQ== X-Gm-Message-State: AOAM533hEUhOmjQpSCUibBSNeWbVVv6fwA4z/nqRos0u2xso3czlaEII xjqVymPe2RcVz9mt7ZdHSX8= X-Google-Smtp-Source: ABdhPJw0xUt9j/jtl0uaDt91Bsr3KfV7lR3RRZqMVEqi4OIibegSJcLOPzN3p/u9YZbK6f72FdmH0g== X-Received: by 2002:a05:6512:3091:: with SMTP id z17mr13662510lfd.216.1643585863533; Sun, 30 Jan 2022 15:37:43 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 10/21] xen/x86: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:07 +0300 Message-Id: <20220130233718.21544-11-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Juergen Gross Signed-off-by: Dmitry Osipenko --- arch/x86/xen/enlighten_pv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 5004feb16783..527fa545eb1f 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -1068,8 +1069,7 @@ static void xen_machine_halt(void) static void xen_machine_power_off(void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); xen_reboot(SHUTDOWN_poweroff); } From patchwork Sun Jan 30 23:37:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BEB8AC433EF for ; Sun, 30 Jan 2022 23:37:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262566.454917 (Exim 4.92) (envelope-from ) id 1nEJlU-0007Ix-NU; Sun, 30 Jan 2022 23:37:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262566.454917; Sun, 30 Jan 2022 23:37:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlU-0007Hj-4V; Sun, 30 Jan 2022 23:37:48 +0000 Received: by outflank-mailman (input) for mailman id 262566; Sun, 30 Jan 2022 23:37:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlS-0003lI-8Q for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:46 +0000 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [2a00:1450:4864:20::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a0408308-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:45 +0100 (CET) Received: by mail-lf1-x133.google.com with SMTP id a28so23276021lfl.7 for ; Sun, 30 Jan 2022 15:37:45 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:44 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a0408308-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EOoRrU+XNCvH4y2De/y0/3nvouQcv+AIk9CqttDCqGU=; b=Xenhc8uEX5pndBJlaDWs7DZMq++uCKYCaPhTRn+v8Pl6kdDQBiq3K+xk68g+lJ4bfb xZ0s68SQJzgN7roWd+Sm2QhFGePj8q4/xhI0aeufWhORrHMmrI9Me+kOtUbih63bZtb6 0ONUKG+oe3tUPDlqh+XwtnfSXapDSUNhobEfHkXXD2jWYeC/eLrTsR82DtHf6HHPZ3Ti T856rZoGRovN/ZZzwL74avJYGt+XINSCwpiKRk5t0Q88fCFTaGgu6LEev5sylA8ww9qW bEbiz2YJdBL1j7FCE0FI146AM6wMNEQmt3CI8lSlsxZpxhGAK8uAOhBigDyDJ64IQ5ph fLRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EOoRrU+XNCvH4y2De/y0/3nvouQcv+AIk9CqttDCqGU=; b=uJ20D408iTyWB9b7587pu6litePrpoC4Ie6j+I+V9lay4O+0JaX/vzHNCZVychCDVN DQrPT+lNamoDuYszgQ9BLMefXQtqYF2nvDGF4pnin3+zxtwucZGM8VUyNJSPEeD3fOSF hI6jTWNw23znh9ETUxGlZQUd7sF1GAZXDuGmNKRp09aO8vBgcJ2zGI3GEaEoKXxZ2vzH x/SqQfPY41ybAmQ7HqkQhGPHf0LYqihnHPPixh/pUyOH5C9F/1fRfcKvm8z6KJp7olht co1B6XFMZZ9Bt3W4G6ML1QDuV9bQNNA9D4eNkxeiN2ouOHisnhJLrsvoh74vo/Exqgby 2eCQ== X-Gm-Message-State: AOAM532Ft7EjldE7XjweegkO2RtAm8dJOaOznRt3Kxjb7VMMR2ZCZCSD 4AciUDOqxWsaWkqN5yoTt7o= X-Google-Smtp-Source: ABdhPJwHvsxF1vvJkDiGpTgqSXjFtQ+p50F4FDOHob5db5lzmW0uNoHuWaSIs7Seja+8JuHVDBb7qw== X-Received: by 2002:ac2:5333:: with SMTP id f19mr13304920lfh.451.1643585865359; Sun, 30 Jan 2022 15:37:45 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 11/21] powerpc: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:08 +0300 Message-Id: <20220130233718.21544-12-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Michael Ellerman Signed-off-by: Dmitry Osipenko --- arch/powerpc/kernel/setup-common.c | 4 +--- arch/powerpc/xmon/xmon.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index f8da937df918..8158e940db81 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -161,9 +161,7 @@ void machine_restart(char *cmd) void machine_power_off(void) { machine_shutdown(); - if (pm_power_off) - pm_power_off(); - + do_kernel_power_off(); smp_send_stop(); machine_hang(); } diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index fd72753e8ad5..c916bf250796 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -1243,8 +1243,7 @@ static void bootcmds(void) } else if (cmd == 'h') { ppc_md.halt(); } else if (cmd == 'p') { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } } From patchwork Sun Jan 30 23:37:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730250 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D7A0C35276 for ; Sun, 30 Jan 2022 23:38:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262570.454925 (Exim 4.92) (envelope-from ) id 1nEJlW-0007k3-GC; Sun, 30 Jan 2022 23:37:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262570.454925; Sun, 30 Jan 2022 23:37:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlW-0007gw-2R; Sun, 30 Jan 2022 23:37:50 +0000 Received: by outflank-mailman (input) for mailman id 262570; Sun, 30 Jan 2022 23:37:48 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlU-0003lI-5r for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:48 +0000 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [2a00:1450:4864:20::12d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a153b964-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:47 +0100 (CET) Received: by mail-lf1-x12d.google.com with SMTP id x23so23419905lfc.0 for ; Sun, 30 Jan 2022 15:37:47 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:46 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a153b964-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tAbveYQ6Sj9Bc7jSTaK6mqXkvmIczcqPXf0PDpGOqZw=; b=QHplLZpG4Vn/qnA5SF9xQFG9TC0Ze8i4Spzrt9m1VH9xTuo4sL+GdKpNLnJA7KOr8X Qfc/trGP80uyWOnL6/AW3/9PNKh6sZ4v+/AJr0yDEUAv6gwF+kbxhdx4PyYuQlWkYmBT 5dcnK+FjbXKDiIkDUIeSgduqdLBtuC8rMXlJOwSh6i5VHZUwrW/dUGAwRrpUn/Af/fxj WsMvnRXnP4aQQ0nueTuih5zFAem9IsmzVuE9wBKY5qbRUAnxw1SUKdH9hUrXyM5G4iNf Wv3uZZ05umzkgZLlfNoLjxiV+CUOHCuLo8ttBfu5AssPJfG1v91CF2F7LItDTfLU1kFo 8YCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tAbveYQ6Sj9Bc7jSTaK6mqXkvmIczcqPXf0PDpGOqZw=; b=onQC5HUCSwqM0NG0jHGRX8G5mFrxFJMJu/OWho6oo1J4iw6gHHctXonbIAR2Rm/CKv m9qVl0dKwyCbISGkbUs0Wuq8ijRU6/gBgrBe+5HQQRpj5K3hPGPH/EpjQiAix3LSd2tQ +bEgeHJy7DeklblaY430Qwsf5XJn86Q4K6nEiDlyIElezqNC9xDhIqmBrs6QakXnF45U 39S8NKPLc2hh09j1TJohUJVR7xuKUeSH6SpPOTtyfJ5OKt9iyuLA0CVzXFQ0ndVfWWzE TgOF/uEWSGo15j81V1yP1Ff6UPi4aqwDAmLPhFKiLVpJVzWoZRySTtG5pL0dLggusWL7 Q2ug== X-Gm-Message-State: AOAM5315ATwn+a57VuPOba7NCIe43E9903BI+QEA9WcOdzDXqgo13PE8 svIP0EAnzivy6qC1+nSSJOw= X-Google-Smtp-Source: ABdhPJwh6ac6/+YvlvcJArSyTbTVyJtyah+mG/ZsA52vJGw4uJf6+kKdZUm5PeIMLD7zMqHGNap5TQ== X-Received: by 2002:a05:6512:2396:: with SMTP id c22mr12993704lfv.547.1643585867143; Sun, 30 Jan 2022 15:37:47 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 12/21] m68k: Switch to new sys-off handler API Date: Mon, 31 Jan 2022 02:37:09 +0300 Message-Id: <20220130233718.21544-13-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use register_power_off_handler() that registers power-off handlers and do_kernel_power_off() that invokes chained power-off handlers. Legacy pm_power_off() will be removed once all drivers will be converted to the new power-off API. Normally arch code should adopt only the do_kernel_power_off() at first, but m68k is a special case because it uses pm_power_off() "inside out", i.e. pm_power_off() invokes machine_power_off() [in fact it does nothing], while it's machine_power_off() that should invoke the pm_power_off(), and thus, we can't convert platforms to the new API separately. There are only two platforms changed here, so it's not a big deal. Acked-by: Geert Uytterhoeven Signed-off-by: Dmitry Osipenko --- arch/m68k/emu/natfeat.c | 3 ++- arch/m68k/include/asm/machdep.h | 1 - arch/m68k/kernel/process.c | 5 ++--- arch/m68k/kernel/setup_mm.c | 1 - arch/m68k/kernel/setup_no.c | 1 - arch/m68k/mac/config.c | 4 +++- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c index 71b78ecee75c..b19dc00026d9 100644 --- a/arch/m68k/emu/natfeat.c +++ b/arch/m68k/emu/natfeat.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -90,5 +91,5 @@ void __init nf_init(void) pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16, version & 0xffff); - mach_power_off = nf_poweroff; + register_platform_power_off(nf_poweroff); } diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h index 8fd80ef1b77e..8d8c3ee2069f 100644 --- a/arch/m68k/include/asm/machdep.h +++ b/arch/m68k/include/asm/machdep.h @@ -24,7 +24,6 @@ extern int (*mach_get_rtc_pll)(struct rtc_pll_info *); extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); extern void (*mach_reset)( void ); extern void (*mach_halt)( void ); -extern void (*mach_power_off)( void ); extern unsigned long (*mach_hd_init) (unsigned long, unsigned long); extern void (*mach_hd_setup)(char *, int *); extern void (*mach_heartbeat) (int); diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index a6030dbaa089..e160a7c57bd3 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -67,12 +67,11 @@ void machine_halt(void) void machine_power_off(void) { - if (mach_power_off) - mach_power_off(); + do_kernel_power_off(); for (;;); } -void (*pm_power_off)(void) = machine_power_off; +void (*pm_power_off)(void); EXPORT_SYMBOL(pm_power_off); void show_regs(struct pt_regs * regs) diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 8f94feed969c..47d55541612f 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -98,7 +98,6 @@ EXPORT_SYMBOL(mach_get_rtc_pll); EXPORT_SYMBOL(mach_set_rtc_pll); void (*mach_reset)( void ); void (*mach_halt)( void ); -void (*mach_power_off)( void ); #ifdef CONFIG_HEARTBEAT void (*mach_heartbeat) (int); EXPORT_SYMBOL(mach_heartbeat); diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index 5e4104f07a44..00bf82258233 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c @@ -55,7 +55,6 @@ int (*mach_hwclk) (int, struct rtc_time*); /* machine dependent reboot functions */ void (*mach_reset)(void); void (*mach_halt)(void); -void (*mach_power_off)(void); #ifdef CONFIG_M68000 #if defined(CONFIG_M68328) diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 65d124ec80bb..382f656c29ea 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -140,7 +141,6 @@ void __init config_mac(void) mach_hwclk = mac_hwclk; mach_reset = mac_reset; mach_halt = mac_poweroff; - mach_power_off = mac_poweroff; #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP) mach_beep = mac_mksound; #endif @@ -160,6 +160,8 @@ void __init config_mac(void) if (macintosh_config->ident == MAC_MODEL_IICI) mach_l2_flush = via_l2_flush; + + register_platform_power_off(mac_poweroff); } From patchwork Sun Jan 30 23:37:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D5919C35273 for ; Sun, 30 Jan 2022 23:38:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262571.454939 (Exim 4.92) (envelope-from ) id 1nEJlZ-000063-SX; Sun, 30 Jan 2022 23:37:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262571.454939; Sun, 30 Jan 2022 23:37:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlZ-0008UH-30; Sun, 30 Jan 2022 23:37:53 +0000 Received: by outflank-mailman (input) for mailman id 262571; Sun, 30 Jan 2022 23:37:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlV-0003l1-UB for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:50 +0000 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [2a00:1450:4864:20::132]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a26588e3-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:37:49 +0100 (CET) Received: by mail-lf1-x132.google.com with SMTP id z4so23316721lft.3 for ; Sun, 30 Jan 2022 15:37:49 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:48 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a26588e3-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lR6BHFjgwiTI/QHx3OYkgrWFcCc5NqsF2rCbYvrczTw=; b=OduVSYhLRySW+3FGo+lYc9j4W9HkKmk+97wWY4/PKlxzrnNEGe7IOz6y/PV9uhmuYH VbBEW+nYBK2ziWW+TStoU9eZ6gL1PkjuI1ofbTH8+TOQptRYgjmefIFtU0D9AU9yECTE wqIQ28X1CWgvtGBdcQInk87pjgtwqDDaYuXcwwDPa/0zDV3/S4ib2HIps9cfr/6meMoa dpisZE6WgAIokqI2Ya3EMFRoo30TdvDDOXKmVm0bWzDf4eWjjHx8blQrZkXRZ4mmvZbY iP42tSCk0c1besP2SMC/I2M1UFGm2YmtIyiDwWlnaIJMOhQK/UVloZGfKEkbhIA5KUcX lOLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lR6BHFjgwiTI/QHx3OYkgrWFcCc5NqsF2rCbYvrczTw=; b=yG1z8kdqPBmfq6i0fFP3ZDyg4oY5Z/TwEbW1bW3gfY7NYNDBKa5l2T3P1ZflR+F93Z 5PagfZCL2p2wQtPBJRI++QB6BOcIyU2d2k8I6Yz2M/RRU5U5zy7ag+7yliaTyYz8hHas UHCnFVKQNIIQKeGpehlNCmEHVydnds26JXec/BpCc5sXU+WAOs9OLYOFRaoHf6pz76Ax jFt4jBjiST650cMOKDG0bJIxYeYVl4G3I2HFSMQmlOJhOdofvK2CBVtlavdXmwAeRwjB 162wK1a0IzGjdRN/dwFP8XqNR2jbRB2FUV/YflUCFSIiJst+3WpAdajDtD6JuNpRys3v UGyQ== X-Gm-Message-State: AOAM5308ICYicrufOfZAZMhVMLU+Pwmlir+x1mDRjheR/iN/c2SsOVg1 mT5xwVs/WlISg6qASSVn5T4= X-Google-Smtp-Source: ABdhPJwExHziyQ0kLCJityRURMH34UMkV5DKgCH9gkjn+41CqzmGp3rGiEZyC8GTneOx2JMjWbTdbQ== X-Received: by 2002:a05:6512:3e11:: with SMTP id i17mr13690035lfv.305.1643585868954; Sun, 30 Jan 2022 15:37:48 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 13/21] sh: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:10 +0300 Message-Id: <20220130233718.21544-14-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/sh/kernel/reboot.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c index 5c33f036418b..e8eeedc9b182 100644 --- a/arch/sh/kernel/reboot.c +++ b/arch/sh/kernel/reboot.c @@ -46,8 +46,7 @@ static void native_machine_shutdown(void) static void native_machine_power_off(void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } static void native_machine_halt(void) From patchwork Sun Jan 30 23:37:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62E74C43219 for ; Sun, 30 Jan 2022 23:38:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262574.454947 (Exim 4.92) (envelope-from ) id 1nEJlb-0000SN-C8; Sun, 30 Jan 2022 23:37:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262574.454947; Sun, 30 Jan 2022 23:37:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJla-0000HL-GS; Sun, 30 Jan 2022 23:37:54 +0000 Received: by outflank-mailman (input) for mailman id 262574; Sun, 30 Jan 2022 23:37:51 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlX-0003lI-Ja for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:51 +0000 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [2a00:1450:4864:20::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a370fe18-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:51 +0100 (CET) Received: by mail-lf1-x133.google.com with SMTP id u14so23250964lfo.11 for ; Sun, 30 Jan 2022 15:37:50 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:50 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a370fe18-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qHFCRJN9BVY8RauX1oKR/zvQzYk8hOXc8BKode7q7dE=; b=YRe+4ENn+xLHydu0qjVK8NSLNEa98MBt5tDc08FixS3wAMtLqAIaFtklni0+X5AStQ NWa/KRzoUn8+IVpsHAm/xOs3k+cj+LL2OhKl5gVUEFkp5ndqFg9Q7IDP7ikRXZxwNK+4 SbLkN6wlP8yDXzq0kfXqbvVsy1Hp18D+sINvf4RsWjU2CJLvpbxk+Pf4y4Di+ROI2ccO YZHUhr0Z8uHoIysiX6fudWOQ4mPt5OAElluDMzBTS4VC1jyp+W5tjIzGJQ2uBLL5DStr tO2S0szt+wkyquwgkXuRB6clwJUeXCGMkJhIWs2QZ///pnQ6oMEGbscGlCpylcxuYJ5J 9wBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qHFCRJN9BVY8RauX1oKR/zvQzYk8hOXc8BKode7q7dE=; b=g9xDNGoCRas5IKAHaH7I8vkAhppsGFa1KK0u68qJOkCg3O/7hwIL99vXSjPI4bXdXI oI9Fv0U+ateJlIsrG9yhIFsrjvtvc8CHUM+oUvvkbiS579sfWFmMVR2QIXtCJ6uYRdBh QSpt9ncCCIvBwqFoeLuzCAuAJsG4uBKPNjBNZr23j6vIcT3kjt5IicrcKCf+5M6jBq26 0U7VlHuowxAHZFJdXcmILHMTD9A0p81Eb1bIunuo/jKvLwahe5bsG1brtDC9q66ghlPX eEvnhlGXYapq14oeNi3+J9tClIyG7aHnRHy44NjE1WRnu/Sh31Q5w7gArBMoMi9GXWt9 NTUA== X-Gm-Message-State: AOAM533KOugW4qVjLJI+IN1x+Iazgeu83k/XEANqW7L7jlhZppEgFi/4 RrqoJJWOPLRIN3ZHIEvzXfY= X-Google-Smtp-Source: ABdhPJykkAmU8QPmCYCQWolQuhTlQmgl/dllVJKfSuOOVtywU8GyeEW3uMb4RjUXLkfRs/7Y/PbgFw== X-Received: by 2002:a19:6a12:: with SMTP id u18mr13556400lfu.348.1643585870718; Sun, 30 Jan 2022 15:37:50 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 14/21] x86: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:11 +0300 Message-Id: <20220130233718.21544-15-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/x86/kernel/reboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index fa700b46588e..c3636ea4aa71 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -739,10 +739,10 @@ static void native_machine_halt(void) static void native_machine_power_off(void) { - if (pm_power_off) { + if (kernel_can_power_off()) { if (!reboot_force) machine_shutdown(); - pm_power_off(); + do_kernel_power_off(); } /* A fallback in case there is no PM info available */ tboot_shutdown(TB_SHUTDOWN_HALT); From patchwork Sun Jan 30 23:37:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF051C35296 for ; Sun, 30 Jan 2022 23:38:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262578.454953 (Exim 4.92) (envelope-from ) id 1nEJld-0000sp-0b; Sun, 30 Jan 2022 23:37:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262578.454953; Sun, 30 Jan 2022 23:37:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlc-0000n1-Fo; Sun, 30 Jan 2022 23:37:56 +0000 Received: by outflank-mailman (input) for mailman id 262578; Sun, 30 Jan 2022 23:37:54 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlZ-0003lI-Jv for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:53 +0000 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [2a00:1450:4864:20::135]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a4a52ba0-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:53 +0100 (CET) Received: by mail-lf1-x135.google.com with SMTP id p27so23343385lfa.1 for ; Sun, 30 Jan 2022 15:37:53 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:52 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a4a52ba0-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=onbjYH+GRuJ1H+aKPIQ3zfVzcOAEVYGJovL5WFpgYzE=; b=UH1XcKU9Gn1SSFj/c6UF13MQ0Jk4L0iTHT84SKL6CKoxP6s+KdtFoXyH/BcfyYDpHy loZc76siXQCxc0BEyl6FoScWMfzkuy0+stkGcZcwGW2GEdy+KMmBYv7TWditUzAcwMzy Tt6+cvIqwyyrufTRsRpGGLkldJ9LCj0ohCU13mN/KWIDXPq7wGpxAM7zRuw3yc8XG/sX kB5V6sSPdbwBeQeNfwWdQOiHlVD0cbXl/3KN+Taw7rwJQ9btmTdGH9V7WkpieowAbyRI LCnnw5FiTCZdg9w/dnOXicsOkOVxD4dBkbYZp5w48IHi/dsTV0RcMVW6iF0qd1ahO1Hj Vr0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=onbjYH+GRuJ1H+aKPIQ3zfVzcOAEVYGJovL5WFpgYzE=; b=5W1v7ZZm4R2mvA78rMCzxqhSJ06L7Wlh98JZ4oLjhtjisI5V85pmGA/UVVooG0AYT2 T24VOEbOeICWZr19LbcHbXE2cn2GZFIdNXgkVhwOxmgQotRt3ymEghk1PFeZiURFteX1 83WJxoLrmnNfauO12Ks4523+8eIbZx160EkJ73xhStFTWwjdQGQ3hx83g0QH81DWCotJ UKyKTL2n9nwYgbwZjpX1F3cJrAXc0tVP5xoAfp3MuFz5uVLDi6Ghsy3xydtF0AUyYciz Q6ZvebcZBmh/p21a70O+1GZXIWRiFKEkWErOQRscKzmOITr/FwOxT6vlRFcDfvDZHkXy pR7g== X-Gm-Message-State: AOAM532I/YdTUXDq5p4I8zElkyE58B/OKlZ79hVljx8p/75FyH2OHiAc J08vbrXmG9UksVYmWYXxcSg= X-Google-Smtp-Source: ABdhPJzNx9wknKIs7vHNlQS9Ch9++IYsC8MJz1WUWotZ0fgIzeDZMu0xSzBho+J/7CYm9WmVvjoXbA== X-Received: by 2002:a05:6512:31cd:: with SMTP id j13mr13576351lfe.369.1643585872718; Sun, 30 Jan 2022 15:37:52 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 15/21] ia64: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:12 +0300 Message-Id: <20220130233718.21544-16-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/ia64/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 834df24a88f1..cee4d7db2143 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -599,8 +600,7 @@ machine_halt (void) void machine_power_off (void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); machine_halt(); } From patchwork Sun Jan 30 23:37:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24B09C433EF for ; Sun, 30 Jan 2022 23:47:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262650.454999 (Exim 4.92) (envelope-from ) id 1nEJvB-00070u-NZ; Sun, 30 Jan 2022 23:47:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262650.454999; Sun, 30 Jan 2022 23:47:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJvB-00070n-Jl; Sun, 30 Jan 2022 23:47:49 +0000 Received: by outflank-mailman (input) for mailman id 262650; Sun, 30 Jan 2022 23:47:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlb-0003l1-Dh for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:55 +0000 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [2a00:1450:4864:20::12d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a5b16696-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:37:54 +0100 (CET) Received: by mail-lf1-x12d.google.com with SMTP id x23so23420327lfc.0 for ; Sun, 30 Jan 2022 15:37:54 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:54 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a5b16696-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wIfZ+CakpfzF/ji3grllPcoAe/10yjc1ewRUofBsGOM=; b=A13Wbd19LUDerIcNp/bwkNjnM7R44S+FNahenjlu62KKeZzOwn22X46AmnbpRRHSD6 ++VeiYi+w5973OIjqsKBoqpWZd1tNrsstlD+OK5Nb2BIn3qQuUxHMsdUL9LOLlnC2oh9 3QYxZJ6Rvcj4kbBtFo+GSvpPb2P4Us99EVxpEAj6NeCn9wQxCxqcvyPU6/Tn7QITtakm /V8zmLAMP0Zz48vMEXqiIlcDRfQmJ+d8Go+JSVClm5dRCb8xO1gx+MaZWCx1Y3YgBNEK BDZgHhW3BSNpzM/0TkvVs4HG5kI01iX7LNugVEJmEF9vWL8OTabOwQyDCncuLuPplJj0 eXww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wIfZ+CakpfzF/ji3grllPcoAe/10yjc1ewRUofBsGOM=; b=FFtYVxzd22ueZB5PcoS0wEcgenjva/Q9fbfO9nbmGExGXX1BC47oLXoyl2Qb01XEX3 ApuXjSSbaaR/65leZQ4LoJ8abx6KclblHGXAH7MwkKbbBuQr/Ey8r5szNwkqpA+Hxh/H p4sB4FtJa4R6lsxhpbyOQdprk7XfEvngO8FmSGa+w7yfbA3EZsW/wbzOfu4hSse5CIqW GzYJLFZfzZOQSOjjbcnfH7iIoI4BWkqT0v97GG2ZLVBSUhozRmI08h+K3ChHU/Jd7u0n ufsCs5mxi9M4xIQSMWGVrROad9LsvsokyS/456Mma4H72/5B3KQboBaPq6Uz4rZW9vvd BPjw== X-Gm-Message-State: AOAM5316JBKlufr//YOeAJqJ/vLSO+HleSwXA1gfC8JJKV+wJIhOs2J8 yF5l9SS2lhQphsFi/YJ+jkQ= X-Google-Smtp-Source: ABdhPJyeM0zHMQgSAKLIY1pkC0yU7P3sq8yPWGFis8laCOZJiGOjvUQ29pFsEShO7sH0bxipvLhl6g== X-Received: by 2002:a05:6512:c09:: with SMTP id z9mr13566872lfu.147.1643585874478; Sun, 30 Jan 2022 15:37:54 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 16/21] mips: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:13 +0300 Message-Id: <20220130233718.21544-17-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/mips/kernel/reset.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c index 6288780b779e..e7ce07b3e79b 100644 --- a/arch/mips/kernel/reset.c +++ b/arch/mips/kernel/reset.c @@ -114,8 +114,7 @@ void machine_halt(void) void machine_power_off(void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); #ifdef CONFIG_SMP preempt_disable(); From patchwork Sun Jan 30 23:37:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76F07C433EF for ; Sun, 30 Jan 2022 23:47:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262633.454988 (Exim 4.92) (envelope-from ) id 1nEJui-0006Ll-Ew; Sun, 30 Jan 2022 23:47:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262633.454988; Sun, 30 Jan 2022 23:47:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJui-0006Le-Bm; Sun, 30 Jan 2022 23:47:20 +0000 Received: by outflank-mailman (input) for mailman id 262633; Sun, 30 Jan 2022 23:47:18 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJle-0003lI-Kq for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:37:58 +0000 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [2a00:1450:4864:20::136]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a6bd6c44-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:37:56 +0100 (CET) Received: by mail-lf1-x136.google.com with SMTP id b9so23275705lfq.6 for ; Sun, 30 Jan 2022 15:37:56 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:55 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a6bd6c44-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=69wNajrm4+G/M74hrnrqfe/8gDIP1KRo4GBjc3qiBlE=; b=eADmGdhywqGHgBNSOTg6DDqxchm8B8ixUxTFBRIurSpOjI9zmNGmnnTl7ImQhqB8Ei 0mWnD7TAo0wSYeOZ937uVVcmUSkjlnYWZ7M+/JM6Dh7lyKqqc2++u6LI+atIfPTN5ays s+ktDvb2sLXt8MKBHLK9lwAFupFTVgxMIzESdB4QojqTGIkGjlXlLAoIu5tRpwgO0yvf ryjVbvaJTv11mzbS9UuOXGg5YPShB0ncAu5hIuMku9PpTrfxOLc753LOzzY0nXEsJ4s1 aTORw1Zo0yFFM9ZCzLTV1LBU1iplcGdbnitByV0PuagiZ7HTypKyLYaRcYB4LG2Z4YgC xHEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=69wNajrm4+G/M74hrnrqfe/8gDIP1KRo4GBjc3qiBlE=; b=HzZeuwn+p98+Mf6CK+TqYjROm5y9dQC39mQaU0XR8U7RKZDwd6SEkgQftDlKDqFB/K OFT94WtVLGBWdqiDO4GG2J/VIb8m0wNZnHhFUx8ri/vXhStj9giUgB2oav3cINax2qx+ JnARZ6JKVUiVv3qapXMvOtAIXYiqcaZmhvSRXMAzOKQvdTILlSRXu/nzCc+yY4Hb6tkQ XGfGC17auaA809bcY5ASiiHHPsGJ/3RYMt7L6ZRIMuCxI1cFeu5WohEyBdoLPGDmlX54 U4f8MJVEUN6WvnTZyhrfm6dYG2JbnBBFxHG7Z5MHSQwElB312jtvoJSwP5VxhgpQ2Fya R7zQ== X-Gm-Message-State: AOAM5329CeRywX79KvQdqxBRNUUwqnpLR4gawV337vViDSHtPkgK6JaL ODtAU7FboRdUQyIX3+X0Rk4= X-Google-Smtp-Source: ABdhPJwNSyf/5qJrwp6Ej2liXxYcZa6QcRMNedNFLOrkN6ogQ1iJOFH/fhB+J9LuMCwJeeOYVcQcPA== X-Received: by 2002:a19:f806:: with SMTP id a6mr13933723lff.592.1643585876243; Sun, 30 Jan 2022 15:37:56 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 17/21] nds32: Use do_kernel_power_off() Date: Mon, 31 Jan 2022 02:37:14 +0300 Message-Id: <20220130233718.21544-18-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/nds32/kernel/process.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/nds32/kernel/process.c b/arch/nds32/kernel/process.c index 49fab9e39cbf..0936dcd7db1b 100644 --- a/arch/nds32/kernel/process.c +++ b/arch/nds32/kernel/process.c @@ -54,8 +54,7 @@ EXPORT_SYMBOL(machine_halt); void machine_power_off(void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } EXPORT_SYMBOL(machine_power_off); From patchwork Sun Jan 30 23:37:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6265C433F5 for ; Sun, 30 Jan 2022 23:47:15 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262624.454976 (Exim 4.92) (envelope-from ) id 1nEJuQ-0005r4-6o; Sun, 30 Jan 2022 23:47:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262624.454976; Sun, 30 Jan 2022 23:47:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJuQ-0005qx-3p; Sun, 30 Jan 2022 23:47:02 +0000 Received: by outflank-mailman (input) for mailman id 262624; Sun, 30 Jan 2022 23:47:00 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlg-0003l1-40 for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:38:00 +0000 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [2a00:1450:4864:20::134]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a7ccc007-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:37:58 +0100 (CET) Received: by mail-lf1-x134.google.com with SMTP id x23so23420527lfc.0 for ; Sun, 30 Jan 2022 15:37:58 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:57 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a7ccc007-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6m8P3WoXpjmgm4wPv3Z7h5cBjPxfBSCYucbGZeGzChw=; b=pw0lvBk+dTz3ObiHx+Tziue58w6zUuZQVNJvU9S7GB+pTzwAHhgcj/iJlwXXxw2erP SjJaIXCKqSP4ZUdeywJtZKFLRYiUBBH6flK45216wEu+kAKbGqsUiHPKIi82YM1bz/wq bMKu0rK0969KEuxg/PSMaDE+zRgG2hxtPkS3M1mFIZPAgYW4ktfU2t1MzGq6fvtQ0WCp Y+7PFXh6gcLp4xF5Q6p6cFH24zY5vWjbmW+bewwmKwBTNzJ37xEIcDLIFgNsMgKiVVBl Kl81Cxsay4XTPckhsJ1WeXkyEjcWdoSjNX8wa8Lm2Ykdw2ly2wOfBD20u+sG0elmdIGM o1xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6m8P3WoXpjmgm4wPv3Z7h5cBjPxfBSCYucbGZeGzChw=; b=jkEs2njEW84gNVPpCYG8+2LP1CDUpWpwSgeBeIGL+pDZ4iPRxVKQRKJHXuCfzlI3+2 GFYyttjKRIx6JYAEJc7wiz7pOwkMyVfFCQxKPJd5ipYthx1apxBNnHyN42hkuL/JU+S9 fyUzF37g0cdJmzOKAeB+Ca8GamqCl33+LdAqljEL6nPtwS35Mw1vayMgz+G1p1J3rmDP pTRMzWHVy8vja6KUZI9UK3GYGgZRNZrJ6ua5SM6cMRfwPb3x7Oz9YAzgGnbkTDiGo5wK XsFw/tnNrqdIOtSZtZetjmHV/7+77zv/UM6MVlrdMampmidoasR+DmfcFHlxUZM1xB99 Bd+g== X-Gm-Message-State: AOAM532tSX1ZFWBJbT3vDiSbHQ+FTQqcqa72AgrpQV7yq3wFOXnuJnea rjmohBJLHgDlrXi2dgrXfvk= X-Google-Smtp-Source: ABdhPJym+9e+qz3b9Eox6rk6EROG58IYAq1gwBJQdx3IJq9mRqA6OUoE67/3HvdiOb6Vb5OIHzS4jw== X-Received: by 2002:a05:6512:10c4:: with SMTP id k4mr13546209lfg.63.1643585878009; Sun, 30 Jan 2022 15:37:58 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 18/21] memory: emif: Use kernel_can_power_off() Date: Mon, 31 Jan 2022 02:37:15 +0300 Message-Id: <20220130233718.21544-19-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Replace legacy pm_power_off with kernel_can_power_off() helper that is aware about chained power-off handlers. Signed-off-by: Dmitry Osipenko Acked-by: Krzysztof Kozlowski --- drivers/memory/emif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index 762d0c0f0716..cab10d5274a0 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -630,7 +630,7 @@ static irqreturn_t emif_threaded_isr(int irq, void *dev_id) dev_emerg(emif->dev, "SDRAM temperature exceeds operating limit.. Needs shut down!!!\n"); /* If we have Power OFF ability, use it, else try restarting */ - if (pm_power_off) { + if (kernel_can_power_off()) { kernel_power_off(); } else { WARN(1, "FIXME: NO pm_power_off!!! trying restart\n"); From patchwork Sun Jan 30 23:37:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCF7BC433F5 for ; Sun, 30 Jan 2022 23:49:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262676.455032 (Exim 4.92) (envelope-from ) id 1nEJwG-00009N-M2; Sun, 30 Jan 2022 23:48:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262676.455032; Sun, 30 Jan 2022 23:48:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJwG-00009G-Io; Sun, 30 Jan 2022 23:48:56 +0000 Received: by outflank-mailman (input) for mailman id 262676; Sun, 30 Jan 2022 23:48:55 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlg-0003lI-R7 for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:38:00 +0000 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [2a00:1450:4864:20::229]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a8e75404-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:38:00 +0100 (CET) Received: by mail-lj1-x229.google.com with SMTP id e9so17133354ljq.1 for ; Sun, 30 Jan 2022 15:38:00 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:37:59 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a8e75404-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Fjun7H7HFd6eJVLuHg+U86J15PDVhx/hGCMSiPgf2P0=; b=dd2fzDC5TDl8KpWUh0gU7+/JjGrL9a19MSGIOALm5z7fXs5VXHit+rqxXTBnz43EEy 6bAuu4TW+sayWblmW8KdfTygyhCSzYvoS93Z1gI42rqbvA3DwMo07+1y2fEK2Sdi+dYK sDP0y+AYT+lJyA1SE0LAK8MGBAbFccq0iNsI8MFwHrM4VDudz2gSr9hVrcXqatHOdkrN 1PfcjftqYULiK+vhkvAQxqJqQERFYAQADXPAeAOnfrVl+/hqqAaB3aFTvjRxQxWLKkrn UW62fbZN1kM7Fr/Abhtj4Byx5IJSmwGLhZ3+a2bcHkPKFWrQslOrFdx+rzve0FEyiDp5 +e8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Fjun7H7HFd6eJVLuHg+U86J15PDVhx/hGCMSiPgf2P0=; b=GzyF+MHAylz6aPfYbVmKWtuNmCE0h/Y7/v3E56fKSuABNZ4Kpo4Wj3+XA+RD52ONxM 4Bzna1pXvv307e3w5fQYvoMaHIg8miMcxko+bE4H0JJpo32Ui5l6YgxDSlb64l38uACX jin/BjQeVLPUp+sbcFTH8hX55ZbRy/nqtGkjY936X+FmPNGcvXvxVBVOt4/uIN+lr+8l PhWzkJfGzZ3DHXqLTxPJlzbzDmz8r5k/ja3DX6/Ohy/lX2dJ226/AOc1BLJo52+79Vvy vt+PP47LTalXSo1nXtIdODKTBMpp2J2KBfHG86e1cR6cnIakbMhhrzvw1KMKl2VJL9Xn dVlw== X-Gm-Message-State: AOAM532tFW15SX0HEV8YfH4Va5IsmBmQsUYWCmOHNTHD6uIQdwhtU7tx 3ZoifyvYzrplg6l+b+VZ+ic= X-Google-Smtp-Source: ABdhPJztEpqDu7c0duU4BlEMnF97NCTUImWX4xTUQenIAQJSUD2GpIv4OSVa9Xt8JSMsGNu6LN6TTQ== X-Received: by 2002:a2e:5858:: with SMTP id x24mr11923571ljd.519.1643585879834; Sun, 30 Jan 2022 15:37:59 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 19/21] ACPI: power: Switch to sys-off handler API Date: Mon, 31 Jan 2022 02:37:16 +0300 Message-Id: <20220130233718.21544-20-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Switch to sys-off API that replaces legacy pm_power_off callbacks. Signed-off-by: Dmitry Osipenko --- drivers/acpi/sleep.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index a60ff5dfed3a..e27ac5b4645b 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -47,19 +47,11 @@ static void acpi_sleep_tts_switch(u32 acpi_state) } } -static int tts_notify_reboot(struct notifier_block *this, - unsigned long code, void *x) +static void tts_reboot_prepare(struct reboot_prep_data *data) { acpi_sleep_tts_switch(ACPI_STATE_S5); - return NOTIFY_DONE; } -static struct notifier_block tts_notifier = { - .notifier_call = tts_notify_reboot, - .next = NULL, - .priority = 0, -}; - static int acpi_sleep_prepare(u32 acpi_state) { #ifdef CONFIG_ACPI_SLEEP @@ -1031,7 +1023,7 @@ static void acpi_sleep_hibernate_setup(void) static inline void acpi_sleep_hibernate_setup(void) {} #endif /* !CONFIG_HIBERNATION */ -static void acpi_power_off_prepare(void) +static void acpi_power_off_prepare(struct power_off_prep_data *data) { /* Prepare to power off the system */ acpi_sleep_prepare(ACPI_STATE_S5); @@ -1039,7 +1031,7 @@ static void acpi_power_off_prepare(void) acpi_os_wait_events_complete(); } -static void acpi_power_off(void) +static void acpi_power_off(struct power_off_data *data) { /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ pr_debug("%s called\n", __func__); @@ -1047,6 +1039,11 @@ static void acpi_power_off(void) acpi_enter_sleep_state(ACPI_STATE_S5); } +static struct sys_off_handler acpi_sys_off_handler = { + .power_off_priority = POWEROFF_PRIO_FIRMWARE, + .reboot_prepare_cb = tts_reboot_prepare, +}; + int __init acpi_sleep_init(void) { char supported[ACPI_S_STATE_COUNT * 3 + 1]; @@ -1063,8 +1060,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; + acpi_sys_off_handler.power_off_cb = acpi_power_off; + acpi_sys_off_handler.power_off_prepare_cb = acpi_power_off_prepare; } else { acpi_no_s5 = true; } @@ -1080,6 +1077,6 @@ int __init acpi_sleep_init(void) * Register the tts_notifier to reboot notifier list so that the _TTS * object can also be evaluated when the system enters S5. */ - register_reboot_notifier(&tts_notifier); + register_sys_off_handler(&acpi_sys_off_handler); return 0; } From patchwork Sun Jan 30 23:37:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6700DC433F5 for ; Sun, 30 Jan 2022 23:48:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262672.455020 (Exim 4.92) (envelope-from ) id 1nEJwA-000878-C0; Sun, 30 Jan 2022 23:48:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262672.455020; Sun, 30 Jan 2022 23:48:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJwA-000871-8r; Sun, 30 Jan 2022 23:48:50 +0000 Received: by outflank-mailman (input) for mailman id 262672; Sun, 30 Jan 2022 23:48:49 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJlm-0003lI-Lz for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:38:06 +0000 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [2a00:1450:4864:20::134]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a9f3e646-8225-11ec-8eb8-a37418f5ba1a; Mon, 31 Jan 2022 00:38:01 +0100 (CET) Received: by mail-lf1-x134.google.com with SMTP id i34so2974797lfv.2 for ; Sun, 30 Jan 2022 15:38:01 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:38:01 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a9f3e646-8225-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wEeGalIPQ9GIIDvt4ZGJ+mYKkZoiFtMFy2ITVcPwwOI=; b=jXXBBfwPJ7SdtaD0pclW/HMx76vc8RahjAuPQm5Z/0dXxW/074tzfimlFO1HkDBvcr oaZmouil0FqH92hbizW5my46ifg5DAFhrVT4LPFQpqXlLAxmnLJ6s1I5wLZSpyLZkBO0 wmI0HqfYIjv7H9ry2CW8BCr2FKRe9TovMRMPOdztHPrunU9Y7lzjTWnUadttQIH5bcvW vttSNQ9r1vC1IZO5YVlqjP01k8/CcmcrMHA8TiKEuoGV1yx8sOgJc71/KAtv9CA4CYS0 o8OCrmOu9r4n3DeN2/5U1nzk/Hg0gBL3B1cSmVdN8RggR9Ftjf3x1TwywZSLzo/+Zh9b 2sCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wEeGalIPQ9GIIDvt4ZGJ+mYKkZoiFtMFy2ITVcPwwOI=; b=e6Qe5UPAKJK734BpmSBM063EmjCILeUET2TZbIi0ggv1PZ2Uqi+YxOJBJpeNhOczMK wqE5AhVwv/1FdyqiAFvitsf6Mw1Y63VRY8HlTCy/VU91hv5ioiyypyYmsISwQRsrmGLD a6pjUAlIKHiicF3kJ8ahbkFXdOFAxkbPjv10u/P8gSNgBIaQC84RSgrsRQexPDXDn/3a AWNttCFririT1TuWedxfQXkeZlW39/0/SBFiZ0F4dYMUMVNFCCgZLucW8ebI2DZs9wL1 aD4cHrn5UaKPGZl/erdFgIFBn2nzxHjy6IM41px248BM51RiXX9v0PwP7hV122JGqsBv DN5A== X-Gm-Message-State: AOAM533nJIOPOHRPVey2x+pjIMgr3MEydAQnmyC7x1dFUsJennl+0n9Y HdccTasWNDviFnTQYCYEKiM= X-Google-Smtp-Source: ABdhPJxKcR6AU2adDJMgqBbtDaQvM6Qs2pl/Zem+Cp2eBfoUK309RxSg7fIwfBi/lJNJPdOsuZTuaw== X-Received: by 2002:a05:6512:402a:: with SMTP id br42mr13689925lfb.336.1643585881636; Sun, 30 Jan 2022 15:38:01 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 20/21] regulator: pfuze100: Use devm_register_sys_off_handler() Date: Mon, 31 Jan 2022 02:37:17 +0300 Message-Id: <20220130233718.21544-21-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 Use devm_register_sys_off_handler() that replaces global pm_power_off_prepare variable and allows to register multiple power-off handlers. Acked-by: Mark Brown Signed-off-by: Dmitry Osipenko --- drivers/regulator/pfuze100-regulator.c | 38 ++++++++++---------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index d60d7d1b7fa2..2eca8d43a097 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,7 @@ struct pfuze_chip { struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR]; struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR]; struct pfuze_regulator *pfuze_regulators; + struct sys_off_handler sys_off; }; static const int pfuze100_swbst[] = { @@ -569,10 +571,10 @@ static inline struct device_node *match_of_node(int index) return pfuze_matches[index].of_node; } -static struct pfuze_chip *syspm_pfuze_chip; - -static void pfuze_power_off_prepare(void) +static void pfuze_power_off_prepare(struct power_off_prep_data *data) { + struct pfuze_chip *syspm_pfuze_chip = data->cb_data; + dev_info(syspm_pfuze_chip->dev, "Configure standby mode for power off"); /* Switch from default mode: APS/APS to APS/Off */ @@ -611,24 +613,23 @@ static void pfuze_power_off_prepare(void) static int pfuze_power_off_prepare_init(struct pfuze_chip *pfuze_chip) { + int err; + if (pfuze_chip->chip_id != PFUZE100) { dev_warn(pfuze_chip->dev, "Requested pm_power_off_prepare handler for not supported chip\n"); return -ENODEV; } - if (pm_power_off_prepare) { - dev_warn(pfuze_chip->dev, "pm_power_off_prepare is already registered.\n"); - return -EBUSY; - } + pfuze_chip->sys_off.power_off_prepare_cb = pfuze_power_off_prepare; + pfuze_chip->sys_off.cb_data = pfuze_chip; - if (syspm_pfuze_chip) { - dev_warn(pfuze_chip->dev, "syspm_pfuze_chip is already set.\n"); - return -EBUSY; + err = devm_register_sys_off_handler(pfuze_chip->dev, &pfuze_chip->sys_off); + if (err) { + dev_err(pfuze_chip->dev, + "failed to register sys-off handler: %d\n", err); + return err; } - syspm_pfuze_chip = pfuze_chip; - pm_power_off_prepare = pfuze_power_off_prepare; - return 0; } @@ -837,23 +838,12 @@ static int pfuze100_regulator_probe(struct i2c_client *client, return 0; } -static int pfuze100_regulator_remove(struct i2c_client *client) -{ - if (syspm_pfuze_chip) { - syspm_pfuze_chip = NULL; - pm_power_off_prepare = NULL; - } - - return 0; -} - static struct i2c_driver pfuze_driver = { .driver = { .name = "pfuze100-regulator", .of_match_table = pfuze_dt_ids, }, .probe = pfuze100_regulator_probe, - .remove = pfuze100_regulator_remove, }; module_i2c_driver(pfuze_driver); From patchwork Sun Jan 30 23:37:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12730365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99FD8C433EF for ; Sun, 30 Jan 2022 23:48:45 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.262668.455010 (Exim 4.92) (envelope-from ) id 1nEJvx-0007hM-0a; Sun, 30 Jan 2022 23:48:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 262668.455010; Sun, 30 Jan 2022 23:48:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJvw-0007hD-Sk; Sun, 30 Jan 2022 23:48:36 +0000 Received: by outflank-mailman (input) for mailman id 262668; Sun, 30 Jan 2022 23:48:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEJln-0003l1-5E for xen-devel@lists.xenproject.org; Sun, 30 Jan 2022 23:38:07 +0000 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [2a00:1450:4864:20::134]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ab0756ff-8225-11ec-8f75-fffcc8bd4f1a; Mon, 31 Jan 2022 00:38:03 +0100 (CET) Received: by mail-lf1-x134.google.com with SMTP id z19so23194750lfq.13 for ; Sun, 30 Jan 2022 15:38:03 -0800 (PST) Received: from localhost.localdomain (109-252-138-126.dynamic.spd-mgts.ru. [109.252.138.126]) by smtp.gmail.com with ESMTPSA id a24sm1262950ljp.112.2022.01.30.15.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:38:03 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ab0756ff-8225-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kEaxNtq4BarrclNUiioDBF+6lBsKK3a9toXDktjcMR4=; b=HntJ6DyCYL+ke6f/r0is/oFtPZ4gM0JnOcriee/6UCUdnbMrZ6NOZCGasE1GEHraDu pCBWJZjwmgcL07nwsUauAU2GlxacbaVxZhonKlPwwFBuAdu9viIQHcwKhf5dcL+qJ3nn XhquQFTcfNjpbKfwUnK91j3Ge7sDIsFDFI/0mJTVowVMyA1BhEquZb8cXOuqYsZtg9aC IwXRQGqgPsQgyNkeIMf9S+4pn8Wundfp1v2UsKp+neG01ddR2rxW0d3I1LRmyGvULbSe 5ToOMq/E6pAjk3+OSUQ6ZeKR1+WuSDVpNO845bw8OU98QhOQkdAG7afJAysxD5/92Ee2 gC9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kEaxNtq4BarrclNUiioDBF+6lBsKK3a9toXDktjcMR4=; b=DF64HKc437p3VaG6k+9mWzaiB3cyFRreOnAmQLBfGSKT12hV6taZCo7BI8kAmusHVI XlA9PX+zNOphLhezSTrJl+qajJl9MkOkGElHVM+fRGfGg/UkFuWNxMNietHwaurSyWpz pge29l2CfOA45r9KQvUXQnkyzQCkEC3a7qOPCdZHyhAejMEEq8tAJUEu/pK3Z1fFA+c+ FOq+HejaTnTie8tzgn9HJqwrfAF/lZqqBR8qTTntQ75kNxOICk3J6OvBjZaKIrI85HzW BCnFdcdObMMapJAV6Mh8V95SVo2kKj6yajj5LiE5HVYgncFvoaRtNM1M0YUKm1GNvdP0 ZmLw== X-Gm-Message-State: AOAM533EzExl0KRi6ohtFgtqFmTXbVFclgXNP0VvVSYNoJVwQDwpbF94 xYSkuEmoL2leqLeqHemxpJA= X-Google-Smtp-Source: ABdhPJy7y3uqXOwOev3QXphmi8L7tLYmjKiDpJEwGe8WqzvjXRaZTuzAa3HaIFQiqtNJq5XkxRnQXQ== X-Received: by 2002:a05:6512:310:: with SMTP id t16mr13842194lfp.138.1643585883411; Sun, 30 Jan 2022 15:38:03 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v6 21/21] reboot: Remove pm_power_off_prepare() Date: Mon, 31 Jan 2022 02:37:18 +0300 Message-Id: <20220130233718.21544-22-digetx@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220130233718.21544-1-digetx@gmail.com> References: <20220130233718.21544-1-digetx@gmail.com> MIME-Version: 1.0 All pm_power_off_prepare() users were converted to sys-off handler API. Remove the obsolete callback. Signed-off-by: Dmitry Osipenko --- include/linux/pm.h | 1 - kernel/reboot.c | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index f7d2be686359..62879bfc4b8e 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -21,7 +21,6 @@ * Callbacks for platform drivers to implement. */ extern void (*pm_power_off)(void); -extern void (*pm_power_off_prepare)(void); struct device; /* we have a circular dep with device.h */ #ifdef CONFIG_VT_CONSOLE_SLEEP diff --git a/kernel/reboot.c b/kernel/reboot.c index 1ae5ba86b150..6e0d4deda987 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -48,13 +48,6 @@ int reboot_cpu; enum reboot_type reboot_type = BOOT_ACPI; int reboot_force; -/* - * If set, this is used for preparing the system to power off. - */ - -void (*pm_power_off_prepare)(void); -EXPORT_SYMBOL_GPL(pm_power_off_prepare); - /** * emergency_restart - reboot the system * @@ -828,10 +821,6 @@ void do_kernel_power_off(void) static void do_kernel_power_off_prepare(void) { - /* legacy pm_power_off_prepare() is unchained and has highest priority */ - if (pm_power_off_prepare) - return pm_power_off_prepare(); - blocking_notifier_call_chain(&power_off_handler_list, POWEROFF_PREPARE, NULL); }