mdio_bus: Simplify reset handling and extend to non-DT systems

Convert mdiobus_register_reset() from open-coded DT-only optional reset
handling to reset_control_get_optional_exclusive().  This not only
simplifies the code, but also adds support for lookup-based resets on
non-DT systems.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Geert Uytterhoeven 2020-01-13 14:05:29 +01:00 коммит произвёл David S. Miller
Родитель e27f178793
Коммит 621400366b
1 изменённых файлов: 4 добавлений и 10 удалений

Просмотреть файл

@ -59,17 +59,11 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
static int mdiobus_register_reset(struct mdio_device *mdiodev) static int mdiobus_register_reset(struct mdio_device *mdiodev)
{ {
struct reset_control *reset = NULL; struct reset_control *reset;
if (mdiodev->dev.of_node) reset = reset_control_get_optional_exclusive(&mdiodev->dev, "phy");
reset = of_reset_control_get_exclusive(mdiodev->dev.of_node, if (IS_ERR(reset))
"phy"); return PTR_ERR(reset);
if (IS_ERR(reset)) {
if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOTSUPP)
reset = NULL;
else
return PTR_ERR(reset);
}
mdiodev->reset_ctrl = reset; mdiodev->reset_ctrl = reset;