Skip to contentSkip to conversation

gpio: dwapb_gpio: fix broken dev->node

PATCH New Simon Goldschmidt 2 participants 4 messages May 21, 2019 – May 22, 2019 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: dwapb_gpio: fix broken dev->node

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")

---

This fixes a commit that is only 12 days old, so it's a fix for v2019.07

---
 drivers/gpio/dwapb_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/dwapb_gpio.c +1 -1
index 04a2381acd..d6887a396a 100644
@@ -190,7 +190,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
 		if (ret)
 			return ret;
 
-		dev->node = node;
+		subdev->node = node;
 		bank++;
 	}
 
Signature · 1 line
2.20.1
Applied
#1 lore raw

PATCH 1/1 gpio: dwapb_gpio: fix broken dev->node

Quoted 25 lines · Simon Goldschmidt

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")

---

This fixes a commit that is only 12 days old, so it's a fix for v2019.07

---
 drivers/gpio/dwapb_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/dwapb_gpio.c +0 -0
index 04a2381acd..d6887a396a 100644

drivers/gpio/dwapb_gpio.c static int gpio_dwapb_bind(struct udevice *dev) · line 196

Quoted 8 lines
drivers/gpio/dwapb_gpio.c +1 -1
@@ -190,7 +190,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
 		if (ret)
 			return ret;
 
-		dev->node = node;
+		subdev->node = node;
 		bank++;
 	}
 

Applied, thanks

Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH 1/1 gpio: dwapb_gpio: fix broken dev->node

Quoted 29 lines · Marek Vasut
Quoted 27 lines · Simon Goldschmidt

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")

---

This fixes a commit that is only 12 days old, so it's a fix for v2019.07

---
 drivers/gpio/dwapb_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/dwapb_gpio.c +0 -0
index 04a2381acd..d6887a396a 100644
@@ -190,7 +190,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
              if (ret)
                      return ret;
 
Quoted 7 lines

drivers/gpio/dwapb_gpio.c static int gpio_dwapb_bind(struct udevice *dev) · line 196

Quoted 6 lines
drivers/gpio/dwapb_gpio.c +1 -1
-             dev->node = node;
+             subdev->node = node;
              bank++;
      }
 

Applied, thanks

Looking around 'include/dm/device-internal.h', I just saw that a more appropriate fix would be to use 'device_bind_ofnode()' instead of calling 'device_bind()' and assigning the node ourself by accessing subdev->node.

Do you want me to send a follow-up or a v2 of this, given that you already applied this v1?

Regards,
Simon

#3 lore raw

PATCH 1/1 gpio: dwapb_gpio: fix broken dev->node

Quoted 38 lines · Simon Goldschmidt
Quoted 29 lines · Marek Vasut
Quoted 27 lines · Simon Goldschmidt

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")

---

This fixes a commit that is only 12 days old, so it's a fix for v2019.07

---
 drivers/gpio/dwapb_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/dwapb_gpio.c +0 -0
index 04a2381acd..d6887a396a 100644
@@ -190,7 +190,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
              if (ret)
                      return ret;
 
Quoted 7 lines

drivers/gpio/dwapb_gpio.c static int gpio_dwapb_bind(struct udevice *dev) · line 196

Quoted 6 lines
drivers/gpio/dwapb_gpio.c +1 -1
-             dev->node = node;
+             subdev->node = node;
              bank++;
      }
 

Applied, thanks

Quoted 6 lines

Looking around 'include/dm/device-internal.h', I just saw that a more appropriate fix would be to use 'device_bind_ofnode()' instead of calling 'device_bind()' and assigning the node ourself by accessing subdev->node.

Do you want me to send a follow-up or a v2 of this, given that you already applied this v1?

Send a follow up patch, I will squash them.

Signature · 2 lines
Best regards,
Marek Vasut