From: David Yang <mmyangfl@gmail.com>
To: linux-pm@vger.kernel.org
Cc: David Yang <mmyangfl@gmail.com>,
Sebastian Reichel <sre@kernel.org>, Feng Kan <fkan@apm.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] power: reset: syscon-reboot: Use devm_register_sys_off_handler(RESTART)
Date: Mon, 26 Oct 2026 17:20:47 +0800 [thread overview]
Message-ID: <20261026092049.84858-1-mmyangfl@gmail.com> (raw)
The driver registers its restart handler but never unregisters it:
there is no remove callback and the notifier block lives in the
devm-allocated context. After unbind the freed notifier stays on the
handler list and the next reboot oopses on it, observed on a
Hi3798MV100 board (PC is at 0x0, LR is at notifier_call_chain).
Use the device-managed registration, which unregisters the handler on
driver unbind; the DT-configured priority is passed through. This
mirrors the conversion of the syscon-poweroff sibling.
Fixes: 09fb07bcaf52 ("power: reset: Add generic SYSCON register mapped reset")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
drivers/power/reset/syscon-reboot.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
index 60e855cae68e..348a9550e9e3 100644
--- a/drivers/power/reset/syscon-reboot.c
+++ b/drivers/power/reset/syscon-reboot.c
@@ -31,16 +31,12 @@ struct syscon_reboot_context {
const struct reboot_data *rd; /* from of match data, if any */
struct reboot_mode_bits catchall; /* from DT */
-
- struct notifier_block restart_handler;
};
-static int syscon_restart_handle(struct notifier_block *this,
- unsigned long mode, void *cmd)
+static int syscon_restart_handle(struct sys_off_data *data)
{
- struct syscon_reboot_context *ctx =
- container_of(this, struct syscon_reboot_context,
- restart_handler);
+ struct syscon_reboot_context *ctx = data->cb_data;
+ unsigned int mode = data->mode;
const struct reboot_mode_bits *mode_bits;
if (ctx->rd) {
@@ -113,11 +109,11 @@ static int syscon_reboot_probe(struct platform_device *pdev)
}
}
- ctx->restart_handler.notifier_call = syscon_restart_handle;
- ctx->restart_handler.priority = priority;
- err = register_restart_handler(&ctx->restart_handler);
+ err = devm_register_sys_off_handler(dev, SYS_OFF_MODE_RESTART,
+ priority, syscon_restart_handle,
+ ctx);
if (err)
- dev_err(dev, "can't register restart notifier (err=%d)\n", err);
+ dev_err(dev, "can't register restart handler (err=%d)\n", err);
return err;
}
--
2.53.0
next reply other threads:[~2026-10-26 9:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 9:20 David Yang [this message]
2026-11-09 1:23 ` [PATCH] power: reset: syscon-reboot: Use devm_register_sys_off_handler(RESTART) Sebastian Reichel
2026-11-25 17:28 ` Miguel Ojeda
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=20261026092049.84858-1-mmyangfl@gmail.com \
--to=mmyangfl@gmail.com \
--cc=fkan@apm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.org \
/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.