From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6.y 6/7] power: supply: core: get rid of of_node
Date: Tue, 10 Nov 2026 12:21:12 -0500 [thread overview]
Message-ID: <20261110172014.2622013-6-sashal@kernel.org> (raw)
In-Reply-To: <20261110172014.2622013-1-sashal@kernel.org>
From: Sebastian Reichel <sebastian.reichel@collabora.com>
[ Upstream commit 134254038739a6c6ecb7548a2f895d89a0dc9d2a ]
This removes .of_node from 'struct power_supply', since there
is already a copy in .dev.of_node and there is no need to have
two copies.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20250225-psy-core-convert-to-fwnode-v1-1-d5e4369936bb@collabora.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Stable-dep-of: 6bd80f22c764 ("power: supply: core: Honor supplied-from with CONFIG_OF=y")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/power/supply/power_supply_core.c | 16 ++++++++--------
include/linux/power_supply.h | 1 -
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 2929e21b82032..a55b85ffe3337 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -194,11 +194,11 @@ static int __power_supply_populate_supplied_from(struct power_supply *epsy,
int i = 0;
do {
- np = of_parse_phandle(psy->of_node, "power-supplies", i++);
+ np = of_parse_phandle(psy->dev.of_node, "power-supplies", i++);
if (!np)
break;
- if (np == epsy->of_node) {
+ if (np == epsy->dev.of_node) {
dev_dbg(&psy->dev, "%s: Found supply : %s\n",
psy->desc->name, epsy->desc->name);
psy->supplied_from[i-1] = (char *)epsy->desc->name;
@@ -229,7 +229,7 @@ static int __power_supply_find_supply_from_node(struct power_supply *epsy,
struct device_node *np = data;
/* returning non-zero breaks out of power_supply_for_each_psy loop */
- if (epsy->of_node == np)
+ if (epsy->dev.of_node == np)
return 1;
return 0;
@@ -264,13 +264,13 @@ static int power_supply_check_supplies(struct power_supply *psy)
return 0;
/* No device node found, nothing to do */
- if (!psy->of_node)
+ if (!psy->dev.of_node)
return 0;
do {
int ret;
- np = of_parse_phandle(psy->of_node, "power-supplies", cnt++);
+ np = of_parse_phandle(psy->dev.of_node, "power-supplies", cnt++);
if (!np)
break;
@@ -595,8 +595,8 @@ int power_supply_get_battery_info(struct power_supply *psy,
const __be32 *list;
u32 min_max[2];
- if (psy->of_node) {
- battery_np = of_parse_phandle(psy->of_node, "monitored-battery", 0);
+ if (psy->dev.of_node) {
+ battery_np = of_parse_phandle(psy->dev.of_node, "monitored-battery", 0);
if (!battery_np)
return -ENODEV;
@@ -1390,7 +1390,7 @@ __power_supply_register(struct device *parent,
if (cfg) {
dev->groups = cfg->attr_grp;
psy->drv_data = cfg->drv_data;
- psy->of_node =
+ dev->of_node =
cfg->fwnode ? to_of_node(cfg->fwnode) : cfg->of_node;
psy->supplied_to = cfg->supplied_to;
psy->num_supplicants = cfg->num_supplicants;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 4b231468c3f1d..84cff00720d03 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -287,7 +287,6 @@ struct power_supply {
char **supplied_from;
size_t num_supplies;
- struct device_node *of_node;
/* Driver private data */
void *drv_data;
--
2.53.0
next prev parent reply other threads:[~2026-11-10 17:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 10:31 FAILED: patch "[PATCH] power: supply: core: Honor supplied-from with CONFIG_OF=y" failed to apply to 6.6-stable tree Sasha Levin
2026-11-10 17:21 ` [PATCH 6.6.y 1/7] power: supply: core: remove opencoded string_lower() Sasha Levin
2026-11-10 17:21 ` [PATCH 6.6.y 2/7] power: supply: core: make power_supply_class constant Sasha Levin
2026-11-10 17:21 ` [PATCH 6.6.y 3/7] power: supply: core: add power_supply_for_each_device() Sasha Levin
2026-11-10 17:21 ` [PATCH 6.6.y 4/7] power: supply: core: introduce power_supply_for_each_psy() Sasha Levin
2026-11-10 17:21 ` [PATCH 6.6.y 5/7] power: supply: core: use power_supply_for_each_psy() Sasha Levin
2026-11-10 17:21 ` Sasha Levin [this message]
2026-11-10 17:21 ` [PATCH 6.6.y 7/7] power: supply: core: Honor supplied-from with CONFIG_OF=y Sasha Levin
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=20261110172014.2622013-6-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=sebastian.reichel@collabora.com \
--cc=stable@vger.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.