* [PATCH v6 5/7] platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register()
@ 2026-11-13 10:44 Eliav Farber
2026-11-13 10:44 ` [PATCH v6 6/7] reboot: " Eliav Farber
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Eliav Farber @ 2026-11-13 10:44 UTC (permalink / raw)
To: Rafael J. Wysocki, Dmitry Torokhov, Laurent Pinchart,
Hans de Goede, Ilpo Järvinen, Armin Wolf, Sebastian Reichel,
Andrew Morton
Cc: Eliav Farber, platform-driver-x86, linux-kernel,
Uwe Kleine-König
Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
devm_uniwill_wmi_unregister_notifier() callback.
Signed-off-by: Eliav Farber <farbere@amazon.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
---
Changes in v6:
- Rebased onto v7.4-rc1. No functional change since v5.
- Armin Wolf's Reviewed-by retained; the code is unchanged since v4,
when it was given.
devm_uniwill_wmi_register_notifier() is kept rather than having
uniwill-acpi.c call devm_blocking_notifier_chain_register() directly,
because uniwill_wmi_chain_head is static to uniwill-wmi.c and dropping
the wrapper would mean exposing it in uniwill-wmi.h. Discussed with Uwe
Kleine-Koenig on v4.
drivers/platform/x86/uniwill/uniwill-wmi.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/platform/x86/uniwill/uniwill-wmi.c b/drivers/platform/x86/uniwill/uniwill-wmi.c
index afcbfa4f7552..2ffa29a829ee 100644
--- a/drivers/platform/x86/uniwill/uniwill-wmi.c
+++ b/drivers/platform/x86/uniwill/uniwill-wmi.c
@@ -26,22 +26,11 @@
static BLOCKING_NOTIFIER_HEAD(uniwill_wmi_chain_head);
-static void devm_uniwill_wmi_unregister_notifier(void *data)
-{
- struct notifier_block *nb = data;
-
- blocking_notifier_chain_unregister(&uniwill_wmi_chain_head, nb);
-}
-
int devm_uniwill_wmi_register_notifier(struct device *dev, struct notifier_block *nb)
{
- int ret;
-
- ret = blocking_notifier_chain_register(&uniwill_wmi_chain_head, nb);
- if (ret < 0)
- return ret;
-
- return devm_add_action_or_reset(dev, devm_uniwill_wmi_unregister_notifier, nb);
+ return devm_blocking_notifier_chain_register(dev,
+ &uniwill_wmi_chain_head,
+ nb);
}
static void uniwill_wmi_notify(struct wmi_device *wdev, union acpi_object *obj)
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v6 6/7] reboot: use devm_blocking_notifier_chain_register()
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 ` Eliav Farber
2026-11-13 11:10 ` Eliav Farber
2026-11-13 10:44 ` [PATCH v6 7/7] power: supply: cros_pchg: " Eliav Farber
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Eliav Farber @ 2026-11-13 10:44 UTC (permalink / raw)
To: Rafael J. Wysocki, Dmitry Torokhov, Laurent Pinchart,
Hans de Goede, Ilpo Järvinen, Armin Wolf, Sebastian Reichel,
Andrew Morton
Cc: Eliav Farber, Bradley Morgan, Pavel Tikhomirov, Oleg Nesterov,
Petr Pavlu, Edward Adam Davis, Petr Mladek, Cen Zhang (Microsoft),
linux-kernel
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v6 7/7] power: supply: cros_pchg: use devm_blocking_notifier_chain_register()
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 10:44 ` 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
3 siblings, 1 reply; 7+ messages in thread
From: Eliav Farber @ 2026-11-13 10:44 UTC (permalink / raw)
To: Rafael J. Wysocki, Dmitry Torokhov, Laurent Pinchart,
Hans de Goede, Ilpo Järvinen, Armin Wolf, Sebastian Reichel,
Andrew Morton
Cc: Eliav Farber, linux-pm, linux-kernel, Pengpeng Hou
Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
cros_pchg_unregister_notifier() callback.
Signed-off-by: Eliav Farber <farbere@amazon.com>
---
Changes in v6:
- New patch. cros_peripheral_charger.c grew the
blocking_notifier_chain_register() + devm_add_action_or_reset()
pattern in 631adfa03595 ("power: supply: cros_pchg: unregister EC
notifier"), which reached mainline in v7.3-rc1 on 2026-08-21, five
days after v5 was posted, so earlier revisions could not have
covered it.
The conversion keeps the existing dev_err_probe() message, and removes
one asymmetry: the old code registered on
ec_dev->ec_dev->event_notifier but unregistered on
charger->ec_device->event_notifier. Those are the same chain -
charger->ec_device is assigned from ec_dev->ec_dev earlier in probe -
and there is now a single reference to it.
drivers/power/supply/cros_peripheral_charger.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/power/supply/cros_peripheral_charger.c b/drivers/power/supply/cros_peripheral_charger.c
index fdfa510f0f2d..d171bd56f479 100644
--- a/drivers/power/supply/cros_peripheral_charger.c
+++ b/drivers/power/supply/cros_peripheral_charger.c
@@ -258,14 +258,6 @@ static int cros_ec_notify(struct notifier_block *nb,
return cros_pchg_event(charger);
}
-static void cros_pchg_unregister_notifier(void *data)
-{
- struct charger_data *charger = data;
-
- blocking_notifier_chain_unregister(&charger->ec_device->event_notifier,
- &charger->notifier);
-}
-
static int cros_pchg_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -350,13 +342,13 @@ static int cros_pchg_probe(struct platform_device *pdev)
nb = &charger->notifier;
nb->notifier_call = cros_ec_notify;
- ret = blocking_notifier_chain_register(&ec_dev->ec_dev->event_notifier,
- nb);
+ ret = devm_blocking_notifier_chain_register(dev,
+ &ec_dev->ec_dev->event_notifier,
+ nb);
if (ret < 0)
return dev_err_probe(dev, ret, "Failed to register notifier\n");
- return devm_add_action_or_reset(dev, cros_pchg_unregister_notifier,
- charger);
+ return 0;
}
#ifdef CONFIG_PM_SLEEP
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v6 5/7] platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register()
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 10:44 ` [PATCH v6 7/7] power: supply: cros_pchg: " Eliav Farber
@ 2026-11-13 11:10 ` Eliav Farber
2026-11-13 11:46 ` Ilpo Järvinen
3 siblings, 0 replies; 7+ messages in thread
From: Eliav Farber @ 2026-11-13 11:10 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Armin Wolf
Cc: platform-driver-x86, linux-kernel, Eliav Farber
This patch is not in the series thread. My mail server refused the second
half of the series with a submission rate limit, and the resend went out
unthreaded, so 5/7, 6/7 and 7/7 are rooted at 5/7 instead of under the cover
letter.
The cover letter and patches 1/7 to 4/7 are here:
0/7 https://lore.kernel.org/all/20261113104218.32566-1-farbere@amazon.com/
All seven patches were delivered, so I am not resending them. Sorry for the
split thread.
--
Thanks, Eliav
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v6 6/7] reboot: use devm_blocking_notifier_chain_register()
2026-11-13 10:44 ` [PATCH v6 6/7] reboot: " Eliav Farber
@ 2026-11-13 11:10 ` Eliav Farber
0 siblings, 0 replies; 7+ messages in thread
From: Eliav Farber @ 2026-11-13 11:10 UTC (permalink / raw)
To: Andrew Morton; +Cc: Bradley Morgan, linux-kernel, Eliav Farber
This patch is not in the series thread. My mail server refused the second
half of the series with a submission rate limit, and the resend went out
unthreaded, so 5/7, 6/7 and 7/7 are rooted at 5/7 instead of under the cover
letter.
The cover letter and patches 1/7 to 4/7 are here:
0/7 https://lore.kernel.org/all/20261113104218.32566-1-farbere@amazon.com/
All seven patches were delivered, so I am not resending them. Sorry for the
split thread.
--
Thanks, Eliav
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v6 7/7] power: supply: cros_pchg: use devm_blocking_notifier_chain_register()
2026-11-13 10:44 ` [PATCH v6 7/7] power: supply: cros_pchg: " Eliav Farber
@ 2026-11-13 11:10 ` Eliav Farber
0 siblings, 0 replies; 7+ messages in thread
From: Eliav Farber @ 2026-11-13 11:10 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: linux-pm, linux-kernel, Eliav Farber
This patch is not in the series thread. My mail server refused the second
half of the series with a submission rate limit, and the resend went out
unthreaded, so 5/7, 6/7 and 7/7 are rooted at 5/7 instead of under the cover
letter.
The cover letter and patches 1/7 to 4/7 are here:
0/7 https://lore.kernel.org/all/20261113104218.32566-1-farbere@amazon.com/
All seven patches were delivered, so I am not resending them. Sorry for the
split thread.
--
Thanks, Eliav
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v6 5/7] platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register()
2026-11-13 10:44 [PATCH v6 5/7] platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register() Eliav Farber
` (2 preceding siblings ...)
2026-11-13 11:10 ` [PATCH v6 5/7] platform/x86: uniwill-wmi: " Eliav Farber
@ 2026-11-13 11:46 ` Ilpo Järvinen
3 siblings, 0 replies; 7+ messages in thread
From: Ilpo Järvinen @ 2026-11-13 11:46 UTC (permalink / raw)
To: Rafael J. Wysocki, Dmitry Torokhov, Laurent Pinchart,
Hans de Goede, Armin Wolf, Sebastian Reichel, Andrew Morton,
Eliav Farber
Cc: platform-driver-x86, linux-kernel, Uwe Kleine-König
On Fri, 13 Nov 2026 10:44:53 +0000, Eliav Farber wrote:
> Replace the blocking_notifier_chain_register() +
> devm_add_action_or_reset() pattern with a single call to
> devm_blocking_notifier_chain_register(), removing the
> devm_uniwill_wmi_unregister_notifier() callback.
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
FYI [if applicable to your patch], as per Linus' policy change, also
fixes are mostly routed through for-next unless the fix is for a
commit introduced in the most recent cycle or is clearly a regression
fix.
The list of commits applied:
[5/7] platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register()
commit: 4a53f320115d5f7c21c8fd899b362b5719a51946
[6/7] reboot: use devm_blocking_notifier_chain_register()
(no commit info)
[7/7] power: supply: cros_pchg: use devm_blocking_notifier_chain_register()
(no commit info)
--
i.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-13 11:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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
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.