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>, <linux-pm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Pengpeng Hou <pengpeng@iscas.ac.cn>
Subject: [PATCH v6 7/7] power: supply: cros_pchg: use devm_blocking_notifier_chain_register()
Date: Fri, 13 Nov 2026 10:44:55 +0000 [thread overview]
Message-ID: <20261113104459.35839-3-farbere@amazon.com> (raw)
In-Reply-To: <20261113104459.35839-1-farbere@amazon.com>
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
parent reply other threads:[~2026-11-13 10:45 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20261113104459.35839-1-farbere@amazon.com>]
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-3-farbere@amazon.com \
--to=farbere@amazon.com \
--cc=W_Armin@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pengpeng@iscas.ac.cn \
--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