lkml.org 
[lkml]   [2019]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] power/supply/powersupply_sysfs: Add of_node name to uevent message if available
Date
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
\
 
 \ /
  Last update: 2019-07-25 09:49    [W:0.065 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site