Messages in this thread Patch in this message | | | From | Richard Tresidder <> | Subject | [PATCH 1/1] power/supply/powersupply_sysfs: Add of_node name to uevent message if available | Date | Thu, 25 Jul 2019 15:47:38 +0800 |
| |
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
| |