summaryrefslogtreecommitdiff
path: root/drivers/net/phy/mdio-gpio.c
diff options
context:
space:
mode:
authorBert Vermeulen <bert@biot.com>2015-05-08 17:18:49 +0300
committerDavid S. Miller <davem@davemloft.net>2015-05-11 02:42:11 +0300
commit7c0c82682873354490a5b67c77331bd65a356236 (patch)
tree73da8142fabb0062940986b7ccc4cae2f1903c85 /drivers/net/phy/mdio-gpio.c
parentfbf33a2802f71dba06faa948af805884ff16a2ab (diff)
downloadlinux-7c0c82682873354490a5b67c77331bd65a356236.tar.xz
net: mdio-gpio: Allow for unspecified bus id
When the bus id was supplied via a struct platform_device, the driver wasn't handling -1 to mean an unspecified id of the only instance of this driver, as the platform spec requires. Signed-off-by: Bert Vermeulen <bert@biot.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/mdio-gpio.c')
-rw-r--r--drivers/net/phy/mdio-gpio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index c9cb486c753d..53d18150f4e2 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -168,7 +168,10 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev,
if (!new_bus->irq[i])
new_bus->irq[i] = PHY_POLL;
- snprintf(new_bus->id, MII_BUS_ID_SIZE, "gpio-%x", bus_id);
+ if (bus_id != -1)
+ snprintf(new_bus->id, MII_BUS_ID_SIZE, "gpio-%x", bus_id);
+ else
+ strncpy(new_bus->id, "gpio", MII_BUS_ID_SIZE);
if (devm_gpio_request(dev, bitbang->mdc, "mdc"))
goto out_free_bus;