[13/19] usbnet: smsc95xx: Replace smsc95xx_link_ok_nopm()
diff mbox series

Message ID 20190103011040.25974-14-marex@denx.de
State Changes Requested
Delegated to: David Miller
Headers show
Series
  • [01/19] usbnet: smsc95xx: Fix memory leak in smsc95xx_bind
Related show

Commit Message

Marek Vasut Jan. 3, 2019, 1:10 a.m. UTC
Replace the function with genphy_update_link(), since that's really
all that it is.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Nisar Sayed <Nisar.Sayed@microchip.com>
Cc: Woojung Huh <Woojung.Huh@microchip.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-usb@vger.kernel.org
To: netdev@vger.kernel.org
---
 drivers/net/usb/smsc95xx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index fa33eda61275..401662f28f01 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1427,16 +1427,11 @@  static int smsc95xx_link_ok_nopm(struct usbnet *dev)
 	struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
 	int ret;
 
-	/* first, a dummy read, needed to latch some MII phys */
-	ret = phy_read(pdata->phydev, MII_BMSR);
-	if (ret < 0)
-		return ret;
-
-	ret = phy_read(pdata->phydev, MII_BMSR);
-	if (ret < 0)
+	ret = genphy_update_link(pdata->phydev);
+	if (ret)
 		return ret;
 
-	return !!(ret & BMSR_LSTATUS);
+	return pdata->phydev->link;
 }
 
 static int smsc95xx_enter_suspend0(struct usbnet *dev)