Skip to content

Commit 6214003

Browse files
geertudavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Philipp Zabel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e27f178 commit 6214003

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,11 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
5959

6060
static int mdiobus_register_reset(struct mdio_device *mdiodev)
6161
{
62-
struct reset_control *reset = NULL;
63-
64-
if (mdiodev->dev.of_node)
65-
reset = of_reset_control_get_exclusive(mdiodev->dev.of_node,
66-
"phy");
67-
if (IS_ERR(reset)) {
68-
if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOTSUPP)
69-
reset = NULL;
70-
else
71-
return PTR_ERR(reset);
72-
}
62+
struct reset_control *reset;
63+
64+
reset = reset_control_get_optional_exclusive(&mdiodev->dev, "phy");
65+
if (IS_ERR(reset))
66+
return PTR_ERR(reset);
7367

7468
mdiodev->reset_ctrl = reset;
7569

0 commit comments

Comments
 (0)