Commit fe0e4052 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by David S. Miller

mdio_bus: use devm_gpiod_get_optional()

The MDIO reset GPIO is really a classical optional GPIO property case,
so devm_gpiod_get_optional() should have been used, not devm_gpiod_get().
Doing this  saves several LoCs...
Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d396e84c
...@@ -354,16 +354,12 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) ...@@ -354,16 +354,12 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
mutex_init(&bus->mdio_lock); mutex_init(&bus->mdio_lock);
/* de-assert bus level PHY GPIO reset */ /* de-assert bus level PHY GPIO reset */
gpiod = devm_gpiod_get(&bus->dev, "reset", GPIOD_OUT_LOW); gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(gpiod)) { if (IS_ERR(gpiod)) {
err = PTR_ERR(gpiod); dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
if (err != -ENOENT) { bus->id);
dev_err(&bus->dev, return PTR_ERR(gpiod);
"mii_bus %s couldn't get reset GPIO\n", } else if (gpiod) {
bus->id);
return err;
}
} else {
bus->reset_gpiod = gpiod; bus->reset_gpiod = gpiod;
gpiod_set_value_cansleep(gpiod, 1); gpiod_set_value_cansleep(gpiod, 1);
......
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