linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: mscc: use mdiobus_get_phy()
@ 2020-04-19  8:27 Michael Walle
  2020-04-19 15:23 ` Andrew Lunn
  2020-04-20 19:07 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Walle @ 2020-04-19  8:27 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Russell King,
	David S . Miller, Vladimir Oltean, Michael Walle

Don't use internal knowledge of the mdio bus core, instead use
mdiobus_get_phy() which does the same thing.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/phy/mscc/mscc_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
index acddef79f4e8..5391acdece05 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -1292,7 +1292,7 @@ static int vsc8584_config_pre_init(struct phy_device *phydev)
  */
 static bool vsc8584_is_pkg_init(struct phy_device *phydev, bool reversed)
 {
-	struct mdio_device **map = phydev->mdio.bus->mdio_map;
+	struct mii_bus *bus = phydev->mdio.bus;
 	struct vsc8531_private *vsc8531;
 	struct phy_device *phy;
 	int i, addr;
@@ -1306,11 +1306,10 @@ static bool vsc8584_is_pkg_init(struct phy_device *phydev, bool reversed)
 		else
 			addr = vsc8531->base_addr + i;
 
-		if (!map[addr])
+		phy = mdiobus_get_phy(bus, addr);
+		if (!phy)
 			continue;
 
-		phy = container_of(map[addr], struct phy_device, mdio);
-
 		if ((phy->phy_id & phydev->drv->phy_id_mask) !=
 		    (phydev->drv->phy_id & phydev->drv->phy_id_mask))
 			continue;
-- 
2.20.1


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

* Re: [PATCH net-next] net: phy: mscc: use mdiobus_get_phy()
  2020-04-19  8:27 [PATCH net-next] net: phy: mscc: use mdiobus_get_phy() Michael Walle
@ 2020-04-19 15:23 ` Andrew Lunn
  2020-04-20 19:07 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2020-04-19 15:23 UTC (permalink / raw)
  To: Michael Walle
  Cc: netdev, linux-kernel, Florian Fainelli, Heiner Kallweit,
	Russell King, David S . Miller, Vladimir Oltean

On Sun, Apr 19, 2020 at 10:27:57AM +0200, Michael Walle wrote:
> Don't use internal knowledge of the mdio bus core, instead use
> mdiobus_get_phy() which does the same thing.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Thanks Michael

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

    Andrew

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

* Re: [PATCH net-next] net: phy: mscc: use mdiobus_get_phy()
  2020-04-19  8:27 [PATCH net-next] net: phy: mscc: use mdiobus_get_phy() Michael Walle
  2020-04-19 15:23 ` Andrew Lunn
@ 2020-04-20 19:07 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-04-20 19:07 UTC (permalink / raw)
  To: michael
  Cc: netdev, linux-kernel, andrew, f.fainelli, hkallweit1, linux,
	vladimir.oltean

From: Michael Walle <michael@walle.cc>
Date: Sun, 19 Apr 2020 10:27:57 +0200

> Don't use internal knowledge of the mdio bus core, instead use
> mdiobus_get_phy() which does the same thing.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Applied, thanks.

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19  8:27 [PATCH net-next] net: phy: mscc: use mdiobus_get_phy() Michael Walle
2020-04-19 15:23 ` Andrew Lunn
2020-04-20 19:07 ` 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).