Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH v6 7/7] power: supply: cros_pchg: use devm_blocking_notifier_chain_register()
       [not found] <20261113104459.35839-1-farbere@amazon.com>
@ 2026-11-13 10:44 ` Eliav Farber
  2026-11-13 11:10   ` Eliav Farber
  0 siblings, 1 reply; 2+ 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] 2+ 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: use devm_blocking_notifier_chain_register() Eliav Farber
@ 2026-11-13 11:10   ` Eliav Farber
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2026-11-13 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261113104459.35839-1-farbere@amazon.com>
2026-11-13 10:44 ` [PATCH v6 7/7] power: supply: cros_pchg: use devm_blocking_notifier_chain_register() Eliav Farber
2026-11-13 11:10   ` Eliav Farber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox