gpio: dwapb_gpio: fix broken dev->node
PATCH 1/1 gpio: dwapb_gpio: fix broken dev->node
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.
---
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(-)
drivers/gpio/dwapb_gpio.c +2 -3
@@ -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++; }
Signature · 1 line
2.20.1
Marek Vasut
AppliedPATCH 1/1 gpio: dwapb_gpio: fix broken dev->node
Quoted 32 lines · Simon Goldschmidt
commit 1b898ff ("gpio:
dwapb_gpio: convert to livetree") introduced a bug in thatdev->nodeof the gpio chip was accidentally set to theof_nodeof its bank subnode.What it meant to do was assign
subdev->node, notdev->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 assigningsubdev->nodemanually.Fixes commit 1b898ff ("gpio: dwapb_gpio: convert to livetree")Signed-off-by Simon Goldschmidt <[email protected]>---
This applies on top of
0aec330931c5in u-boot-socfpga/master which it should be squashed into.--- drivers/gpio/dwapb_gpio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpio/dwapb_gpio.c +0
-1@@ -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,
drivers/gpio/dwapb_gpio.c static int gpio_dwapb_bind(struct udevice *dev) · line 195
Quoted 10 lines
drivers/gpio/dwapb_gpio.c +2
-2- plat, -1, &subdev); + ret =device_bind_ofnode (dev, dev->driver, plat->name, + plat, node, &subdev);if (ret)return ret; - subdev->node = node; bank++; }
Applied, thanks
Signature · 2 lines
Best regards, Marek Vasut