lkml.org 
[lkml]   [2022]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC Patch net-next 1/3] net: phy: lan87xx: added lan87xx_update_link routine
Date
The LAN87xx phydev->link has been updated via lan87xx_read_status
routine. To get only the recent phydev->link status instead of various
other status, refactored the code to have separate lan87xx_update_link
routine.

Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
drivers/net/phy/microchip_t1.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index 389df3f4293c..bb4514254adc 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -674,7 +674,7 @@ static int lan87xx_cable_test_get_status(struct phy_device *phydev,
return 0;
}

-static int lan87xx_read_status(struct phy_device *phydev)
+static int lan87xx_update_link(struct phy_device *phydev)
{
int rc = 0;

@@ -687,6 +687,17 @@ static int lan87xx_read_status(struct phy_device *phydev)
else
phydev->link = 0;

+ return rc;
+}
+
+static int lan87xx_read_status(struct phy_device *phydev)
+{
+ int rc = 0;
+
+ rc = lan87xx_update_link(phydev);
+ if (rc < 0)
+ return rc;
+
phydev->speed = SPEED_UNKNOWN;
phydev->duplex = DUPLEX_UNKNOWN;
phydev->pause = 0;
--
2.33.0
\
 
 \ /
  Last update: 2022-03-21 16:57    [W:0.074 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site