From: Bradley Morgan <bradley.morgan@linux.dev>
To: farbere@amazon.com
Cc: W_Armin@gmx.de, akpm@linux-foundation.org, blbllhy@gmail.com,
brads@mainlining.org, dmitry.torokhov@gmail.com,
eadavis@sina.com, hansg@kernel.org,
ilpo.jarvinen@linux.intel.com, laurent.pinchart@ideasonboard.com,
linux-kernel@vger.kernel.org, oleg@redhat.com,
petr.pavlu@suse.com, pmladek@suse.com, ptikhomirov@virtuozzo.com,
rafael@kernel.org, sre@kernel.org
Subject: Re: [PATCH v6 6/7] reboot: use devm_blocking_notifier_chain_register()
Date: Fri, 13 Nov 2026 15:45:38 +0000 [thread overview]
Message-ID: <C286E930-6AF0-465B-8901-B3CBFA94996B@linux.dev> (raw)
In-Reply-To: <20261113104459.35839-2-farbere@amazon.com>
On 13 November 2026 10:44:54 GMT, Eliav Farber <farbere@amazon.com> wrote:
>Replace the manual devres_alloc() + register_reboot_notifier() pattern
>with a single call to devm_blocking_notifier_chain_register(), removing
>the devm_unregister_reboot_notifier() callback.
>
>The removed callback wrapped unregister_reboot_notifier() in WARN_ON().
>The generic helper ignores the unregister return value, so that warning
>is gone. It could only fire if a caller had already unregistered the
>notifier itself, which no in-tree user does.
Good. Cleanup well needed
Reviewed-by: Bradley Morgan <bradley.morgan@linux.dev>
>
>Signed-off-by: Eliav Farber <farbere@amazon.com>
>---
>Changes in v6:
>- Rebased onto v7.4-rc1.
>- Commit message: record that the removed callback's WARN_ON() on a
> failed unregister goes away, because
> devm_blocking_notifier_chain_register() ignores the unregister return
> value. No change to the code.
>
>Changes in v3:
>- Fix commit message to accurately describe the old code as using
> devres_alloc() + register_reboot_notifier() (Sashiko)
>
> kernel/reboot.c | 24 ++----------------------
> 1 file changed, 2 insertions(+), 22 deletions(-)
>
>diff --git a/kernel/reboot.c b/kernel/reboot.c
>index 9a84401adde5..2fb8700c726d 100644
>--- a/kernel/reboot.c
>+++ b/kernel/reboot.c
>@@ -146,30 +146,10 @@ int unregister_reboot_notifier(struct notifier_block *nb)
> }
> EXPORT_SYMBOL(unregister_reboot_notifier);
>
>-static void devm_unregister_reboot_notifier(struct device *dev, void *res)
>-{
>- WARN_ON(unregister_reboot_notifier(*(struct notifier_block **)res));
>-}
>-
> int devm_register_reboot_notifier(struct device *dev, struct
> notifier_block *nb)
> {
>- struct notifier_block **rcnb;
>- int ret;
>-
>- rcnb = devres_alloc(devm_unregister_reboot_notifier,
>- sizeof(*rcnb), GFP_KERNEL);
>- if (!rcnb)
>- return -ENOMEM;
>-
>- ret = register_reboot_notifier(nb);
>- if (!ret) {
>- *rcnb = nb;
>- devres_add(dev, rcnb);
>- } else {
>- devres_free(rcnb);
>- }
>-
>- return ret;
>+ return devm_blocking_notifier_chain_register(dev,
>+ &reboot_notifier_list, nb);
> }
> EXPORT_SYMBOL(devm_register_reboot_notifier);
>
>
--- Thanks!
next prev parent reply other threads:[~2026-11-13 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 10:44 [PATCH v6 5/7] platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register() Eliav Farber
2026-11-13 10:44 ` [PATCH v6 6/7] reboot: " Eliav Farber
2026-11-13 11:10 ` Eliav Farber
2026-11-13 15:45 ` Bradley Morgan [this message]
2026-11-13 10:44 ` [PATCH v6 7/7] power: supply: cros_pchg: " Eliav Farber
2026-11-13 11:10 ` Eliav Farber
2026-11-13 11:10 ` [PATCH v6 5/7] platform/x86: uniwill-wmi: " Eliav Farber
2026-11-13 11:46 ` Ilpo Järvinen
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=C286E930-6AF0-465B-8901-B3CBFA94996B@linux.dev \
--to=bradley.morgan@linux.dev \
--cc=W_Armin@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=blbllhy@gmail.com \
--cc=brads@mainlining.org \
--cc=dmitry.torokhov@gmail.com \
--cc=eadavis@sina.com \
--cc=farbere@amazon.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=petr.pavlu@suse.com \
--cc=pmladek@suse.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=rafael@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.