* [PATCH] mdio_bus: Simplify reset handling and extend to non-DT systems
@ 2020-01-13 13:05 Geert Uytterhoeven
2020-01-13 13:28 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2020-01-13 13:05 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Heiner Kallweit
Cc: David S . Miller, Philipp Zabel, netdev, linux-kernel,
Geert Uytterhoeven
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>
---
Only tested on systems without PHY resets, with and without
CONFIG_RESET_CONTROLLER=y.
drivers/net/phy/mdio_bus.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 229e480179ff1de4..8d753bb07227e561 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;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mdio_bus: Simplify reset handling and extend to non-DT systems
2020-01-13 13:05 [PATCH] mdio_bus: Simplify reset handling and extend to non-DT systems Geert Uytterhoeven
@ 2020-01-13 13:28 ` Andrew Lunn
2020-01-13 14:02 ` Philipp Zabel
2020-01-14 19:03 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2020-01-13 13:28 UTC (permalink / raw)
To: Geert Uytterhoeven, David Bauer
Cc: Florian Fainelli, Heiner Kallweit, David S . Miller,
Philipp Zabel, netdev, linux-kernel
On Mon, Jan 13, 2020 at 02:05:29PM +0100, Geert Uytterhoeven wrote:
> 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>
> ---
> Only tested on systems without PHY resets, with and without
> CONFIG_RESET_CONTROLLER=y.
David, please could you test this.
But it Looks O.K. to me.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mdio_bus: Simplify reset handling and extend to non-DT systems
2020-01-13 13:05 [PATCH] mdio_bus: Simplify reset handling and extend to non-DT systems Geert Uytterhoeven
2020-01-13 13:28 ` Andrew Lunn
@ 2020-01-13 14:02 ` Philipp Zabel
2020-01-14 19:03 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2020-01-13 14:02 UTC (permalink / raw)
To: Geert Uytterhoeven, Andrew Lunn, Florian Fainelli, Heiner Kallweit
Cc: David S . Miller, netdev, linux-kernel
On Mon, 2020-01-13 at 14:05 +0100, Geert Uytterhoeven wrote:
> 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>
> ---
> Only tested on systems without PHY resets, with and without
> CONFIG_RESET_CONTROLLER=y.
>
> drivers/net/phy/mdio_bus.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 229e480179ff1de4..8d753bb07227e561 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);
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mdio_bus: Simplify reset handling and extend to non-DT systems
2020-01-13 13:05 [PATCH] mdio_bus: Simplify reset handling and extend to non-DT systems Geert Uytterhoeven
2020-01-13 13:28 ` Andrew Lunn
2020-01-13 14:02 ` Philipp Zabel
@ 2020-01-14 19:03 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-01-14 19:03 UTC (permalink / raw)
To: geert+renesas
Cc: andrew, f.fainelli, hkallweit1, p.zabel, netdev, linux-kernel
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Mon, 13 Jan 2020 14:05:29 +0100
> 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>
Applied to net-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-14 19:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13 13:05 [PATCH] mdio_bus: Simplify reset handling and extend to non-DT systems Geert Uytterhoeven
2020-01-13 13:28 ` Andrew Lunn
2020-01-13 14:02 ` Philipp Zabel
2020-01-14 19:03 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.