All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Philipp Zabel <p.zabel@pengutronix.de>,
	Vladimir Zapolskiy <vz@mleia.com>,
	Jacky Huang <ychuang3@nuvoton.com>,
	Shan-Chun Hung <schung@nuvoton.com>,
	Qin Jian <qinjian@cqplus1.com>
Cc: <openbmc@lists.ozlabs.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, Andrew Davis <afd@ti.com>
Subject: [PATCH 5/6] reset: npcm: Use devm_register_sys_off_handler()
Date: Wed, 13 Aug 2025 16:41:37 -0500	[thread overview]
Message-ID: <20250813214138.477659-6-afd@ti.com> (raw)
In-Reply-To: <20250813214138.477659-1-afd@ti.com>

Function register_restart_handler() is deprecated. Using this new API
removes our need to keep and manage a struct notifier_block and to
later unregister the handler.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/reset/reset-npcm.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/reset/reset-npcm.c b/drivers/reset/reset-npcm.c
index e5b6127783a76..6939bb3eb1507 100644
--- a/drivers/reset/reset-npcm.c
+++ b/drivers/reset/reset-npcm.c
@@ -89,7 +89,6 @@ static const struct npcm_reset_info npxm8xx_reset_info[] = {
 
 struct npcm_rc_data {
 	struct reset_controller_dev rcdev;
-	struct notifier_block restart_nb;
 	const struct npcm_reset_info *info;
 	struct regmap *gcr_regmap;
 	u32 sw_reset_number;
@@ -100,11 +99,9 @@ struct npcm_rc_data {
 
 #define to_rc_data(p) container_of(p, struct npcm_rc_data, rcdev)
 
-static int npcm_rc_restart(struct notifier_block *nb, unsigned long mode,
-			   void *cmd)
+static int npcm_rc_restart(struct sys_off_data *data)
 {
-	struct npcm_rc_data *rc = container_of(nb, struct npcm_rc_data,
-					       restart_nb);
+	struct npcm_rc_data *rc = data->cb_data;
 
 	writel(NPCM_SWRST << rc->sw_reset_number, rc->base + NPCM_SWRSTR);
 	mdelay(1000);
@@ -472,9 +469,8 @@ static int npcm_rc_probe(struct platform_device *pdev)
 	if (!of_property_read_u32(pdev->dev.of_node, "nuvoton,sw-reset-number",
 				  &rc->sw_reset_number)) {
 		if (rc->sw_reset_number && rc->sw_reset_number < 5) {
-			rc->restart_nb.priority = 192;
-			rc->restart_nb.notifier_call = npcm_rc_restart;
-			ret = register_restart_handler(&rc->restart_nb);
+			ret = devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART, 192,
+							    npcm_rc_restart, rc);
 			if (ret) {
 				dev_warn(&pdev->dev, "failed to register restart handler\n");
 				return ret;
-- 
2.39.2



  parent reply	other threads:[~2025-08-13 21:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 21:41 [PATCH 0/6] Remove register_restart_handler() from drivers/reset Andrew Davis
2025-08-13 21:41 ` [PATCH 1/6] reset: ath79: Use devm_register_restart_handler() Andrew Davis
2026-03-04 11:47   ` Philipp Zabel
2025-08-13 21:41 ` [PATCH 2/6] reset: intel: " Andrew Davis
2026-03-04 11:47   ` Philipp Zabel
2025-08-13 21:41 ` [PATCH 3/6] reset: lpc18xx: Use devm_register_sys_off_handler() Andrew Davis
2026-03-04 11:47   ` Philipp Zabel
2025-08-13 21:41 ` [PATCH 4/6] reset: ma35d1: " Andrew Davis
2026-03-04 11:47   ` Philipp Zabel
2025-08-13 21:41 ` Andrew Davis [this message]
2026-03-04 11:47   ` [PATCH 5/6] reset: npcm: " Philipp Zabel
2025-08-13 21:41 ` [PATCH 6/6] reset: sunplus: " Andrew Davis
2026-03-04 11:48   ` Philipp Zabel
2026-03-02 19:31 ` [PATCH 0/6] Remove register_restart_handler() from drivers/reset Andrew Davis
2026-03-06 10:24 ` Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250813214138.477659-6-afd@ti.com \
    --to=afd@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=p.zabel@pengutronix.de \
    --cc=qinjian@cqplus1.com \
    --cc=schung@nuvoton.com \
    --cc=vz@mleia.com \
    --cc=ychuang3@nuvoton.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.