summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2020-01-13 14:05:29 +0100
committerDavid S. Miller <davem@davemloft.net>2020-01-14 11:03:10 -0800
commit621400366bdba122b37bfa5f5a64ebfd07919a4a (patch)
tree3e8cedb8d981ad024c5002aa59c1ea170b1943a3
parente27f178793de16ca1b421f2c3f4bc3497b2ce723 (diff)
downloadblackbird-op-linux-621400366bdba122b37bfa5f5a64ebfd07919a4a.tar.gz
blackbird-op-linux-621400366bdba122b37bfa5f5a64ebfd07919a4a.zip
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>
-rw-r--r--drivers/net/phy/mdio_bus.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 229e480179ff..8d753bb07227 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -59,17 +59,11 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
static int mdiobus_register_reset(struct mdio_device *mdiodev)
{
- struct reset_control *reset = NULL;
-
- if (mdiodev->dev.of_node)
- reset = of_reset_control_get_exclusive(mdiodev->dev.of_node,
- "phy");
- if (IS_ERR(reset)) {
- if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOTSUPP)
- reset = NULL;
- else
- return PTR_ERR(reset);
- }
+ struct reset_control *reset;
+
+ reset = reset_control_get_optional_exclusive(&mdiodev->dev, "phy");
+ if (IS_ERR(reset))
+ return PTR_ERR(reset);
mdiodev->reset_ctrl = reset;
OpenPOWER on IntegriCloud