Commit a56c6980 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

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: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
Tested-by: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Fixes: bafbdd52 ("phylib: Add device reset GPIO support")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 21a2545b
...@@ -56,7 +56,8 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev) ...@@ -56,7 +56,8 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode, gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
"reset-gpios", 0, GPIOD_OUT_LOW, "reset-gpios", 0, GPIOD_OUT_LOW,
"PHY reset"); "PHY reset");
if (PTR_ERR(gpiod) == -ENOENT) if (PTR_ERR(gpiod) == -ENOENT ||
PTR_ERR(gpiod) == -ENOSYS)
gpiod = NULL; gpiod = NULL;
else if (IS_ERR(gpiod)) else if (IS_ERR(gpiod))
return PTR_ERR(gpiod); return PTR_ERR(gpiod);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment