From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58CA3C433F5 for ; Sun, 12 Dec 2021 21:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbhLLVUg (ORCPT ); Sun, 12 Dec 2021 16:20:36 -0500 Received: from mail-lf1-f54.google.com ([209.85.167.54]:44547 "EHLO mail-lf1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbhLLVUa (ORCPT ); Sun, 12 Dec 2021 16:20:30 -0500 Received: by mail-lf1-f54.google.com with SMTP id z7so27436029lfi.11; Sun, 12 Dec 2021 13:20:28 -0800 (PST) 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=n3cwwyKh/hwErnoFuV8i3YcIMR9FHZoMKEZSbOKAmdY=; b=Ex8lL4mdgUiRHYGoAXofDELzYU2M39Rf62MPEL6+NwhL4DG7f7g8blGnth50zzv9nv XtgwZ9AQGnJnLqVio+QWKRb0Z2UFZU13/SlOZ6knhCS8nzv79jUJrhvhvCtb6xbOGhRe QCo64//4R6yL9xhgOYc3zcYTNZnDzQezIWCwpso0yHMq6Gqm01cbjFNzL9wdR1IpObJX QNX5u0vTw2iIw9GwynLoMaZBVQkfGVwbmM4effBPRqVI72+jfv9/MdqbIDB9jPZ8pJzw hYqD/Yu8obJVLM9NSCzZb3jXy2mxfU4mU/jDrUalTCSK4fBVmU6wUB9oiNX1E5nzJKlr /TtA== 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=n3cwwyKh/hwErnoFuV8i3YcIMR9FHZoMKEZSbOKAmdY=; b=Aa6u+iIa1S9cbBStT6atrb2qvD18RfT0IU+bPDKtrtLJlLzWx+1Nx9+HqN8miWN8jW MxkHSyG8wLCBc0CkJK/qzAboNJksOztQOxCGFXta7Ld75U4rtyCCboIBHB4igoO/TlFj t4nk06Gyjko1Xu5NM43MTQmi7u9s2mCLspr/NXEDD2glruoo605OhoD9yvDTnxRn/mca 3lQCS47SPPnT6MnCbHiy9iwuN7Bi2BSFMKCmxzX6xh3JFgYtvL2KtGY85KW3sJDUzQF/ pSDRfHAxmCIcBmyorCPdepTLhdZ5pl/t31SMoNJv5YHUS7fANg6RZhK1FpZH6ovB0yMb 2rSw== X-Gm-Message-State: AOAM5325p8UzBf72BpwvBy6KJhUv0hFPV1kjtpP9+opvgKLe2NHbk7FJ IpnjpQ8L5iAxMsJD74hkF61SLvrYExw= X-Google-Smtp-Source: ABdhPJyVUXR8xADdHsxaMm4O/Lfphg0rT3u//x42eqt+aVA8OPTC8ytA0fee16pgBcrKP9uKJF2ykQ== X-Received: by 2002:a05:651c:514:: with SMTP id o20mr26693103ljp.393.1639343016405; Sun, 12 Dec 2021 13:03:36 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03: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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 01/21] notifier: Add blocking_notifier_call_chain_is_empty() Date: Mon, 13 Dec 2021 00:02:49 +0300 Message-Id: <20211212210309.9851-2-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 b= locking_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); =20 +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 b8251dc0bc0f..e30d24ee88e9 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -322,6 +322,19 @@ int blocking_notifier_call_chain(struct blocking_notif= ier_head *nh, } EXPORT_SYMBOL_GPL(blocking_notifier_call_chain); =20 +/** + * 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! --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343064; cv=none; d=zohomail.com; s=zohoarc; b=hwwSEDCCQ27cXuybvvJVptMUbjEbGsviEFN8j/PkUmkwazq7pi68h7EWKJyewaIgTZ6uF4L2mXi9DYaOJA04iZ6ydwlriVC8MaSUNExnFYHjDSmmquhOM1YwBYKA+79BlcN4lgRJRSUNblM/JTIK+CkBCYyHHOmPt3E7qtUYY+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343064; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CYB4TkQOzA3vf/K7WR0AkGT34Ge0Y+0VoaElZGGGZzU=; b=QEQonjUB6++lGcLRGFHSDW4elm761hU/PyVSMPUmHwgsiF9Cw9WiZ10tUjLpGSUYSmDZEmnw+9M/hK4L9pxgSkscAE6LeWukphSso2RBFX3pCXgzbKVnKxdruuY7pTDITIbm7Uwby6CioAka0k43wy6l0EQmYzoJrUw55NgZ+FI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639343064396206.50889027855715; Sun, 12 Dec 2021 13:04:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245685.423803 (Exim 4.92) (envelope-from ) id 1mwW0S-0004Rs-VE; Sun, 12 Dec 2021 21:03:40 +0000 Received: by outflank-mailman (output) from mailman id 245685.423803; Sun, 12 Dec 2021 21:03:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mwW0S-0004Rl-RA; Sun, 12 Dec 2021 21:03:40 +0000 Received: by outflank-mailman (input) for mailman id 245685; Sun, 12 Dec 2021 21:03:39 +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 1mwW0R-0004BS-Lm for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:03:39 +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 fa65b1db-5b8e-11ec-a74f-db008197e53d; Sun, 12 Dec 2021 22:03:38 +0100 (CET) Received: by mail-lj1-x229.google.com with SMTP id b19so19302924ljr.12 for ; Sun, 12 Dec 2021 13:03:38 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03:38 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: fa65b1db-5b8e-11ec-a74f-db008197e53d 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=CYB4TkQOzA3vf/K7WR0AkGT34Ge0Y+0VoaElZGGGZzU=; b=YPGRWatSQET2pz+NVqu4ADHfYgaxmP/wWxna6m/lloO4toehydZkLAQeVKfAZnur3U ytUl8qCGBZdPLRC2UzNM4AW78JtCd6wM5cGhTywvum741iPm3RcFk7tkhkZidnvbCnJl R/4YWy2Kn2XQsZfcdS0OqacDfDDCQ28GjMnqHQTevEBhyfW+vOkmPPci2FrLZRzsEI3D rIODFz6+YMOOUk7HX9YcjikZPgA6Qmy3MY8VgfLlwgexSKQyGvZ0zOYmPyq4U9vsPiW2 gzi0gfD7OcJAbuwERD0Pe26Rs8F2W7VMl8LrFpshwRBhPegOZQws/YUiLfZf5um9S4nw C5Tg== 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=CYB4TkQOzA3vf/K7WR0AkGT34Ge0Y+0VoaElZGGGZzU=; b=z8RUQHrZLGkIcYJozy36sRlNQ6nK0Uw/Cc+GgrirIiwWZG7aN+Qe61/Dc5+taPWknY PQIkiLO7tP5KpsZhUi1J7YskD468bGls0VCsCWfPr8xgOTtKCirfqY2KSaaRcP2gfTVk T/1BYDciso8qxcBn4uu/GfibnDRcd0PKKAC7vdtjnd9WlhN4zaKLDToAkZvYEAAUSkLP 53zjdzl8DyMlGxSRkYtjWL5F8loeB2hOkp5cTzzAwgE6ktcI+SmBQjHvCSecndimBiD3 vGaFbQ2tJxrpa2l+PkFF7sTGsx1xY6F6nHtyO7CLykrsVu1ZJPlIsa9ATptfAlyUSQek PrmQ== X-Gm-Message-State: AOAM532ZuN/6cPgKNqk1H7gWPS4xWGAVE1FdEKYa8h5SzFE/bWJVUKzm XG1ZvpXrGDnIZlI5nEn67Vc= X-Google-Smtp-Source: ABdhPJzJGi8tVTi5bdKFCxEOnO/KtQERR8PihOgq6tSrXYkNCawTEu3K38hiwfey531aaHgxOHQg5Q== X-Received: by 2002:a2e:874b:: with SMTP id q11mr26014054ljj.194.1639343018442; Sun, 12 Dec 2021 13:03: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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 02/21] notifier: Add atomic/blocking_notifier_chain_register_unique_prio() Date: Mon, 13 Dec 2021 00:02:50 +0300 Message-Id: <20211212210309.9851-3-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343067219100006 Content-Type: text/plain; charset="utf-8" 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 | 87 +++++++++++++++++++++++++++++++--------- 2 files changed, 73 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_noti= fier_head *nh, extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, struct notifier_block *nb); =20 +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 *n= h, struct notifier_block *nb); extern int blocking_notifier_chain_unregister(struct blocking_notifier_hea= d *nh, diff --git a/kernel/notifier.c b/kernel/notifier.c index e30d24ee88e9..77e5112ff05b 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -20,7 +20,7 @@ BLOCKING_NOTIFIER_HEAD(reboot_notifier_list); */ =20 static int notifier_chain_register(struct notifier_block **nl, - struct notifier_block *n) + struct notifier_block *n, bool unique_priority) { while ((*nl) !=3D NULL) { if (unlikely((*nl) =3D=3D n)) { @@ -29,6 +29,8 @@ static int notifier_chain_register(struct notifier_block = **nl, } if (n->priority > (*nl)->priority) break; + if (n->priority =3D=3D (*nl)->priority && unique_priority) + return -EBUSY; nl =3D &((*nl)->next); } n->next =3D *nl; @@ -143,12 +145,35 @@ int atomic_notifier_chain_register(struct atomic_noti= fier_head *nh, int ret; =20 spin_lock_irqsave(&nh->lock, flags); - ret =3D notifier_chain_register(&nh->head, n); + ret =3D notifier_chain_register(&nh->head, n, false); spin_unlock_irqrestore(&nh->lock, flags); return ret; } EXPORT_SYMBOL_GPL(atomic_notifier_chain_register); =20 +/** + * 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 zero on success, -EBUSY otherwise. + */ +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 =3D 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 notif= ier chain * @nh: Pointer to head of the atomic notifier chain @@ -208,18 +233,9 @@ NOKPROBE_SYMBOL(atomic_notifier_call_chain); * synchronized by an rwsem. */ =20 -/** - * 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. - * - * Currently always returns zero. - */ -int blocking_notifier_chain_register(struct blocking_notifier_head *nh, - struct notifier_block *n) +static int __blocking_notifier_chain_register(struct blocking_notifier_hea= d *nh, + struct notifier_block *n, + bool unique_priority) { int ret; =20 @@ -229,15 +245,48 @@ int blocking_notifier_chain_register(struct blocking_= notifier_head *nh, * such times we must not call down_write(). */ if (unlikely(system_state =3D=3D SYSTEM_BOOTING)) - return notifier_chain_register(&nh->head, n); + return notifier_chain_register(&nh->head, n, unique_priority); =20 down_write(&nh->rwsem); - ret =3D notifier_chain_register(&nh->head, n); + ret =3D 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. + * + * Currently always returns zero. + */ +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); =20 +/** + * blocking_notifier_chain_register_unique_prio - Add notifier to a blocki= ng 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 zero on success, -EBUSY otherwise. + */ +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 no= tifier chain * @nh: Pointer to head of the blocking notifier chain @@ -353,7 +402,7 @@ bool blocking_notifier_call_chain_is_empty(struct block= ing_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); =20 @@ -432,10 +481,10 @@ int srcu_notifier_chain_register(struct srcu_notifier= _head *nh, * such times we must not call mutex_lock(). */ if (unlikely(system_state =3D=3D SYSTEM_BOOTING)) - return notifier_chain_register(&nh->head, n); + return notifier_chain_register(&nh->head, n, false); =20 mutex_lock(&nh->mutex); - ret =3D notifier_chain_register(&nh->head, n); + ret =3D notifier_chain_register(&nh->head, n, false); mutex_unlock(&nh->mutex); return ret; } --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343065; cv=none; d=zohomail.com; s=zohoarc; b=HQAym9r4ZzWNVHrrOZfRZ8CZxWM2A5ugKDfNYS9o7nveLfm6C7P40uFowQi7IztfSBW6sqWmS5U6ugGCaRrL+A8CJizzLcxBiv33avr63ZbzYLTT4VJGiNMGWXy3Xsj5uhaHo8VOGGv3pCTtK4s1B8sZ29qiI8L2VBACIn3VEfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343065; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SiVmxmlmX7gD18KWJKuTaPa7pNX7A6+5Wut7BQEWlWA=; b=mcvtcKNuCu0EsipzOToK3gFqCBFOjYGROzHwXzxz3FfWxV6mbWd1TTFwFYTVuPT4RPoVLM6E07CN/PNEKLB+RfRzSFVrI5hBohhTuOj+65ViBSAAnb1YmQspHu4VZaUDopVyAxxJZ4LmTe5WTeZ5/+pOM9vomt4hgvxBxmNJ8W4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 163934306545994.34327407496005; Sun, 12 Dec 2021 13:04:25 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245687.423825 (Exim 4.92) (envelope-from ) id 1mwW0V-0004z2-Gd; Sun, 12 Dec 2021 21:03:43 +0000 Received: by outflank-mailman (output) from mailman id 245687.423825; Sun, 12 Dec 2021 21:03: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 1mwW0V-0004yt-DV; Sun, 12 Dec 2021 21:03:43 +0000 Received: by outflank-mailman (input) for mailman id 245687; Sun, 12 Dec 2021 21:03: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 1mwW0T-0004BS-B7 for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:03:41 +0000 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [2a00:1450:4864:20::232]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fb8ff8de-5b8e-11ec-a74f-db008197e53d; Sun, 12 Dec 2021 22:03:40 +0100 (CET) Received: by mail-lj1-x232.google.com with SMTP id i63so21125104lji.3 for ; Sun, 12 Dec 2021 13:03:40 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03:40 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: fb8ff8de-5b8e-11ec-a74f-db008197e53d 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=SiVmxmlmX7gD18KWJKuTaPa7pNX7A6+5Wut7BQEWlWA=; b=qyaqAU+HSKD+HsUBKg5AB4Grj9JsCbr9g/kNEIZtJUYDPkR5w7X3oEBoqbhkveHPA0 i7WuMCFDqVmy4v4uwmxmKqJQgyKWbZxAuezUxU7vJ7Js6Vv9mGU7AXWM79sgkKDLmhWK jFp8UPoUTDTrVPMbjiOZPw0kaHhZEow7vk98bEAvorv4PN2Ae1WrpFauYpbNmt6sURPu EHsFzc94IQPacNeM0GpGjXTCkggEJqqfF6pqgsflI/TGqDXRSOm8kaL/erYImjVTvQQe TKd1cdir2wKhwb/5hDwmkKqbCAzORiU/FXU4xaDIEAT35buQchr71urUuURu0JjCKmA+ 4E2Q== 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=SiVmxmlmX7gD18KWJKuTaPa7pNX7A6+5Wut7BQEWlWA=; b=A+Kj8svMQxNEGnEJSVZ9HSMEvBT1g4ryfbHLM/fllXW5MRzcjDJpCD20lIC9HQsdUt XZ7nD8HgCCs0dwnCEZlY1uxKlxxvtHiSKiY7q5ITJ4Ikf1BZuNIEi74Y1teMB/OvlCe3 Pyy+q1wD5pamZzGnEjhmSkmbDWbcjYtaM7l4g3jXEQ1vWfAPKpMGcVDRD4nqLMsFNO+s dWWvwdegiifdM/fQCbJTSg/kCo4oTSna0joIcLUn6fVS+IX3BVyDgXUEOLt9cyLGw3uC xXg8N2/+Q1zaGOebomIIu8wWnvJObwENFR20HejxjqV0ZOXbedBRhVy+wKZvODLK+pOX MXHA== X-Gm-Message-State: AOAM531ewvfvnFlwo+JmHu2IDnNAJukW7VUGBKc1d7BByrFniml8r28c yAOyNZULoN4+GM2BflnzFsU= X-Google-Smtp-Source: ABdhPJzPB5bwYAfFOn1aDytHDcrWq16AdXdyLAU7ztJCQFx3xpkh7jhCINcDSwIbtlftQmSbgta8Pw== X-Received: by 2002:a2e:9903:: with SMTP id v3mr25528327lji.143.1639343020440; Sun, 12 Dec 2021 13:03:40 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 03/21] reboot: Print error message if restart handler has duplicated priority Date: Mon, 13 Dec 2021 00:02:51 +0300 Message-Id: <20211212210309.9851-4-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343067197100004 Content-Type: text/plain; charset="utf-8" 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 =3D atomic_notifier_chain_register_unique_prio(&restart_handler_list,= nb); + if (ret !=3D -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); --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AAD2C433F5 for ; Sun, 12 Dec 2021 21:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbhLLVVW (ORCPT ); Sun, 12 Dec 2021 16:21:22 -0500 Received: from mail-ed1-f46.google.com ([209.85.208.46]:42804 "EHLO mail-ed1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbhLLVVQ (ORCPT ); Sun, 12 Dec 2021 16:21:16 -0500 Received: by mail-ed1-f46.google.com with SMTP id r11so45595384edd.9; Sun, 12 Dec 2021 13:21:14 -0800 (PST) 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=QaJ/7qszLPEY+beo4CxylD+wE2a5oMODuqLEZ/O4D0M=; b=Crx6wDN+0vpxSLjzyjDy3S17n1SvpIL+jtEI4xEpTUXKWy5nj7dAjGUwZ8oVGLKol2 gy67o7q5QvJpYyko9thpNQivbubJ3ZsBAO33JCauzbd5Gkq4wQwArQJ/7wyeLqgJ5Zj0 icd6G56b7Cq6k89Wj2irCulSyafRkOg/4B8oHAVFt8cjt7aq1UPMul36Fe8l28tbZEIX rqusi2YqLj/tO4XxpG1zyRMwvLeZNa2k0rPxRpAjgVy6LeZpQVj7hmZcFVCrJcbSJ72y tthxZQevFVg88k0XBO6KvtvTG5LzzNWYZzgywRqNLi1R8NGnIbcrIsR1AVMB/egI5oGd PrqQ== 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=QaJ/7qszLPEY+beo4CxylD+wE2a5oMODuqLEZ/O4D0M=; b=hFfIeyqI6RRniAoSPv/+QhWqDkHJNGDXaGOnDxvzESAYOS3F5V8OESwAjbI8PSKz8N OhZZS/7Wuj2VI59yVV4oj+jHLWgh9LWwZmKqdHjIIJA1/AkIk5+84iqKjjtYTgH3SDIs zq8N4hexU3dPBsYHoDAcFWXo5GO4AwwcnOtNAb2Xi0jL1FOg0Pl6v6h1sjKBZ6W5LuSs KSE5gldO3FFht/4Zln2zPdld4fNHycqFMs2VCDWUpZqDMMByuBvh2aCAMDkZMTevqOF8 +u4c5SqQL6FVJdA2ljnlMLpUfo5S9GQqfykgVH0Eg5F3LYHHGEs2c4wRKg2HEs5LMmQE wrbA== X-Gm-Message-State: AOAM530NZtxMnDCDpa4H9ZL2YHoMOFY/vN6nWJNUGQvjvdn869DBBEq1 Nd9ewZOQKS4zJ7tiIb4JA2LtV+vyaQ8= X-Google-Smtp-Source: ABdhPJzRB700Ad2OFWbDxEi2WjXylbQ6RiXgitc2Lkmm2CHoFoG9aZ5KVOnO1fHBkqp/Z5WMiA5jfQ== X-Received: by 2002:a2e:b545:: with SMTP id a5mr24922900ljn.510.1639343022629; Sun, 12 Dec 2021 13:03:42 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03:42 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 04/21] kernel: Add combined power-off+restart handler call chain API Date: Mon, 13 Dec 2021 00:02:52 +0300 Message-Id: <20211212210309.9851-5-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 | 556 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 815 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 @@ =20 struct device; =20 -#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 =3D 1, /* Notify of system down */ + SYS_RESTART =3D 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 =20 enum reboot_mode { REBOOT_UNDEFINED =3D -1, @@ -49,6 +74,237 @@ extern int register_restart_handler(struct notifier_blo= ck *); extern int unregister_restart_handler(struct notifier_block *); extern void do_kernel_restart(char *cmd); =20 +/* + * 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 =3D 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 argu= ment + * + * @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 no= t 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 call= back + * @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); =20 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 e6af502c2fd7..aebbdd757fb9 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -666,7 +666,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..3085873a876f 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -296,6 +296,547 @@ void kernel_halt(void) } EXPORT_SYMBOL_GPL(kernel_halt); =20 +/* + * 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 =3D blocking_notifier_chain_register_unique_prio(&power_off_handler_l= ist, nb); + if (ret && ret !=3D -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 =3D 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 =3D dummy_pm_power_off; + pm_power_off_nb =3D nb; + } + + return 0; +} + +static int unregister_power_off_handler(struct notifier_block *nb) +{ + if (nb =3D=3D pm_power_off_nb) { + if (pm_power_off =3D=3D dummy_pm_power_off) + pm_power_off =3D NULL; + + pm_power_off_nb =3D NULL; + } + + return blocking_notifier_chain_unregister(&power_off_handler_list, nb); +} + +static void devm_unregister_power_off_handler(void *data) +{ + struct notifier_block *nb =3D data; + + unregister_power_off_handler(nb); +} + +static int devm_register_power_off_handler(struct device *dev, + struct notifier_block *nb) +{ + int err; + + err =3D 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 =3D {}; + struct sys_off_handler_private_data *priv; + struct power_off_data data =3D {}; + struct sys_off_handler *h; + int ret =3D NOTIFY_DONE; + + priv =3D container_of(nb, struct sys_off_handler_private_data, power_off_= nb); + h =3D container_of(priv, struct sys_off_handler, priv); + prep_data.cb_data =3D h->cb_data; + data.cb_data =3D 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 =3D 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 =3D {}; + struct sys_off_handler *h; + + priv =3D container_of(nb, struct sys_off_handler_private_data, restart_nb= ); + h =3D container_of(priv, struct sys_off_handler, priv); + + data.stop_chain =3D h->restart_chaining_disallowed; + data.cb_data =3D h->cb_data; + data.mode =3D mode; + data.cmd =3D 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 =3D {}; + struct sys_off_handler *h; + + priv =3D container_of(nb, struct sys_off_handler_private_data, reboot_nb); + h =3D container_of(priv, struct sys_off_handler, priv); + + data.cb_data =3D h->cb_data; + data.stop_chain =3D false; + data.mode =3D mode; + data.cmd =3D 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 handl= er + * @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 =3D 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 =3D=3D POWEROFF_PRIO_RESERVED) + priority =3D POWEROFF_PRIO_DEFAULT; + else + priority =3D handler->power_off_priority; + + priv->power_off_nb.notifier_call =3D sys_off_handler_power_off; + priv->power_off_nb.priority =3D priority; + + err =3D register_power_off_handler(&priv->power_off_nb); + if (err) + goto reset_sys_off_handler; + } + + if (handler->restart_cb) { + if (handler->restart_priority =3D=3D RESTART_PRIO_RESERVED) + priority =3D RESTART_PRIO_DEFAULT; + else + priority =3D handler->restart_priority; + + priv->restart_nb.notifier_call =3D sys_off_handler_restart; + priv->restart_nb.priority =3D priority; + + err =3D register_restart_handler(&priv->restart_nb); + if (err) + goto unreg_power_off_handler; + } + + if (handler->reboot_prepare_cb) { + priv->reboot_nb.notifier_call =3D sys_off_handler_reboot; + priv->reboot_nb.priority =3D handler->reboot_priority; + + err =3D register_reboot_notifier(&priv->reboot_nb); + if (err) + goto unreg_restart_handler; + } + + priv->registered =3D 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; + int err =3D 0; + + if (!handler) + return 0; + + priv =3D sys_off_handler_private_data(handler); + + /* sanity-check whether handler is unregistered twice */ + if (!priv->registered) + return -EINVAL; + + if (handler->reboot_prepare_cb) + err |=3D unregister_reboot_notifier(&priv->reboot_nb); + + if (handler->restart_cb) + err |=3D unregister_restart_handler(&priv->restart_nb); + + if (handler->power_off_cb) + err |=3D unregister_power_off_handler(&priv->power_off_nb); + + memset(priv, 0, sizeof(*priv)); + + return err ? -EINVAL : 0; +} +EXPORT_SYMBOL(unregister_sys_off_handler); + +static void devm_unregister_sys_off_handler(void *data) +{ + struct sys_off_handler *handler =3D data; + + unregister_sys_off_handler(handler); +} + +/** + * devm_register_sys_off_handler - Register system power-off/restart handl= er + * @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 =3D 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 powe= r-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 =3D devm_kzalloc(dev, sizeof(*handler), GFP_KERNEL); + if (!handler) + return -ENOMEM; + + if (priority =3D=3D POWEROFF_PRIO_RESERVED) + priority =3D POWEROFF_PRIO_DEFAULT; + + priv =3D sys_off_handler_private_data(handler); + + priv->power_off_nb.notifier_call =3D sys_off_handler_power_off; + priv->power_off_nb.priority =3D priority; + priv->simple_power_off_cb_data =3D cb_data; + priv->simple_power_off_cb =3D 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 restar= t 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 =3D devm_kzalloc(dev, sizeof(*handler), GFP_KERNEL); + if (!handler) + return -ENOMEM; + + if (priority =3D=3D RESTART_PRIO_RESERVED) + priority =3D RESTART_PRIO_DEFAULT; + + handler->restart_priority =3D priority; + handler->restart_cb =3D callback; + handler->cb_data =3D 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 =3D { + .priv =3D { + .power_off_nb =3D { + .notifier_call =3D sys_off_handler_power_off, + .priority =3D 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 =3D 0; + + priv =3D sys_off_handler_private_data(&platform_power_off_handler); + + spin_lock(&platform_power_off_lock); + if (priv->platform_power_off_cb) + ret =3D -EBUSY; + else + priv->platform_power_off_cb =3D power_off; + spin_unlock(&platform_power_off_lock); + + if (ret) + return ret; + + ret =3D register_power_off_handler(&priv->power_off_nb); + if (ret) + priv->platform_power_off_cb =3D NULL; + + return ret; +} +EXPORT_SYMBOL_GPL(register_platform_power_off); + +/** + * unregister_platform_power_off - Unregister platform-level power-off cal= lback + * @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 =3D sys_off_handler_private_data(&platform_power_off_handler); + + if (priv->platform_power_off_cb !=3D power_off) + return -EINVAL; + + ret =3D unregister_power_off_handler(&priv->power_off_nb); + priv->platform_power_off_cb =3D 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 !=3D 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 +845,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 +854,16 @@ void kernel_power_off(void) } EXPORT_SYMBOL_GPL(kernel_power_off); =20 +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); =20 /* @@ -355,7 +905,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsig= ned 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 =3D=3D LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off) + if (cmd =3D=3D LINUX_REBOOT_CMD_POWER_OFF && !kernel_can_power_off()) cmd =3D LINUX_REBOOT_CMD_HALT; =20 mutex_lock(&system_transition_mutex); --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B069C43217 for ; Sun, 12 Dec 2021 21:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbhLLVVK (ORCPT ); Sun, 12 Dec 2021 16:21:10 -0500 Received: from mail-ed1-f47.google.com ([209.85.208.47]:42779 "EHLO mail-ed1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhLLVVG (ORCPT ); Sun, 12 Dec 2021 16:21:06 -0500 Received: by mail-ed1-f47.google.com with SMTP id r11so45594722edd.9; Sun, 12 Dec 2021 13:21:04 -0800 (PST) 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=4G0wXMIRKtQjgiQjhPPTWIJTonbxBMvj833mzQfGVdU=; b=UmHNBT8JmdhQ5CXOuzBPrdCFUG3onvjKjyb7BVoTR6PoZ7aY9ImgmoLFJ8cX/YVLss FhaRpMyx6UDbgZbpErI6LiS2MWo9dsEpm/Yn/glHgDMltg46AqIFy+ODbJy1mDGnSX6Q 6hgBQWxhgUXb1w4suJJ3mGjbzzVU8sboZDIyHdE0at2JpjfcocKdBr+3u8eWls6ZdqdV vZ4mrsRkvMQH9goBfcYfawa9rTT2nVXUK1e0dhFRpy7O9dgcCyJsMwyOMgChqmTkAYY8 lrO8FmVaBVXU/jCI9v95z8kMIgVRbHZl7Dj+Y9SNeeNladuYqhNnhCKP7pmJssTLe+hK /zfg== 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=4G0wXMIRKtQjgiQjhPPTWIJTonbxBMvj833mzQfGVdU=; b=Rb+4hpk5Kt1e1Yfs+7e3JEushGaDFgyB3SmPZFGVCIbFBoLAcZlCqb9KvhTji28TfI Z+UrswdsroBgwCQxlYPWBzMJfP3kxwNls6pH4mPi2Ibk6VY8A+IK5v6oqHRyVqlMueSA tMHZeAls8nzQPtfMx8teSys1+GdpKPiESYBr3FBPXvgVKUjbRsL8UhZFiS5qi3qr41Jj 6/ZJlwWF+IwbaUcs5FuaNrnTGh23kJnQu5NfiaW+9my7G6a6W4CBKPS3ZU5YzwsaeFS9 a1ONGTIFAZm0Lz0MWjNPV0ggvlpOe9hzAthIMRuNXd2D6f79fpjrufo3/rbvFQrND0XY Oa9Q== X-Gm-Message-State: AOAM532lLa8zp3Wmevwz5BUof4Lo1xyfmUsKAf/8EYE+U0DFpvPDIm6k wH1xrtCaGYaDJhFg/sNiGnY12EiGcCs= X-Google-Smtp-Source: ABdhPJxFbn2GY3BCcnuEIOE5ToL9Wd42NcsVPvWkJ7LxAK1mty5nUWabwI1BhIkHNdC7U+LYga5X9w== X-Received: by 2002:a05:6512:3f6:: with SMTP id n22mr19160482lfq.501.1639343024602; Sun, 12 Dec 2021 13:03:44 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03:44 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 05/21] ARM: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:02:53 +0300 Message-Id: <20211212210309.9851-6-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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(); } =20 /* --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1DCFC433EF for ; Sun, 12 Dec 2021 21:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbhLLVU0 (ORCPT ); Sun, 12 Dec 2021 16:20:26 -0500 Received: from mail-ed1-f42.google.com ([209.85.208.42]:45659 "EHLO mail-ed1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbhLLVUY (ORCPT ); Sun, 12 Dec 2021 16:20:24 -0500 Received: by mail-ed1-f42.google.com with SMTP id y12so45401157eda.12; Sun, 12 Dec 2021 13:20:22 -0800 (PST) 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=WLlXRmIj/zMVA0EiitKjc0V06oQPoMgvuV0WtFcoWEk=; b=Z9frmqTKg5aoS2PU9i7y55F1Fktg58Vk2dW1KbQjX3M9u/eaFeNaZynJ32r52oBsf/ P9f28j0C1WiUodwIjr6XbJsThvC5MCwPgOI/+5M/0VrXYfVzLWQeaRXWUSfPZb+I2BSI BQPFKoBwRVjbyBL2TND78RdUJQyDLS7Pkm0fODoqLqGIlWJGn8+AfpkS3xhzwQqXsYu+ 5Y85pgu/pjYqmqy25ZvgQq8EW9Jv0u/pC5H+pGq+qKilGUXE9mzv0sr4iNh3LtrbFN9z ktmDNa2rZciKvQCLgGh4sd5oSXRV7GuSIk+wrmiOWBZtTjqy61YULWuD5yCzVtaU2XTm +s7w== 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=WLlXRmIj/zMVA0EiitKjc0V06oQPoMgvuV0WtFcoWEk=; b=jOY1OUjL7Z5MGhyFlbY3kGGMrYe1w3iWvOoKm/Yo+poFy6CUhcWhi0ixkRFHirtskS yzePuYTDsm6fCrxePcxjnDJIGFBCKml3CIyHZzh6PfbPPU73lJuaVCAVtRJ/LVRWOTLM VzgtLnHdgj6YejY+K6Vyh7f6UveeVaFdxTb+7LzhS18UzampPcRIaiE76hwX1oDLEiy8 FKncFAY0icSAp/bzlb/17An8ZPp3dn/zASvd6ylEsrI4G8vLJlaxLiQSM3DPJFoGHrNz SnuQPwHeL1llzfSY7oF6T9g8yYSg4K3yn9hfLlvkO3iytbjP2PP8lB5nYfIIlvQkSH9v Thrw== X-Gm-Message-State: AOAM5323LJlrcOPVr9uRFGE9UBKkq/CkQS/fV7w/1dsSJVqUIPraMc4A v9wUX7zcH9hEIxcvKDfMj5aEv+K0T6I= X-Google-Smtp-Source: ABdhPJyn4bB+L+dbSeB8tkaNaTLuP+spDExh0AO3PYQ44Uwwg2wXZuKvjQXzPiXg+PdVnR/cyixvqQ== X-Received: by 2002:a2e:9dcf:: with SMTP id x15mr26933582ljj.432.1639343026612; Sun, 12 Dec 2021 13:03:46 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03:46 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 06/21] csky: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:02:54 +0300 Message-Id: <20211212210309.9851-7-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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"); } =20 void machine_halt(void) { local_irq_disable(); - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); asm volatile ("bkpt"); } =20 --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2771AC433EF for ; Sun, 12 Dec 2021 21:21:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbhLLVVv (ORCPT ); Sun, 12 Dec 2021 16:21:51 -0500 Received: from mail-ed1-f48.google.com ([209.85.208.48]:46688 "EHLO mail-ed1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbhLLVVa (ORCPT ); Sun, 12 Dec 2021 16:21:30 -0500 Received: by mail-ed1-f48.google.com with SMTP id y13so45752446edd.13; Sun, 12 Dec 2021 13:21:27 -0800 (PST) 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=hKgqav8a8uS+JOYHQI8KBeK4UU43xCMXoqbNcSGFyUw=; b=KUwqX4BEtYi0Tl6FHY2CY8/c97CDNjqMcby3q7qakxzQRe7fXsisnIY/MWhKC0c/of zGMKDdImy6NTe9G0A7mThOpcw6K/S+1AR3eVT8uprZ/XHyIT4qyf2Wds12KFazsicm2w bCeOnXKrjzFNqWMPd1F+4GYHIWkBe3KzeOKUJ7KCKaBggqii376yhMOZjBlnlQ+uIszq o5w0MaH69JTpDhOPa5VxphJ3hllwl22I2McYWQ9jDuw0qGIyBUeZs+8S9NMFTWPSbYZ6 7nWpNaZC68XoQbuOZZurBgla3U0x2zQDP37QsCnspr/jFi2Zol4uIo+V9XhzwJK0tYnt /a9w== 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=hKgqav8a8uS+JOYHQI8KBeK4UU43xCMXoqbNcSGFyUw=; b=POfytYgrZ1RqLErxPIQGX7JPIfIyu9zEQP/M9PiF3KHBzUpgLRK5lR7n1ZPoB44e4u n8XJKzj3p+797zGMBamMpgK26XbtXsidV8wJN/kf/vHtI6TQevQvoxhZdw/2l8+esz4T MGa9tWm+0Yccw59NPeBTcKktLkQSZDy91IkizC6twRre79xqu/oozxTrRLo3507bcR+t brU74hm/yx03B5bZYdWrPE/GHJGADTnrjQERnB7ckTHeuw99zd1Sn1HiypkCnqR1TLU4 Ew/ehM+R2z8w5kIYH7SXoDXzQF32Ka66y9LfRgpf6gcXcpgFB/lar+5H5etn1RPDN+hR fOXQ== X-Gm-Message-State: AOAM533pFy+EOJpLCrYq9aAd50rYQTgJfzrQgS5nTqzV7wUZ00B5kE9x l+DTb8wrG3O2i/DHam8ERC3A/5+LvJg= X-Google-Smtp-Source: ABdhPJx8zOHfYkUzyKpEFmy9Fj+BAxzXOZqHBn3tHFlW4guWn1rgQHHNzqejujAnyj7ZOsRsx/6BSA== X-Received: by 2002:a2e:920a:: with SMTP id k10mr25768511ljg.234.1639343028659; Sun, 12 Dec 2021 13:03:48 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03: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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 07/21] riscv: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:02:55 +0300 Message-Id: <20211212210309.9851-8-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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) =20 void machine_halt(void) { - if (pm_power_off !=3D NULL) - pm_power_off(); - else - default_power_off(); + do_kernel_power_off(); + default_power_off(); } =20 void machine_power_off(void) { - if (pm_power_off !=3D NULL) - pm_power_off(); - else - default_power_off(); + do_kernel_power_off(); + default_power_off(); } --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E1D8C433F5 for ; Sun, 12 Dec 2021 21:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229628AbhLLVT5 (ORCPT ); Sun, 12 Dec 2021 16:19:57 -0500 Received: from mail-ed1-f51.google.com ([209.85.208.51]:45590 "EHLO mail-ed1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhLLVTz (ORCPT ); Sun, 12 Dec 2021 16:19:55 -0500 Received: by mail-ed1-f51.google.com with SMTP id y12so45399380eda.12; Sun, 12 Dec 2021 13:19:54 -0800 (PST) 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=NEBfa1fMA+x5w4qEnSCEpCMUhXzxF+K5pq5bQ4oFCgw=; b=jKT5aLZfWR0wdy1ZRHa2+F5Hc16ta1np03rkr+cf27BN8zUNhbkEoAuNYpXOIawSIH 2XymTHuAk1C3VpWmhK4AsE1yb/G2IulrJt3rlG67Vh5DarQrO3/RvtCACcc9q/mrlMzG idTBdpttStFv0rFHXoDeMkKrlqiTc6LMJnuQorLtWh4hfdMc2KQqq/SPJGqZAD8cFtP7 bU0fIoQxCEwyS17dGv1ELgqsYZc+uy4iyxYp9vTtn2S36VrT7egCJ/N2pPTJk/5GCnV0 wCdVD2AV/3wMZeA5Ef+Z3RwjWWbr7SVUDzZ2VoU/BSE2RRwY2l531P1a/0YVFVmDZNjy PILQ== 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=NEBfa1fMA+x5w4qEnSCEpCMUhXzxF+K5pq5bQ4oFCgw=; b=vEJhH9pOng1cZum6rjcF2heGIwb7c3NvKJC9mYl2SPdIHaJFH6OlR6Y3ifxZJKGVgn idhX3vLFS517v1rad1goVx0P8ABIFdPeDd8jMkh7rjutUiFYN0QUJg31ROyfBVv3f80Y o0CbTzBBPQWQMZ6pz0w0zWupE+Ziq4bp6mPCQIbn55lcqjWZ0ZQcd08IStwhjOWiHcEU bDv4vtNMB6uays0fZ6miHVx029v/IQT00tA2kbvAejiHTZDGwUv4APtNTqc/8nAPKEfj EtQl6rvCmRd60GmbDp6VJzoUKuw6PwHFgjLalgSVyg51qafUc88yvnwQhfzvCcKMltin 9viA== X-Gm-Message-State: AOAM5335hKSRRTTPSG282Bwvz8r8P+NjWeyYiQEGMtOGkkMD1Zw/IIJ6 BMJfrVemK7HGXTxESo7XCg79NNTY7Mc= X-Google-Smtp-Source: ABdhPJxgpZfqxao+vFSyfTfxI+LCB5noXzLgWBaLJYSm65bPEK2lM39NLgbcPLKrE+YWXn5oNC0cUA== X-Received: by 2002:a2e:a26a:: with SMTP id k10mr25711010ljm.156.1639343030651; Sun, 12 Dec 2021 13:03:50 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03: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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 08/21] arm64: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:02:56 +0300 Message-Id: <20211212210309.9851-9-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 aacf2f5559a8..f8db031afa7d 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -110,8 +110,7 @@ void machine_power_off(void) { local_irq_disable(); smp_send_stop(); - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } =20 /* --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343068; cv=none; d=zohomail.com; s=zohoarc; b=J3SUeUQvKjEYICB7Q+6RDrbMIdlVLvRibafPLKckXOgTLeTqcm5Vo9EwIBO6tgvlWDGUc1Xav7Ky7h5U1x38vE9Etr/GRMb6lvRKonP9pwUXGZAL6lieironXeNnA91G6P2mY3UsnPoCmwXeTsA6K4eYzj2rPGFCp5hwWddBn3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343068; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qRRUcggihxuvvuxXR8avhK/eModbACqCMIG7s3bijm0=; b=NPKHlJ5PqxnqOuG9Vzbej1XlWRXWkLWoK0yyzJjj3ZZDOin0Om3Yf+Qf3ZwrP0sfGtCgjd8OoI/lPxrlvJLxxtd4E84RqG2Ybln+famKRhJVj06hYBWjvBYEZpz4VCwwpSMaDMSEYkPFfC4TPqDrs1i9aBGwkWno7rEtIvWMh60= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 163934306826559.25108801739782; Sun, 12 Dec 2021 13:04:28 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245693.423891 (Exim 4.92) (envelope-from ) id 1mwW0i-00071E-1W; Sun, 12 Dec 2021 21:03:56 +0000 Received: by outflank-mailman (output) from mailman id 245693.423891; Sun, 12 Dec 2021 21:03: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 1mwW0h-00070o-Rn; Sun, 12 Dec 2021 21:03:55 +0000 Received: by outflank-mailman (input) for mailman id 245693; Sun, 12 Dec 2021 21:03:53 +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 1mwW0f-0004MP-Kq for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:03:53 +0000 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [2a00:1450:4864:20::22a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 02e62403-5b8f-11ec-bf02-3911bdbc85ab; Sun, 12 Dec 2021 22:03:53 +0100 (CET) Received: by mail-lj1-x22a.google.com with SMTP id u22so21070826lju.7 for ; Sun, 12 Dec 2021 13:03:53 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03:52 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 02e62403-5b8f-11ec-bf02-3911bdbc85ab 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=qRRUcggihxuvvuxXR8avhK/eModbACqCMIG7s3bijm0=; b=cwgMkLRmIC5Jc7bTumRtZfdR/utOuYZMGz1d8ygkTHHtVzgzo42XHF3MxCIlHJHEyT C7LdLWylZ0pNaMDQhDT13J5l+njgSg9TNbzeMmfiPFReiWjuLN3BPKhAAriju1eHl9cw v0xZYrbokM5iV9yDxCHW4tROVpkV6lIWT7CatJGFsO5P7KMEX+3KZoYfdE3quHDnbdkY jpj2wUw+3g4R/1VtteNb23NQNkNZ2V1/PAhs7heDgq209kuV3pPkDwgZ1aWLoWFqzEEX OFHc08yxalGQachdnm1D3b45tSRQQlH3u/KkV4GShGX8mzd5qIB7iZpCyJ01mJBdqNcV pVRA== 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=qRRUcggihxuvvuxXR8avhK/eModbACqCMIG7s3bijm0=; b=7teO0EzxwUwkcGe2WDaYCrZtCaXjBP2J7yvtumDkJly1x1WSeqALz+DPPO+NYlBkFo SEdRW8iQCtzObEiDLjMo3XxR2s5G4bD8A4tb6J3my0ujPM3OusK0xTHItSFUZSU6Gap0 NUp/RHQMNBtAo11M2Zw0DxBPkDNAoiHwK4wVL/61nHqzw3Oj3Rq8eQNXpiaN6k6Pjoqw O2P+iCcg241LaevvSFeq6oZsgSc+58PwmUpvdeUbasoxTMWmQ2ngfTXOBuW+JwBrN8Se bdk+/w2QyFWv1/yIuE5Ro9k8IecfuoK722CP03D+Jpqh5obGAqLKMBrbbg8EGm4Y08qY Mh2A== X-Gm-Message-State: AOAM531e3E4FwF7hmjrAwGk3ujXlZhRmqnjvIBZtQijwv1HQUHsKIDMx rE+jwcEK3ayN0t6UJJbvOAI= X-Google-Smtp-Source: ABdhPJwkugCxrPdxtc+DUdPqlE8VTgsZlj2PXoqJkSrC88l4/tv/AsdhkMaJuxd6V34n0G6eKbJ/hw== X-Received: by 2002:a05:651c:1790:: with SMTP id bn16mr25960176ljb.475.1639343032645; Sun, 12 Dec 2021 13:03: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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 09/21] parisc: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:02:57 +0300 Message-Id: <20211212210309.9851-10-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343069441100002 Content-Type: text/plain; charset="utf-8" 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); =20 /* ipmi_poweroff may have been installed. */ - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); =09 /* It seems we have no way to power the system off via * software. The user has to press the button himself. */ --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC98EC433FE for ; Sun, 12 Dec 2021 21:20:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229768AbhLLVUj (ORCPT ); Sun, 12 Dec 2021 16:20:39 -0500 Received: from mail-lj1-f176.google.com ([209.85.208.176]:39765 "EHLO mail-lj1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbhLLVUd (ORCPT ); Sun, 12 Dec 2021 16:20:33 -0500 Received: by mail-lj1-f176.google.com with SMTP id m12so21153736ljj.6; Sun, 12 Dec 2021 13:20:31 -0800 (PST) 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=cQhCUMmxREqlb3fYFdUNP+80Jr1xwOUlupNd5E99mX4=; b=kywzoc+Gi7wLNuBk90TEKZW85IC/6URmBmQrI58bAL/QPFhT2prlCmlNeb9T8eY7Ic kaAzgc8G/0LgoIzVYO1QktoG7vKpxJJBnuwLoDt+HIA67HN4VctOi7XqEXlw6RTgsmNB 9ZzMbAWCGvmSWTdelcaOM9EwDKrMUtEbXlVABEMzzEb6IxT5HrFIy/s6X4Z2D3yGz8be G89ttBkdlIOUOuEDpB9kv6rMon8ZyAqpnzA7ZSWI952xKubMgQPGXFJ+ne9aWLwQTENu ihN9SLyYypvBOVyotduA1RjOzW4Dvoz4sPrRK/VW5mbeHSEzk4q7EP/uMXmylA99SqQI TI5Q== 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=cQhCUMmxREqlb3fYFdUNP+80Jr1xwOUlupNd5E99mX4=; b=KGGkoZrCLbcIVm/CCH/60AJOIcyZ8rXfHjFUlOqqFwoP9r1Rb7WervKjZ+CvelB/TT S8TeQCcRHA1MMsotfhgLUvLB7fZc/TQI7HtE4oyLpnlMgyN1IHaXcJWf1n/2DU1bWCCc yi6bU9iqfeh8t9eNM6Hy7I+xMs3BbkrgMJSzrCNKTtxDuWlfzlfw69BFKpdv7E4dh9xO dgHBZJ5jxmFe4ebtsQeE3cJvYmq6Y8lilRHv/QKSXgZBLpKDecWbMcP65dNObLBZUDWo Q6iLNKd0mYttlaxxPJamugqkuxki9hJc84p9UxdJ7qU6TBT+rdWPNC/AMnxTmueHL4EB sCtw== X-Gm-Message-State: AOAM530/9maVLlbKtBXR/jYB5qbUPSs2hUkqTAA3IbGJiEBiMapyQYKg U5QE4lDL7LbGfvbIcXkz9VG0xasaOEw= X-Google-Smtp-Source: ABdhPJwPHg+2Pz2/BonOuvJzDEEvGDrSlS58FJbScCfLgCTS8nGeJYv4KFLQDU4sli93Hwi7CmGl0g== X-Received: by 2002:a2e:a176:: with SMTP id u22mr26407140ljl.116.1639343034642; Sun, 12 Dec 2021 13:03:54 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03: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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 10/21] xen/x86: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:02:58 +0300 Message-Id: <20211212210309.9851-11-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =20 #include #include @@ -1068,8 +1069,7 @@ static void xen_machine_halt(void) =20 static void xen_machine_power_off(void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); xen_reboot(SHUTDOWN_poweroff); } =20 --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343070; cv=none; d=zohomail.com; s=zohoarc; b=HZMpMgItjo9gPsVvGyMTuX1kPCXR0kccl9WfC3eKmJGqgN4C9jZkLEg5eV57JgvqBaELOBz56CI3YwFyWtD6KQZgUfw1ASsDCLe2ARCa2s0knp0z2ZsAyHNy1JLJWt01x/CpECRWxTj/wbAwDVfT/9wghSTputMdmZdX7vUsvcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343070; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SHhUp08VE2ztEefsMlISnf3ubNnW0z005TmsLrFHcW4=; b=MNzm2bxvImI3V6wKojNPNTNShsusiahaEntmuJeX9zk9DBPZKEf0qFlBP/MXVdl/n2m1yd6ShNyYodnkrS+voalmyHue1dl+2r1ZlwfLYE1K5TRC7+tjv48IkV46cq5QcSuGADCpx1FGzSGxvsaMO29FhNfB8mbhjBAFK2Z24Bw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639343070523313.1858886361863; Sun, 12 Dec 2021 13:04:30 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245695.423909 (Exim 4.92) (envelope-from ) id 1mwW0l-0007pa-77; Sun, 12 Dec 2021 21:03:59 +0000 Received: by outflank-mailman (output) from mailman id 245695.423909; Sun, 12 Dec 2021 21:03:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mwW0l-0007oj-2x; Sun, 12 Dec 2021 21:03:59 +0000 Received: by outflank-mailman (input) for mailman id 245695; Sun, 12 Dec 2021 21:03:58 +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 1mwW0j-0004MP-Q8 for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:03:57 +0000 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [2a00:1450:4864:20::236]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 056642a1-5b8f-11ec-bf02-3911bdbc85ab; Sun, 12 Dec 2021 22:03:57 +0100 (CET) Received: by mail-lj1-x236.google.com with SMTP id k23so21156093lje.1 for ; Sun, 12 Dec 2021 13:03:57 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03:56 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 056642a1-5b8f-11ec-bf02-3911bdbc85ab 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=SHhUp08VE2ztEefsMlISnf3ubNnW0z005TmsLrFHcW4=; b=M4kpDtgNg/HMIKnHemPbZaAlzhr0ntsevGanXWQ4n3yWnl//f+XQDu5U2Ja/bsZBLw ZB7lG6HNkYZjH8rldh7wQZsaGJBaC4h0p4AT21fuNpchnkBJWm9NM9UGwpzaKojZCS7y bTuVH9eWn0ocvLyPuLVpNAy1ngP0f11Fg78Z4AEVGIk7G8QbthlbgjrYXuLAU498OxT8 bgCN/dHbI9hpQ/7EtqeytCSL7rK/H+myVWm8Se1R6C2Q4UDGC7MvllRFkeixGbQendIJ yK+CRe2KyF+IJR5cBcrAOj9h551rxSL2ZajWGRFkc4kB3fO9UCnd3vhKtJZ1+yX50+HP yKJg== 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=SHhUp08VE2ztEefsMlISnf3ubNnW0z005TmsLrFHcW4=; b=7BaVt+eWhvNZ+odlwBOuaD10+l5jg3MkMWg9++OGA7NT4g08F7QrTbiZ1c5ieOQq2F 8dOnC8aAUzhiRTh8/BlSDIUoL4WCmxspY8NQFyZxo+GT39+LqECQhI3FDSv6SEkuX6Cn pg9Hf8D4Hz7xzclibzhZ3GV501VOIrzNzLVCZKLby5p63F69GhcgXiKYhfPRk0LhDF1a uLvZF2qbe6x0zkhGZxJhXmBJgxEghWUZG04DLqWprZcJXQaVtvVbur6Ys2fU3vfO4XzD tfu3GZ5XQrgz8KdWaVZcdT+uOB6gVNKH2UDBN9At+6Mq6R+X1Wh03dqfn5jbZ7uX19YN fZbQ== X-Gm-Message-State: AOAM532dpRNDzy0jDShzXcnuK0huJiWXPF8qvR6P7jkUEWopZI3I/j2p RqapMhKbGKnkC4H44RNORQ4= X-Google-Smtp-Source: ABdhPJz8R3Mq1R/xI8IHeAv3OrqV+OEyi8dYUIUI01foRIKaOY1/e4KcpBxYoYjyrD2YWzDb+CaShQ== X-Received: by 2002:a2e:bf1e:: with SMTP id c30mr19020669ljr.408.1639343036846; Sun, 12 Dec 2021 13:03: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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 11/21] powerpc: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:02:59 +0300 Message-Id: <20211212210309.9851-12-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343071763100001 Content-Type: text/plain; charset="utf-8" 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 83100c6524cc..759e167704e6 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -1243,8 +1243,7 @@ static void bootcmds(void) } else if (cmd =3D=3D 'h') { ppc_md.halt(); } else if (cmd =3D=3D 'p') { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } } =20 --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343078; cv=none; d=zohomail.com; s=zohoarc; b=hqEH/dh5r1D3uBoedUKMisMIm+VE1uK1HHgnQ9TSd2FNwhg74pLt7g/kBDen4TAbz9QGLfqyNIm9/eMBRecI+o/YP43cN/rwGnKgX6rtSjk5Wnfm8tVewDUi7Zsmi6KSjRq3MzAyYsb0ze7NmssgGj+p/Fxd5UVb3a/I2ls8oO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343078; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wYDTQaETrXPItP1/JDli7ai+6XwIrQRRYJAIL5Q83WI=; b=gYxS/uiMMetq+T/+Xz/gczpUJCHMAhnMlEl9yKLyOg61iGRIpl+ae/U5Krg8ntaT/Mi3TYgqItTeB0MommWFHZv0XxF9ItYJVB7iraV6QRNbAQJW3Eu7chhYiN1KLqZlI81ujUfu3DiC7GxNS8rOFIDQGhgHHL+c6sWgMBsoW9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16393430779951.4057729606754492; Sun, 12 Dec 2021 13:04:37 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245696.423924 (Exim 4.92) (envelope-from ) id 1mwW0n-0008Um-S1; Sun, 12 Dec 2021 21:04:01 +0000 Received: by outflank-mailman (output) from mailman id 245696.423924; Sun, 12 Dec 2021 21:04:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mwW0n-0008UL-Kr; Sun, 12 Dec 2021 21:04:01 +0000 Received: by outflank-mailman (input) for mailman id 245696; Sun, 12 Dec 2021 21:04: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 1mwW0m-0004MP-2J for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:04:00 +0000 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [2a00:1450:4864:20::234]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 06a8a1d9-5b8f-11ec-bf02-3911bdbc85ab; Sun, 12 Dec 2021 22:03:59 +0100 (CET) Received: by mail-lj1-x234.google.com with SMTP id bn20so21108649ljb.8 for ; Sun, 12 Dec 2021 13:03:59 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:03:58 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 06a8a1d9-5b8f-11ec-bf02-3911bdbc85ab 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=wYDTQaETrXPItP1/JDli7ai+6XwIrQRRYJAIL5Q83WI=; b=mytm/DccZ1wzLV8XTmme10BTi4beUxZb3ysJUV5xYL3KUNdI6UIdOg14PI4Xf14XxI 7c+v89VpWLB0ZUhSuYpai3wHhN1WGcKOGbWxhGz9tr3OzP6swV60YcA1Wv5ZjDbMnKUa xazlSiI4jIde5eD9wVDd3hacMA1401SIHTIVPK4datO44ZlP1Doly3s0Wmv47NPuWclC 2Crdjrp9htA7LHc95eECzQ1s6YjHoLBwAjSAcevyU9K8Sfc578kND8lSRu7vK9feHITf xRYypJ8GB6uZ0ZKBDnu+9y0H6KT0THCoLFcjbrxfymTRhYWqXWoS+2dhJR4JAajg0Zvg IWnw== 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=wYDTQaETrXPItP1/JDli7ai+6XwIrQRRYJAIL5Q83WI=; b=mRY650nPKbN6dCfLvkYPbHJdOInnB2cHwOkO066udMbNt+KuJeJajudEbkwOzUjxtD cPBIpEXjeYCm2yRqvaFPVj3wjIcWB8PAj8VVNjXOsBFwuH3NtT/7Xgy3dZ1kO28TyP98 Y3zKTmCGib60ls2kW1hRSaclolHodPsWHsUYy7uGsiiHwZwTzodyFmUvhHCczrJMV/fl 7wfHIZMKcOQ/iyHhZSNbGBtwsm/K22xAlZG4kfPmCStQPTKghz0Ivg6qkVmhUTXj/vUk q5klIRQz2O5xtVJWsB/QNrYY0KJeVed8Uo8sdKUWNBU5YRYJPsaZq2Y/z0gweoOJdFuJ UfHA== X-Gm-Message-State: AOAM530l6zHzRVmAIn58LyMtWzraE5Dxs8Qlovv3uV5s+CImrjauVLF3 x3vNAtk2wCfv+a4mZOa8Xqc= X-Google-Smtp-Source: ABdhPJyb60LD2qugqos2h5QyxI/abab2bR0WoFiHVAsfElgYVMLf1BWWm1ZERTHxaqoQ3zC4K8Hjug== X-Received: by 2002:a2e:a238:: with SMTP id i24mr25511659ljm.296.1639343038939; Sun, 12 Dec 2021 13:03: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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 12/21] m68k: Switch to new sys-off handler API Date: Mon, 13 Dec 2021 00:03:00 +0300 Message-Id: <20211212210309.9851-13-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343078534100001 Content-Type: text/plain; charset="utf-8" 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); =20 - mach_power_off =3D nf_poweroff; + register_platform_power_off(nf_poweroff); } diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machde= p.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) =20 void machine_power_off(void) { - if (mach_power_off) - mach_power_off(); + do_kernel_power_off(); for (;;); } =20 -void (*pm_power_off)(void) =3D machine_power_off; +void (*pm_power_off)(void); EXPORT_SYMBOL(pm_power_off); =20 void show_regs(struct pt_regs * regs) diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 49e573b94326..a3ff1342ced7 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); =20 #ifdef CONFIG_M68000 #if defined(CONFIG_M68328) diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 5d16f9b47aa9..727320dedf08 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -12,6 +12,7 @@ =20 #include #include +#include #include #include #include @@ -139,7 +140,6 @@ void __init config_mac(void) mach_hwclk =3D mac_hwclk; mach_reset =3D mac_reset; mach_halt =3D mac_poweroff; - mach_power_off =3D mac_poweroff; #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP) mach_beep =3D mac_mksound; #endif @@ -159,6 +159,8 @@ void __init config_mac(void) =20 if (macintosh_config->ident =3D=3D MAC_MODEL_IICI) mach_l2_flush =3D via_l2_flush; + + register_platform_power_off(mac_poweroff); } =20 =20 --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343075; cv=none; d=zohomail.com; s=zohoarc; b=J6NvD8d5cUQlg2IP1emJARVi0/FL0sZMCddmFtqOdQNBHyrZdXeYQcBmmDBhsGrS7k4FS0hU3xGN9EEoFLNtQlWIskkU0o1FeNH0mN4FEnTgtjKnEUf/WDAWa6wp/k2znYnCC6OC4tTE4TYmhkl6wUBPxQs+I8qFpLni3Svm0Bc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343075; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=032w538UVpeATjNmIAIpxMVbSRQ+KkFSikcjH52Go7E=; b=gL7otf2aIcKBe6Pgx4K9vQkES7VsNkaeHS9pUh/qeR/dN15RgLd+5lbXGs4wKyWNHhHx+Y2GRFivwmNDtx4ysV0RekSLo0s7T95cafvxowKkFgOKvWdswNtB6ZtPfYeh0JLa872gnmJgdszbs/P/9lTat+WW4NvIUcht4J3LYt4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639343075424267.72211142859874; Sun, 12 Dec 2021 13:04:35 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245697.423935 (Exim 4.92) (envelope-from ) id 1mwW0q-0000jW-8g; Sun, 12 Dec 2021 21:04:04 +0000 Received: by outflank-mailman (output) from mailman id 245697.423935; Sun, 12 Dec 2021 21:04:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mwW0q-0000i8-1Z; Sun, 12 Dec 2021 21:04:04 +0000 Received: by outflank-mailman (input) for mailman id 245697; Sun, 12 Dec 2021 21:04:02 +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 1mwW0n-0004MP-Ql for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:04:01 +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 07cddede-5b8f-11ec-bf02-3911bdbc85ab; Sun, 12 Dec 2021 22:04:01 +0100 (CET) Received: by mail-lf1-x12d.google.com with SMTP id k37so27531981lfv.3 for ; Sun, 12 Dec 2021 13:04:01 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:00 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 07cddede-5b8f-11ec-bf02-3911bdbc85ab 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=032w538UVpeATjNmIAIpxMVbSRQ+KkFSikcjH52Go7E=; b=E9VJGzDO/MjlF9k/luR3Khbhy1NPRGJFu45WGR11yv2Csut15VlFqb3GxfyXiC5K1R KoOjuPxJ74P0WBK6P5Rh4Yk8N3YLtFpHfuaNjG/nuh/tfSGU3NqTk9edZfzSNHKBOR8m kPzSD7yXn2hiHnOuT2WH4wXsn02tbX247vyP+WAbNdjC41aD7suYMkTSBhHb57suBLzg JDCdqG/x0ozFIiafXt1VhOC6hig+lrppFxitm7BNJIhU1ULZzUrjdQMODUqHIbHIv5lc HP4HR2RELBXIYyMaOYQnB3LyrgNZPo6J89xd7q/RgqqbviF8jrhJU82mQviA1Jb3TY/T AUjg== 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=032w538UVpeATjNmIAIpxMVbSRQ+KkFSikcjH52Go7E=; b=lOqYVzoZqrbYJPXjkkZ9mxfOS/0zrE7dWflhtmQjAiF8M/z48lFi7JwJGG56K7nXYE PUQHJR4hYz8H/32+TnrousBSfrZJfFdESQFeKwbmx6ziDVxE9NsT3SOiKeTMT9jZpXER sa+7HkUUtpU9JCh0hSLZJtBQFNpTUeu40GKEXRhNjx2adU+Xi16cmCYi89Zkq+nEddIa FHzO5M6Y5DpEa0ZQGKLqIHZh5dqH1m1AaluX4xwea6WJXurZjcau/ruicgm2Mnyyyzr4 nk2S0m/n2emVEftWzEqfR1tOjwtuUnHJwzinsyebK2KmuCTzT+j5B+qiZ1fVaqpd2DX4 Vglg== X-Gm-Message-State: AOAM531Lu0UPl7Y3AstgUSfweVRgNKisPBYQWlLRw4qKsezAb6e7hm5U 414CjozpuY0jY0CR/EhREEI= X-Google-Smtp-Source: ABdhPJxUkKeqtg/YDWyN+6uH7IPe04t5eV8J/9ZVzn0URaLN05uRJEwSyylEX1JQ9jfzKVs+jpVePw== X-Received: by 2002:a19:5e59:: with SMTP id z25mr25760424lfi.686.1639343040878; Sun, 12 Dec 2021 13:04:00 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 13/21] sh: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:03:01 +0300 Message-Id: <20211212210309.9851-14-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343076225100003 Content-Type: text/plain; charset="utf-8" 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) =20 static void native_machine_power_off(void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } =20 static void native_machine_halt(void) --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343084; cv=none; d=zohomail.com; s=zohoarc; b=apIKt6KaSOmZJXZHb5MPtouj3IkpG2N2GABYIFTVaAyprkC8cBVsHKFqGKvWRgUSxDGKv0wZ8y8mhFdSbhvTWaTJDyd29hfo2V6CMhUop8lUYvn42ainFczZbjaHtQk0wN34jnPt0AJ/N0B1Dzn4prKrM1D5RElQKIbpXFlW898= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343084; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fPDqjeCYEjf+DN+kHXgg7jNjsfy3nUCqOTZJ2Nh3G0E=; b=jvt7ljNNXQFv7DVxJdSOOO+YoCZJYUe4F8nz4jlearii1DocJlvtmnTbKJaH+KkzcBRMMiuA8i18Dchpi+Ns0PKv5oA6BI/Ygo40msehgL4tIfAI+I/U+GXmMyS2NRczdRvjLqVePdXJNCidswLZ58YlGN/jwDiC/6YNyf+03HI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639343084615120.00039525211889; Sun, 12 Dec 2021 13:04:44 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245702.423946 (Exim 4.92) (envelope-from ) id 1mwW0u-0001RD-2c; Sun, 12 Dec 2021 21:04:08 +0000 Received: by outflank-mailman (output) from mailman id 245702.423946; Sun, 12 Dec 2021 21:04:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mwW0t-0001Qu-S9; Sun, 12 Dec 2021 21:04:07 +0000 Received: by outflank-mailman (input) for mailman id 245702; Sun, 12 Dec 2021 21:04:06 +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 1mwW0r-0004BS-Ri for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:04:05 +0000 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [2a00:1450:4864:20::232]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 08ed80b2-5b8f-11ec-a74f-db008197e53d; Sun, 12 Dec 2021 22:04:03 +0100 (CET) Received: by mail-lj1-x232.google.com with SMTP id l7so21133590lja.2 for ; Sun, 12 Dec 2021 13:04:03 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.04.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:02 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 08ed80b2-5b8f-11ec-a74f-db008197e53d 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=fPDqjeCYEjf+DN+kHXgg7jNjsfy3nUCqOTZJ2Nh3G0E=; b=TVIdD68VWfHsQ5jfaqSICSZ1qOhZrUFA9mWdz6ePQHL1xqpH2YdGrbEBaLFkC7gIb8 G5GVUsLpR7P9l8w4HUpnC9ENPDSIvCHlKYXxYDYBXpjfkLcAfFSnbF/TqDYZgNg+yp5d Pc9NdSlFwAt6HBoJA0bEg6oNgazZ4MeI6QmLhlMAROr2y9LwyzEcdRy2/Nl8fcUK+gJw 4Z7GIu+SBSKJVBNrWt7sUDuuqAeIyNHaS//f1hsWBDWkktlu2hisD12FQFYSkR29TAJT LH1R9Pot7fCnjrbI8+c1sLGDG1QxcUxmHT1viqhxlbpmcYRwfmC1bTbrrOdOZDH6A81E Mb/g== 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=fPDqjeCYEjf+DN+kHXgg7jNjsfy3nUCqOTZJ2Nh3G0E=; b=EozWdn/V8uZD09Am5sFoAxTpYuQhwgEnz0zl3o4HUoi6mDdb60/QUhJpnXTNiA5qNO bpRe1B1ncOJAwlca2V4hsugLOKlh9PrjhaT8+svFjdHYcXoZE9tNb3J99fu+WdVfqz99 ZHRA9yVhRE0jCbaEZ+X+Re+KBPoFmlDWXuDOTb6/GHHjD7criBZUOWnThsqxhDYLuauG uY3kLKyiPq6pEf8OeOvAMyGmVOPRPM33Jg28cmX+VzvZsnJEZmyz8OiXYO/VWzXtzp9V Kjnd3c9+3za9VK6m1qFppbb5TOkUMF4kI+qQxZ5iWjQ+PvOwaYdfayLng4PeLQlCvDgO XNDA== X-Gm-Message-State: AOAM531Qi/+ia+LHYnnHq2TmGEDEQtiWSkIWV5btZ33JiTNyA/2Exibb +SQ2XLuf7GIvF5nA6b9UKYQ= X-Google-Smtp-Source: ABdhPJxIWfLkEULnkeRFIBU63iisgF81a9TeLyav941iTQFUBwsy8Hw5dIc9QJtmQkp/rhphX9SNLQ== X-Received: by 2002:a2e:9698:: with SMTP id q24mr26147048lji.246.1639343042868; Sun, 12 Dec 2021 13:04:02 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 14/21] x86: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:03:02 +0300 Message-Id: <20211212210309.9851-15-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343086928100001 Content-Type: text/plain; charset="utf-8" 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) =20 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); --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD3B0C433FE for ; Sun, 12 Dec 2021 21:21:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbhLLVVZ (ORCPT ); Sun, 12 Dec 2021 16:21:25 -0500 Received: from mail-lj1-f171.google.com ([209.85.208.171]:36617 "EHLO mail-lj1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbhLLVVS (ORCPT ); Sun, 12 Dec 2021 16:21:18 -0500 Received: by mail-lj1-f171.google.com with SMTP id i63so21157787lji.3; Sun, 12 Dec 2021 13:21:15 -0800 (PST) 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=jIixMSKlDuHM/ROsyXYWDI0GhGtBfDPAGuo/NFEP3H8=; b=hrGVAHE56JpFf7T1U0arv4PmuX7CbiQ1yLnbkKYuXMHBz+H3yb3VN2/nIyUDqephff QqKz1o3ksHyfMD3DtBk4DYltiAcjPD5RzT6wcBtuIMufZ2IM1Vel7z+a1Exa8MHUOxuI Dt4mQ6Vnuxs5g7ALA4qb9IZybJQfrWTEvo8JdYZtrfc8/kHvvuQX3Pn7PZtd57VOGXgj 0YqHm4SASgoJmXMLGsZ/pIqqXI/HfsjVI1++/o/84XkQkMqRzS2O9gDjhujVp11R8QEK S6qzjMGucoD6LjpSZw60nGaKCWanFs77owbTLZZY3Or/CEpJJw8lyGS/ALFLDgBppTYT hA9w== 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=jIixMSKlDuHM/ROsyXYWDI0GhGtBfDPAGuo/NFEP3H8=; b=M3wFdZR0oMqbbbATa4wgwZzCHHh/7sPnLZ+AjURhTFnTDbNZ6OysHglOz/kABov4L9 zNtEhGbmfI6R4mfpxEvm97wkoRlzLz0F7qdvo/OcTr2CxB+cumHT2ioLMGCD32ek4JY0 LKZeiVY5JNDljslmCEAqR/IUjde9yV76acZsyTmm9p8HqquKFdFXDmOUDpRU6lwpR8Ad qyrSGoQ8BGiXq2nVohCDoyvhoxJi0y6yzjRXxGmXemCpW8jOFs8z4YMTN2cMZN+st34a DdrJvh0qa7k9bQFLixjvHM/WlQDr8YGAL6J7qCbZa60AJSLgyIxwyJTBMY0LQwti1F0q hUHg== X-Gm-Message-State: AOAM531bSvbIOTMzekdMI/ogbneKstsBcZOo5awBCp7WqQ4OTOpjAghu XoYMSq7hNQo8Lhra0dq3HGkDPul5JZk= X-Google-Smtp-Source: ABdhPJyGhLtLr0TWgn93QxuZFfYOb4V/87m+HVEQhOkYVUOBLQiR21oi6QbMq+Q/ve+fVLOCMbRPCw== X-Received: by 2002:a05:6512:3048:: with SMTP id b8mr25740519lfb.677.1639343044820; Sun, 12 Dec 2021 13:04:04 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:04 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 15/21] ia64: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:03:03 +0300 Message-Id: <20211212210309.9851-16-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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(); } =20 --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2CF7C433FE for ; Sun, 12 Dec 2021 21:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbhLLVVe (ORCPT ); Sun, 12 Dec 2021 16:21:34 -0500 Received: from mail-lf1-f48.google.com ([209.85.167.48]:44621 "EHLO mail-lf1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbhLLVVX (ORCPT ); Sun, 12 Dec 2021 16:21:23 -0500 Received: by mail-lf1-f48.google.com with SMTP id z7so27437939lfi.11; Sun, 12 Dec 2021 13:21:19 -0800 (PST) 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=Cc0IUGWHitJ0Cooyguk/vAdy9iAEtCRPuqNtfJHYmrA=; b=Q/c1xA4uTfURNpesTFDEluAGeukAv0A39h1++QrnHKHB/Wx+jD9uvH8v63QIbUTx/0 +6rR5eBZFCFfLub5tT4XZSawg+QmuNCEsjrKd9tJnYsJi7NapchhtdTTw5BZoWSvXNqZ 6qalX/P65Sx1m+OSvepBjdrlXRB10kpIkI8l0kGvB4dwAOxWvQSYyQVUabX2ElBpn+NL 9XDYXpgHW6Qi4N2A46fFgcC634zKj6WeJBReRhrYc+nPBcEHLfR4bNetpt3CSzMg8EgJ 8HNfo2NJArfFto2I2XSFuYiZIyXwvuRmtRKx9vRDmnjHIRre5YAsG7Vp/31CfQv6ggAb qrCA== 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=Cc0IUGWHitJ0Cooyguk/vAdy9iAEtCRPuqNtfJHYmrA=; b=xfCK99JyAdlIhSG6hOoOPHuD1GFhIW8vxTT0535uj6MWsoEU2OtxSY04fBS5CorI7n pumfNXttdARKeKk0xJ1RrVczRuzFVL+ODl6g7oQcB7mO9Tl4Y5hoE0/tTxSRgfdivG60 mIUAhCzZY+eOyN5lZ5N7GtSYXa33a+YWtpMJOElMfOKD70YMJxZIxqNE/QuqP18ivYQb NWnn12p6GAqZWZECBCfyrVA68TZU00K7x8+3KfIDzdFcGbh8IPAzk2vjXQfrOGH3TUqY p3QeQH9hhfNs9TZrEX321QR5m+GFze8MDpBlKpS2eCu4y5x6Cmn723wXPCzHVTmwX2jG I+oA== X-Gm-Message-State: AOAM532RXJhPx9z0Lx4yvZYSqGtdLRfgV+JKD3Nc0p1IVytx/FDVlllQ dfPOOe9uycO6/DNzjy5ZZkSLEnDh6IM= X-Google-Smtp-Source: ABdhPJy9fCaXc17ytJafsM7AkKSnE1Az22GGN1LbVGAjsgQu/yV7EBxctgRg/qU3ELcpWZOjbb6Yyw== X-Received: by 2002:a2e:a58d:: with SMTP id m13mr26702958ljp.281.1639343046781; Sun, 12 Dec 2021 13:04:06 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:06 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 16/21] mips: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:03:04 +0300 Message-Id: <20211212210309.9851-17-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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) =20 void machine_power_off(void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); =20 #ifdef CONFIG_SMP preempt_disable(); --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C754C433EF for ; Sun, 12 Dec 2021 21:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230198AbhLLVVk (ORCPT ); Sun, 12 Dec 2021 16:21:40 -0500 Received: from mail-wr1-f43.google.com ([209.85.221.43]:38513 "EHLO mail-wr1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbhLLVVZ (ORCPT ); Sun, 12 Dec 2021 16:21:25 -0500 Received: by mail-wr1-f43.google.com with SMTP id q3so24006272wru.5; Sun, 12 Dec 2021 13:21:23 -0800 (PST) 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=IgdEY3brdUGAcbkVUTuopyRaDKQjmT9IOiG4donLZPs=; b=pRjCeelZEbxaZGwO+A2aL0XPV/VaH02YaHpKAd9wdI9JEveM57sE60GJ6XNHSn3X7R 3k3prwg00aYmbn6qrs0hvCC/Qu+NXBudxBQ11zdQ8NwOHe1318/leMZcgjGjBHY51gwa 7soXg88k1YVhJkGc+TTtq+bVpeCDRCSSMfOlkqSinKAC0bda9LJdWsfx6/W5MHM5/jd9 DvPUXfjXzCMkaPG3Qy81MLfolhXJsYt+NP13KnN+kkNkRrGfJb6pVBACzy9He8+wQu/l eGVwkctUMedEHbT7ecy6K+YGcbliElewyWmMiaaA91DPydKzN7z1nc6/16QB5Y1JZoWn FbWg== 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=IgdEY3brdUGAcbkVUTuopyRaDKQjmT9IOiG4donLZPs=; b=BNji9A18XoereYMl78hT+1/hZLFd8eXjgY/FiEtQY/RjFyHWptzM9eRbeOo1IOS0qR lRD1f9XElTm20pCSOp1VVh7L4xPAhzarH60UDNFnuVuEMaWm3e0BI984WcEVg2WHfmsI ahMOTLACA4o0qyUaxFJIIzD7AjBzGjJM4ib4rgZncRicuHaroOC14bKlsUps/PnjDRVG TM1tsm2RUkvyk2iNrEokqNwZ6/bRLNgDGHnCUFReiHKbJWqDFgjBDy/0U44RoTGNK8Hl hFnnVlazYkER4ndYeBNjmDdYS2YTmvH61O+7a3871fvTRRwtnNIXmuwb/Fo7vF9MxT+P SVvg== X-Gm-Message-State: AOAM530RlmzdwQeYNqq1GZ4/9DG3nsmpEWczYcOiqamWD3bRsqVm+YGc bCfz923X3+yKfg6cTPq6gf8k/Kov/Rs= X-Google-Smtp-Source: ABdhPJxNW1DwCShpX2NDWOWr5vcKraTuFYIWDWgUXB6EPWJrHuuBITafm/NNerVkSN6nEKqLT69IWQ== X-Received: by 2002:a05:651c:1548:: with SMTP id y8mr25360872ljp.458.1639343048830; Sun, 12 Dec 2021 13:04:08 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:08 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 17/21] nds32: Use do_kernel_power_off() Date: Mon, 13 Dec 2021 00:03:05 +0300 Message-Id: <20211212210309.9851-18-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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); =20 void machine_power_off(void) { - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } =20 EXPORT_SYMBOL(machine_power_off); --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CE5BC433EF for ; Sun, 12 Dec 2021 21:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230206AbhLLVVp (ORCPT ); Sun, 12 Dec 2021 16:21:45 -0500 Received: from mail-wr1-f51.google.com ([209.85.221.51]:46842 "EHLO mail-wr1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbhLLVVb (ORCPT ); Sun, 12 Dec 2021 16:21:31 -0500 Received: by mail-wr1-f51.google.com with SMTP id u1so23923519wru.13; Sun, 12 Dec 2021 13:21:28 -0800 (PST) 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=4OWbCpLiTrW70NMTPpPUNVkhVF3RKPzG5GTofMVph+0=; b=KgzHDaKUCbKSzVVjVjmP8+sBh8yyTFGc8g32/L/CqZTtjWU+bl67DHnRCd096H4QyH 6s4XOaSGluQwDgc+dVmKnqKu1D7kSOhEjlXrEzrtwcZ2Q6khYOCVFkcX7gyuAZCct8/o GKaOjDdP1N1PLFZ+aDWpcbp7dkWsptVMtN5cNX5Hej6TAysWP7q7s3LkbwdIKifJDLbq DBlq13uFhfg89fXWqsQEKQJP8QIWXrM83lSZp9pz62Oox2A9TL+0X7jecCTLs4sLY0eR bZA+EOxHV1IPmvWGQHGHMNaccJSqcUQnYi94Tz8pclaCBQOzvYQS90AbFrJ5VYVBqIZo 1x1w== 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=4OWbCpLiTrW70NMTPpPUNVkhVF3RKPzG5GTofMVph+0=; b=jI9Po3ugR+qOkzj7z3oMc2qhfkE21z0GlmAd2RthvnmpRUZk74UeXxJNdNaydw94wZ 06eZAnB2npID95834q9wetoYl7fupaGPeicB7VC9u2koQHyA36wF6JxNwRnP3quYlFfb /3El9Xu2EvckcRQobLaHHcBeNwkqAalb1czDCMDHaXWsx4kF8sAEFHcu29rRsb09Y44a 5TPaNHmxDTZ0YeCOEuJK8mCp8NtwXDYPjNlqGLZsvQCAdo23WAcIDxEdZ25YjbeZ1hl9 wV31mwKAGmhLP/ghjpWdx00NTfbwdZuh8sXBepmy7HZB7Uiqfpc3XX3eKmtBgQHGaufi l0HA== X-Gm-Message-State: AOAM530hrC+tOlfHGWt0CfFjYvZFt20ZoUX6pBE0kElyLoifHVVrF/XF 9fmJc0wiej0m5mnnbwmTcONFZhHab2U= X-Google-Smtp-Source: ABdhPJxwwoHkHissmQJung57FYrMejLUuN6r2Ie17E9nwn+nZNJljq8V97ncmJiBjB/DC7TeE+2SdQ== X-Received: by 2002:a2e:a78e:: with SMTP id c14mr26639117ljf.162.1639343050805; Sun, 12 Dec 2021 13:04:10 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:10 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 18/21] memory: emif: Use kernel_can_power_off() Date: Mon, 13 Dec 2021 00:03:06 +0300 Message-Id: <20211212210309.9851-19-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Replace legacy pm_power_off with kernel_can_power_off() helper that is aware about chained power-off handlers. Signed-off-by: Dmitry Osipenko --- 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"); =20 /* 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"); --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28333C43219 for ; Sun, 12 Dec 2021 21:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbhLLVU2 (ORCPT ); Sun, 12 Dec 2021 16:20:28 -0500 Received: from mail-wr1-f54.google.com ([209.85.221.54]:41818 "EHLO mail-wr1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbhLLVUZ (ORCPT ); Sun, 12 Dec 2021 16:20:25 -0500 Received: by mail-wr1-f54.google.com with SMTP id a9so23987207wrr.8; Sun, 12 Dec 2021 13:20:23 -0800 (PST) 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=mfpn4GjmPLTNTnhqDUdqufcuPWBAqiXi1zu9JyEbhbk=; b=W//sZogq5DTrQ+VT0kVHAjKsMJjonmiTqPPUjDT4t1ux8CgKvrkOa9X6q03Nt3iZO1 vK/CUo6x7lvuguglmwFE90u1GLXTECmpRMuaG+fr/E6/qyGV8EkU6v+kDK+V7uptl/wb HR4Vmw8wUQIABJOLJFGHdK+fNltSfOyFeExxxDa+sfUUZdkfFyFDhmbRR41HvO1R/q2F QgB34LqslNlnmvIz0QFHIdfbw4raMLU07LE3ousDHeswLZ4GtLDTJS47wVIBYkWvvQPk nOdfyMtdzf0521x2E8c6ZMEWXW3EHh5oerHQGQm9FvsWNypd0dn/oX5dpjU5q537TqNc uvCw== 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=mfpn4GjmPLTNTnhqDUdqufcuPWBAqiXi1zu9JyEbhbk=; b=tktS6s+0H9eamPVVfvZ58bmNaeGLALuYH7osNy1HHYMoO438LaX8RwFIxw18chxDH/ K2q9XuIeyt1d6ovYUCMNIXAsyR2ee8n4xZScXYOTNSsLcisgnrFPgSWJH52PNCui/UjW KoIMuzaf9CgI7TBR6aVFPfCAriMyYPhmXcqQWcPB4JmeHykJJgz9pSctmTr/hDvMm9ni zxIIRwdySDKwt0FLKIZM7zbOFcX4VcFEsZK68hEmQSio703AQP5aoO0NVU3SdnnrCcVe Xz40rbs+6PSmIhm5XtRap1AcbckeKE1zFy24tVOM5VMHAon/u3OP10j7A7zF4GOL2+In 87Bg== X-Gm-Message-State: AOAM533opI8988FfcZzhyZNNhfIHyBFwTc5RcfElaCL81exFFSjzSeyy gH+WmyJ31JZftF66LHh20A4Xgdjxpv0= X-Google-Smtp-Source: ABdhPJwCwIZWVbs7nRVgDCTh6EM5kFQafVa6fCQVhsWFKnxKFFWHHHKvo3sGM1T0VAQ3LX+X9OwfMQ== X-Received: by 2002:ac2:4555:: with SMTP id j21mr25986961lfm.120.1639343052782; Sun, 12 Dec 2021 13:04:12 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:12 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 19/21] ACPI: power: Switch to sys-off handler API Date: Mon, 13 Dec 2021 00:03:07 +0300 Message-Id: <20211212210309.9851-20-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 eaa47753b758..2e613fddd614 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -47,19 +47,11 @@ static void acpi_sleep_tts_switch(u32 acpi_state) } } =20 -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; } =20 -static struct notifier_block tts_notifier =3D { - .notifier_call =3D tts_notify_reboot, - .next =3D NULL, - .priority =3D 0, -}; - static int acpi_sleep_prepare(u32 acpi_state) { #ifdef CONFIG_ACPI_SLEEP @@ -1020,7 +1012,7 @@ static void acpi_sleep_hibernate_setup(void) static inline void acpi_sleep_hibernate_setup(void) {} #endif /* !CONFIG_HIBERNATION */ =20 -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); @@ -1028,7 +1020,7 @@ static void acpi_power_off_prepare(void) acpi_os_wait_events_complete(); } =20 -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__); @@ -1036,6 +1028,11 @@ static void acpi_power_off(void) acpi_enter_sleep_state(ACPI_STATE_S5); } =20 +static struct sys_off_handler acpi_sys_off_handler =3D { + .power_off_priority =3D POWEROFF_PRIO_FIRMWARE, + .reboot_prepare_cb =3D tts_reboot_prepare, +}; + int __init acpi_sleep_init(void) { char supported[ACPI_S_STATE_COUNT * 3 + 1]; @@ -1052,8 +1049,8 @@ int __init acpi_sleep_init(void) =20 if (acpi_sleep_state_supported(ACPI_STATE_S5)) { sleep_states[ACPI_STATE_S5] =3D 1; - pm_power_off_prepare =3D acpi_power_off_prepare; - pm_power_off =3D acpi_power_off; + acpi_sys_off_handler.power_off_cb =3D acpi_power_off; + acpi_sys_off_handler.power_off_prepare_cb =3D acpi_power_off_prepare; } else { acpi_no_s5 =3D true; } @@ -1069,6 +1066,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; } --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343256; cv=none; d=zohomail.com; s=zohoarc; b=mSNnNJKWYGLMX/8OBy66lVKp93UQLizIswTgFQ8QvtXpm/ZhBcYQbLIKFUJlhFXp4r3rLa7lUhmT8O4Mtacf/U+VuZV02N63pK7OCmnFIukbtkGmDGPBRzVu/UrpPPmXsQsFClvMLdkH3zWbrUdYtKwoIvex3WLusLevW3ch3M4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343256; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rkacp5n+z0D4++qm+Vz/WWDd0s3O3Dw6o+6i9hrIfWs=; b=NykPoGlPpvNj2WAXrV630CO7hvkDWfOL+R0BcMbXhIKERsgeik9Sx/jUnoTlsI/0mDPZkTFfPZbN2IaQAyqDIaqW/6yUEe7pOeiv36vLGByqHsh6KXlY1cG2UvSnWk7zeDNgN9CT1EwUv7Yz0A1KOSnAgFNmudYbU52C3SkuqBQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639343256889229.2258029320201; Sun, 12 Dec 2021 13:07:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245746.423979 (Exim 4.92) (envelope-from ) id 1mwW42-0005iZ-Vz; Sun, 12 Dec 2021 21:07:22 +0000 Received: by outflank-mailman (output) from mailman id 245746.423979; Sun, 12 Dec 2021 21:07:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mwW42-0005iI-SZ; Sun, 12 Dec 2021 21:07:22 +0000 Received: by outflank-mailman (input) for mailman id 245746; Sun, 12 Dec 2021 21:07:22 +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 1mwW11-0004MP-TM for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:04:16 +0000 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [2a00:1450:4864:20::22b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1022500b-5b8f-11ec-bf02-3911bdbc85ab; Sun, 12 Dec 2021 22:04:15 +0100 (CET) Received: by mail-lj1-x22b.google.com with SMTP id v15so21170325ljc.0 for ; Sun, 12 Dec 2021 13:04:15 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:14 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 1022500b-5b8f-11ec-bf02-3911bdbc85ab 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=rkacp5n+z0D4++qm+Vz/WWDd0s3O3Dw6o+6i9hrIfWs=; b=e0sgLnYGWIpOhM1Tq0k5rzmw3sXPnMSv9iU+hJCVf1d2qA5Nwls6W/GgRoNwqoAvw1 tXT4+RbqrP9lew0eQNLLVzr4Tn+/KG9vRK/h96X4lUdOVI3M30MHlygIEFiy7aG9PDpO FDB2lByxNjeAeQWlHhuXbfsu9GBOqKvBNAwh3U2Q+VQHIS07A052FUQ8qjiIdASg5Qw+ bnUyYW2iPbQO/bwcFcC3Y3ZipEfgzZ9AKMiF5jIjxgBowJhAar6aptmeM5855rWbA81O OPgm6OMSIQk0izvbI4XDkhUGKMOQBJnNhuVLas8oeZvdOzzR4Cqk4Od9cWRX0+RaAnjM j/tQ== 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=rkacp5n+z0D4++qm+Vz/WWDd0s3O3Dw6o+6i9hrIfWs=; b=C94m6Rlf6fOHGnirFBH2ZkS9RYttt1DV9QLzgO+xxgWFAWTB8HZIUEfvl+Bg3OYm54 FR+WQq5XL9GeHBMMja21yt6J2YYIKoUfNo5Yd7xy68l/1wwYTCVv0wV7XqObI/XyTRtj PneEU/81RR3V6TPW4cCuqXqOjPhcJoLjy1uKgrRH3maWqLug6pC0U4Y1kzIXAGjgV9vC njaTWEz7MH0KUTL09uK5e2ALgl9tlNVJxeiCc2zdnMZWpzZbrJl4JW7JBwUHU7tnVaFK +hLq0jBcJpNuFsi+D4jkp2t+V9UzwFnvvS88ay5fbu6J4XmLNZuzbd5uEBr2MjiEdWaJ yEcg== X-Gm-Message-State: AOAM5318a0FzKaFkKdZ/wjkluF8pAkO5IvpLiSoc5TEcXpx7I6qHMBH7 P1HHUAR0wcEMFvtLKCi5tHs= X-Google-Smtp-Source: ABdhPJxKA9uwDzy9sxWunFq5w+Qai9KQ5v2gbDC4ae5Qa508HXOmLzyx/bTP66jD881V2IynnIuisQ== X-Received: by 2002:a2e:a305:: with SMTP id l5mr26154909lje.73.1639343054860; Sun, 12 Dec 2021 13:04:14 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 20/21] regulator: pfuze100: Use devm_register_sys_off_handler() Date: Mon, 13 Dec 2021 00:03:08 +0300 Message-Id: <20211212210309.9851-21-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343258122100001 Content-Type: text/plain; charset="utf-8" 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/pfu= ze100-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; }; =20 static const int pfuze100_swbst[] =3D { @@ -569,10 +571,10 @@ static inline struct device_node *match_of_node(int i= ndex) return pfuze_matches[index].of_node; } =20 -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 =3D data->cb_data; + dev_info(syspm_pfuze_chip->dev, "Configure standby mode for power off"); =20 /* Switch from default mode: APS/APS to APS/Off */ @@ -611,24 +613,23 @@ static void pfuze_power_off_prepare(void) =20 static int pfuze_power_off_prepare_init(struct pfuze_chip *pfuze_chip) { + int err; + if (pfuze_chip->chip_id !=3D PFUZE100) { dev_warn(pfuze_chip->dev, "Requested pm_power_off_prepare handler for no= t supported chip\n"); return -ENODEV; } =20 - 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 =3D pfuze_power_off_prepare; + pfuze_chip->sys_off.cb_data =3D pfuze_chip; =20 - if (syspm_pfuze_chip) { - dev_warn(pfuze_chip->dev, "syspm_pfuze_chip is already set.\n"); - return -EBUSY; + err =3D devm_register_sys_off_handler(pfuze_chip->dev, &pfuze_chip->sys_o= ff); + if (err) { + dev_err(pfuze_chip->dev, + "failed to register sys-off handler: %d\n", err); + return err; } =20 - syspm_pfuze_chip =3D pfuze_chip; - pm_power_off_prepare =3D pfuze_power_off_prepare; - return 0; } =20 @@ -837,23 +838,12 @@ static int pfuze100_regulator_probe(struct i2c_client= *client, return 0; } =20 -static int pfuze100_regulator_remove(struct i2c_client *client) -{ - if (syspm_pfuze_chip) { - syspm_pfuze_chip =3D NULL; - pm_power_off_prepare =3D NULL; - } - - return 0; -} - static struct i2c_driver pfuze_driver =3D { .driver =3D { .name =3D "pfuze100-regulator", .of_match_table =3D pfuze_dt_ids, }, .probe =3D pfuze100_regulator_probe, - .remove =3D pfuze100_regulator_remove, }; module_i2c_driver(pfuze_driver); =20 --=20 2.33.1 From nobody Fri May 3 21:08:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1639343239; cv=none; d=zohomail.com; s=zohoarc; b=BSn0ReUHOcgA8teHH2EYEPvwEZAPsa1MrrPFsH9/vvNQulYg8uNbAmDnoOoVx5kSYXNZb5vCPkj+BATeayxfW3k8bCSRWjOI04FuhReprJ5Qzq0fm4yjzBxvy4iNYLH6BBN2l0C7Ozexhc1O2qOwKg8ZMVLhgyVbvxRjhyWqkrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639343239; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LnM2oqI/P3qkpx3c1EWtD4sLNI6B6gG/+oTBL+kWCNQ=; b=lEenkahiO7iHGhs+UWBqDOe+FRBBO0xVXtvhmRsATn8inYNAI7ANtHVdLIhsviTtjW6DXvlCscd0oB3D4xiY32taqHcUKVU1xvKz94dXeRjV6fSFM/U+2BXY3dro1ABr7IGz5tWDSJ5+ySfkL1QVoi8zRqNz6oUYDpdwslcKKp4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639343239387986.6301128366022; Sun, 12 Dec 2021 13:07:19 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.245741.423957 (Exim 4.92) (envelope-from ) id 1mwW3f-0004pn-FM; Sun, 12 Dec 2021 21:06:59 +0000 Received: by outflank-mailman (output) from mailman id 245741.423957; Sun, 12 Dec 2021 21:06:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mwW3f-0004pg-CG; Sun, 12 Dec 2021 21:06:59 +0000 Received: by outflank-mailman (input) for mailman id 245741; Sun, 12 Dec 2021 21:06:58 +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 1mwW13-0004MP-Tq for xen-devel@lists.xenproject.org; Sun, 12 Dec 2021 21:04:18 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 115e7a09-5b8f-11ec-bf02-3911bdbc85ab; Sun, 12 Dec 2021 22:04:17 +0100 (CET) Received: by mail-lf1-x131.google.com with SMTP id b40so27417593lfv.10 for ; Sun, 12 Dec 2021 13:04:17 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id y4sm1197172ljp.16.2021.12.12.13.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 13:04:16 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 115e7a09-5b8f-11ec-bf02-3911bdbc85ab 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=LnM2oqI/P3qkpx3c1EWtD4sLNI6B6gG/+oTBL+kWCNQ=; b=Ti+UtGG8XV6c0zOWqrHGbE59RojWkw4ydpgjMyPnKydCS+/MWggp7Pc9vXP3/dSIcd 3jnWTMBd8zv/qBtjyyIl9yIZVhT8x6fyMjQXI7luWmrCTc61AVDnaWwsG+mIfuPQO9dB vcqOllWLO88CRGpuT6+xXO8ZmzEOzeGTj/s4L1fT4s6+Ybm6rqbTcVdA4UXyNrivjGv5 UJ6UviXyCjmc4b8nSyi1dpErcal2pEnmBKVfp4o/3mh7A8Qp+zHAUZCcABQgpQssHyoG UiW2FFO7QpKrXAOmKzFmfqtuBRyQuxNiF7hVzSScTIX4m9O5uZ05fsLoNM2XxAyyofSA atBQ== 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=LnM2oqI/P3qkpx3c1EWtD4sLNI6B6gG/+oTBL+kWCNQ=; b=LMFRYoIWTDpTUWtdDv/uvo8Eg4mVOvEoEMZREIqN9vuFxhbRt9r2Gc9292gOb4GxHp AydJwCwvAYilfieFA+HbV5fHunl/xINKGKNyYnuMxBCvESewnCaxxsrCS97s3qoSCjoj RBpR4GmIuPTMVcZtS2JTmtIKp2ctRDx9LIIYHLK+vxha83MKR15vhPb2uOXTeOz2eBuS CQi2ER0yljR/taSCGvKK9X3wf7dp8etrUlEXWpzXb9MDXRe/HPl+KqLeKbyhxb4EZ30X rGfb4xlA2fnpZVzIJZhsOtN2WE0SQsHyoj2MN7Y7daOz2oDT0Qeb4uMfrZiiGok+QMd8 NwxQ== X-Gm-Message-State: AOAM531GJkMWc+gu11TjVYHF363mYAIwp6E1Fcml+dI8ZZPPdyP62d7Q XT8LeHJHDtdQbz9zB6OOVOc= X-Google-Smtp-Source: ABdhPJzqEv9dTDNrIB5aKtlnsJyeHcmVeske90TevqdWeeks/wIjllK9zuSKBLKrf6g7j5l1fLZDZQ== X-Received: by 2002:a05:6512:3c9e:: with SMTP id h30mr24792667lfv.212.1639343056911; Sun, 12 Dec 2021 13:04:16 -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?q?Micha=C5=82=20Miros=C5=82aw?= 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, linuxppc-dev@lists.ozlabs.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 v5 21/21] reboot: Remove pm_power_off_prepare() Date: Mon, 13 Dec 2021 00:03:09 +0300 Message-Id: <20211212210309.9851-22-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211212210309.9851-1-digetx@gmail.com> References: <20211212210309.9851-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1639343241636100001 Content-Type: text/plain; charset="utf-8" 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 1d8209c09686..d9bf1426f81e 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -20,7 +20,6 @@ * Callbacks for platform drivers to implement. */ extern void (*pm_power_off)(void); -extern void (*pm_power_off_prepare)(void); =20 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 3085873a876f..2f79d4f7cfaa 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -48,13 +48,6 @@ int reboot_cpu; enum reboot_type reboot_type =3D BOOT_ACPI; int reboot_force; =20 -/* - * 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 * @@ -829,10 +822,6 @@ void do_kernel_power_off(void) =20 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); } --=20 2.33.1