[U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node

Simon Goldschmidt simon.k.r.goldschmidt at gmail.com
Thu May 23 18:43:55 UTC 2019


commit 1b898ff ("gpio: dwapb_gpio: convert to livetree") introduced
a bug in that dev->node of the gpio chip was accidentally set to the
of_node of its bank subnode.

What it meant to do was assign subdev->node, not dev->node.

While this doesn't affect too many use cases, iterating over the gpio
chip's properties doesn't work any more after that, so fix this
properly by calling 'device_bind_ofnode()' to bind the sub-device
instead of calling 'device_bind()' and then assigning subdev->node
manually.

Fixes: commit 1b898ff ("gpio: dwapb_gpio: convert to livetree")
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
---

This applies on top of 0aec330931c5 in u-boot-socfpga/master which it
should be squashed into.
---
 drivers/gpio/dwapb_gpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index d6887a396a..2eb1547b4f 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -185,12 +185,11 @@ static int gpio_dwapb_bind(struct udevice *dev)
 			plat->name = ofnode_get_name(node);
 		}
 
-		ret = device_bind(dev, dev->driver, plat->name,
-				  plat, -1, &subdev);
+		ret = device_bind_ofnode(dev, dev->driver, plat->name,
+					 plat, node, &subdev);
 		if (ret)
 			return ret;
 
-		subdev->node = node;
 		bank++;
 	}
 
-- 
2.20.1



More information about the U-Boot mailing list