From: Eliav Farber <farbere@amazon.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Armin Wolf" <W_Armin@gmx.de>,
"Sebastian Reichel" <sre@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>
Cc: Eliav Farber <farbere@amazon.com>,
Bradley Morgan <brads@mainlining.org>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
Oleg Nesterov <oleg@redhat.com>, Petr Pavlu <petr.pavlu@suse.com>,
Edward Adam Davis <eadavis@sina.com>,
Petr Mladek <pmladek@suse.com>,
"Cen Zhang (Microsoft)" <blbllhy@gmail.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v6 6/7] reboot: use devm_blocking_notifier_chain_register()
Date: Fri, 13 Nov 2026 10:44:54 +0000 [thread overview]
Message-ID: <20261113104459.35839-2-farbere@amazon.com> (raw)
In-Reply-To: <20261113104459.35839-1-farbere@amazon.com>
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.
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);
--
2.47.3
next prev parent reply other threads:[~2026-11-13 10:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 10:44 [PATCH v6 5/7] platform/x86: uniwill-wmi: " Eliav Farber
2026-11-13 10:44 ` Eliav Farber [this message]
2026-11-13 11:10 ` [PATCH v6 6/7] reboot: " Eliav Farber
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=20261113104459.35839-2-farbere@amazon.com \
--to=farbere@amazon.com \
--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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®