From ece711b5a42ce9b99a2a3706c56bf70a5425a7bf Mon Sep 17 00:00:00 2001 From: Adam Thomson Date: Tue, 22 May 2018 16:16:23 +0100 Subject: power: supply: Add fwnode pointer to power_supply_config struct To allow users of the power supply framework to be hw description agnostic, this commit adds the ability to pass a fwnode pointer, via the power_supply_config structure, to the initialisation code of the core, instead of explicitly specifying of_ndoe. If that fwnode pointer is provided then it will automatically resolve down to of_node on platforms which support it, otherwise it will be NULL. In the future, when ACPI support is added, this can be modified to accommodate ACPI without the need to change calling code which already provides the fwnode handle in this manner. Signed-off-by: Adam Thomson Suggested-by: Heikki Krogerus Reviewed-by: Sebastian Reichel Reviewed-by: Heikki Krogerus Signed-off-by: Greg Kroah-Hartman --- drivers/power/supply/power_supply_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/power') diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index ecd68c2053c5..f57ab0a27301 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "power_supply.h" @@ -874,7 +875,8 @@ __power_supply_register(struct device *parent, psy->desc = desc; if (cfg) { psy->drv_data = cfg->drv_data; - psy->of_node = cfg->of_node; + psy->of_node = + cfg->fwnode ? to_of_node(cfg->fwnode) : cfg->of_node; psy->supplied_to = cfg->supplied_to; psy->num_supplicants = cfg->num_supplicants; } -- cgit v1.2.3