linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: Propagate error from bus->reset
@ 2020-04-19  3:17 Florian Fainelli
  2020-04-19 15:15 ` Andrew Lunn
  2020-04-20 18:55 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Fainelli @ 2020-04-19  3:17 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, open list

If a bus->reset() call for the mii_bus structure returns an error (e.g.:
-EPROE_DEFER) we should propagate it accordingly.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/mdio_bus.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 7a4eb3f2cb74..346e88435d29 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -627,8 +627,11 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
 		gpiod_set_value_cansleep(gpiod, 0);
 	}
 
-	if (bus->reset)
-		bus->reset(bus);
+	if (bus->reset) {
+		err = bus->reset(bus);
+		if (err)
+			goto error_reset_gpiod;
+	}
 
 	for (i = 0; i < PHY_MAX_ADDR; i++) {
 		if ((bus->phy_mask & (1 << i)) == 0) {
@@ -657,7 +660,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
 		mdiodev->device_remove(mdiodev);
 		mdiodev->device_free(mdiodev);
 	}
-
+error_reset_gpiod:
 	/* Put PHYs in RESET to save power */
 	if (bus->reset_gpiod)
 		gpiod_set_value_cansleep(bus->reset_gpiod, 1);
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: Propagate error from bus->reset
  2020-04-19  3:17 [PATCH net-next] net: phy: Propagate error from bus->reset Florian Fainelli
@ 2020-04-19 15:15 ` Andrew Lunn
  2020-04-20 18:55 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2020-04-19 15:15 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Heiner Kallweit, Russell King, David S. Miller, open list

On Sat, Apr 18, 2020 at 08:17:13PM -0700, Florian Fainelli wrote:
> If a bus->reset() call for the mii_bus structure returns an error (e.g.:
> -EPROE_DEFER) we should propagate it accordingly.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: Propagate error from bus->reset
  2020-04-19  3:17 [PATCH net-next] net: phy: Propagate error from bus->reset Florian Fainelli
  2020-04-19 15:15 ` Andrew Lunn
@ 2020-04-20 18:55 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-04-20 18:55 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, hkallweit1, linux, linux-kernel

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Sat, 18 Apr 2020 20:17:13 -0700

> If a bus->reset() call for the mii_bus structure returns an error (e.g.:
> -EPROE_DEFER) we should propagate it accordingly.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-20 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19  3:17 [PATCH net-next] net: phy: Propagate error from bus->reset Florian Fainelli
2020-04-19 15:15 ` Andrew Lunn
2020-04-20 18:55 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).