Thread (8 messages) read the whole thread 8 messages, 3 authors, 2018-07-03
STALE2950d

[PATCH v2 4/4] power: ds2760_battery: add device tree glue

From: Daniel Mack <daniel@zonque.org>
Date: 2018-06-28 07:56:16
Also in: linux-pm, lkml
Subsystem: power supply class/subsystem and drivers, the rest · Maintainers: Sebastian Reichel, Linus Torvalds

The w1 slave device used by this driver now has a of_node in case it
was matched against a devicetree sub-node of the bus master. This can
now be passed down to the power supply core which will parse more
properties from the node, such as 'power-supplies'.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/power/supply/ds2760_battery.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/power/supply/ds2760_battery.c b/drivers/power/supply/ds2760_battery.c
index ae180dc929c9..77dfdeb5fbc0 100644
--- a/drivers/power/supply/ds2760_battery.c
+++ b/drivers/power/supply/ds2760_battery.c
@@ -510,6 +510,10 @@ static int ds2760_battery_probe(struct platform_device *pdev)
 	char status;
 	int retval = 0;
 	struct ds2760_device_info *di;
+	struct device *w1_dev;
+
+	w1_dev = pdev->dev.parent;
+	psy_cfg.of_node = w1_dev->of_node;
 
 	di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
 	if (!di) {
@@ -520,7 +524,7 @@ static int ds2760_battery_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, di);
 
 	di->dev				= &pdev->dev;
-	di->w1_dev			= pdev->dev.parent;
+	di->w1_dev			= w1_dev;
 	di->bat_desc.name		= dev_name(&pdev->dev);
 	di->bat_desc.type		= POWER_SUPPLY_TYPE_BATTERY;
 	di->bat_desc.properties		= ds2760_battery_props;
-- 
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help