From: Andrew Lunn Date: Mon, 5 Feb 2018 18:17:23 +0000 (+0100) Subject: net: phy: Handle not having GPIO enabled in the kernel X-Git-Tag: v4.16-rc1~53^2~6 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=a56c69803f5a2c1cab0228cf1aebf76821ace965;p=linux.git 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 Tested-by: Christian Zigotzky Signed-off-by: Andrew Lunn Reviewed-by: Florian Fainelli Fixes: bafbdd527d56 ("phylib: Add device reset GPIO support") Signed-off-by: David S. Miller --- diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 88272b3ac2e2..24b5511222c8 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -56,7 +56,8 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev) gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode, "reset-gpios", 0, GPIOD_OUT_LOW, "PHY reset"); - if (PTR_ERR(gpiod) == -ENOENT) + if (PTR_ERR(gpiod) == -ENOENT || + PTR_ERR(gpiod) == -ENOSYS) gpiod = NULL; else if (IS_ERR(gpiod)) return PTR_ERR(gpiod);