linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] power/supply/powersupply_sysfs: Add of_node name to uevent message if available
@ 2019-07-25  7:47 Richard Tresidder
  2019-07-25 14:08 ` David Lechner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Richard Tresidder @ 2019-07-25  7:47 UTC (permalink / raw)
  To: sre, enric.balletbo, ncrews, andrew.smirnov, groeck, david,
	rtresidd, tglx, linux-pm, linux-kernel

If the of_node name of the supply is available from the devicetree binding
then include it under the var POWER_SUPPLY_OF_NODE_NAME.
This helps where a consistent name is known via the device tree binding
but it is hard to identify based on the usual enumeration process.

Signed-off-by: Richard Tresidder <rtresidd@electromag.com.au>
---

Notes:
    power/supply/powersupply_sysfs: Add of_node name to uevent message if available
    
    If the of_node name of the supply is available from the devicetree binding
    then include it under the var POWER_SUPPLY_OF_NODE_NAME.
    This helps where a consistent name is known via the device tree binding
    but it is hard to identify based on the usual enumeration process.

 drivers/power/supply/power_supply_sysfs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index f37ad4e..ce6671c 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -395,6 +395,13 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
 	if (ret)
 		return ret;
 
+	if (psy->of_node) {
+		ret = add_uevent_var(env, "POWER_SUPPLY_OF_NODE_NAME=%s",
+				     psy->of_node->name);
+		if (ret)
+			return ret;
+	}
+
 	prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
 	if (!prop_buf)
 		return -ENOMEM;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-29  8:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25  7:47 [PATCH 1/1] power/supply/powersupply_sysfs: Add of_node name to uevent message if available Richard Tresidder
2019-07-25 14:08 ` David Lechner
2019-07-26  2:40   ` Richard Tresidder
2019-07-26  4:51     ` Richard Tresidder
2019-07-26  9:43       ` Richard Tresidder
2019-07-26 20:45 ` kbuild test robot
2019-07-29  8:32 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).