Skip to content

Commit a56c698

Browse files
lunndavem330
authored andcommitted
net: phy: Handle not having GPIO enabled in the kernel
If CONFIG_GPIOLIB is disabled, fwnode_get_named_gpiod() becomes a stub function, which return -ENOSYS. Handle this in the same way as -ENOENT, i.e. assume there is no GPIO used to reset the PHYs. Reported-by: Christian Zigotzky <[email protected]> Tested-by: Christian Zigotzky <[email protected]> Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Fixes: bafbdd5 ("phylib: Add device reset GPIO support") Signed-off-by: David S. Miller <[email protected]>
1 parent 21a2545 commit a56c698

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
5656
gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
5757
"reset-gpios", 0, GPIOD_OUT_LOW,
5858
"PHY reset");
59-
if (PTR_ERR(gpiod) == -ENOENT)
59+
if (PTR_ERR(gpiod) == -ENOENT ||
60+
PTR_ERR(gpiod) == -ENOSYS)
6061
gpiod = NULL;
6162
else if (IS_ERR(gpiod))
6263
return PTR_ERR(gpiod);

0 commit comments

Comments
 (0)