Skip to contentSkip to conversation

net: ravb: Fix reset GPIO handling

PATCH New Marek Vasut 2 participants 2 messages Nov 10, 2017 – Nov 13, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ravb: Fix reset GPIO handling

Fix handling of the reset GPIO. Drop the _nodev() suffix from the gpio_request_by_name() call as there is now a proper DM capable GPIO driver. Also check if the GPIO is valid before freeing it in remove path, otherwise U-Boot will crash.

Cc Joe Hershberger <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/net/ravb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ravb.c +4 -3
index dc7a52534e..26d95f178f 100644
@@ -492,8 +492,8 @@ static int ravb_probe(struct udevice *dev)
 	if (ret < 0)
 		goto err_mdio_alloc;
 
-	gpio_request_by_name_nodev(dev_ofnode(dev), "reset-gpios", 0,
-				   &eth->reset_gpio, GPIOD_IS_OUT);
+	gpio_request_by_name(dev, "reset-gpios", 0, &eth->reset_gpio,
+			     GPIOD_IS_OUT);
 
 	mdiodev = mdio_alloc();
 	if (!mdiodev) {
@@ -528,7 +528,8 @@ static int ravb_remove(struct udevice *dev)
 	free(eth->phydev);
 	mdio_unregister(eth->bus);
 	mdio_free(eth->bus);
-	dm_gpio_free(dev, &eth->reset_gpio);
+	if (dm_gpio_is_valid(&eth->reset_gpio))
+		dm_gpio_free(dev, &eth->reset_gpio);
 	unmap_physmem(eth->iobase, MAP_NOCACHE);
 
 	return 0;
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 net: ravb: Fix reset GPIO handling

Hi,

2017-11-11 7:20 GMT+09:00 Marek Vasut <[email protected]>:

Quoted 4 lines

Fix handling of the reset GPIO. Drop the _nodev() suffix from the gpio_request_by_name() call as there is now a proper DM capable GPIO driver. Also check if the GPIO is valid before freeing it in remove path, otherwise U-Boot will crash.

Thanks for this patch.
I was just struggling with this problem.

Quoted 4 lines
Cc Joe Hershberger <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>

Best regards,
Nobuhiro

Quoted 32 lines
---
 drivers/net/ravb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ravb.c +4 -4
index dc7a52534e..26d95f178f 100644
@@ -492,8 +492,8 @@ static int ravb_probe(struct udevice *dev)
        if (ret < 0)
                goto err_mdio_alloc;
 
-       gpio_request_by_name_nodev(dev_ofnode(dev), "reset-gpios", 0,
-                                  &eth->reset_gpio, GPIOD_IS_OUT);
+       gpio_request_by_name(dev, "reset-gpios", 0, &eth->reset_gpio,
+                            GPIOD_IS_OUT);
 
        mdiodev = mdio_alloc();
        if (!mdiodev) {
@@ -528,7 +528,8 @@ static int ravb_remove(struct udevice *dev)
        free(eth->phydev);
        mdio_unregister(eth->bus);
        mdio_free(eth->bus);
-       dm_gpio_free(dev, &eth->reset_gpio);
+       if (dm_gpio_is_valid(&eth->reset_gpio))
+               dm_gpio_free(dev, &eth->reset_gpio);
        unmap_physmem(eth->iobase, MAP_NOCACHE);
 
        return 0;
--

2.11.0

Signature · 3 lines
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6