gpio: dwapb_gpio: fix broken dev->node
authorSimon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Tue, 21 May 2019 20:03:12 +0000 (22:03 +0200)
committerMarek Vasut <marex@denx.de>
Thu, 23 May 2019 22:01:08 +0000 (00:01 +0200)
commit 1b898ffc040b ("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.

Fixes: commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree")
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
drivers/gpio/dwapb_gpio.c

index 04a2381acd818ceb045d2fbcfa80237f71e611d9..2eb1547b4f36de3f41f24218484c034b720076da 100644 (file)
@@ -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;
 
-               dev->node = node;
                bank++;
        }