The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Arun Ramadoss <arun.ramadoss@microchip.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Russell King <linux@armlinux.org.uk>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>, <UNGLinuxDriver@microchip.com>
Subject: [RFC Patch net-next 1/3] net: phy: lan87xx: added lan87xx_update_link routine
Date: Mon, 21 Mar 2022 21:23:35 +0530	[thread overview]
Message-ID: <20220321155337.16260-2-arun.ramadoss@microchip.com> (raw)
In-Reply-To: <20220321155337.16260-1-arun.ramadoss@microchip.com>

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


  reply	other threads:[~2022-03-21 15:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 15:53 [RFC Patch net-next 0/3] add ethtool SQI support for LAN87xx T1 Phy Arun Ramadoss
2022-03-21 15:53 ` Arun Ramadoss [this message]
2022-03-21 15:53 ` [RFC Patch net-next 2/3] net: phy: lan937x: added PHY_POLL_CABLE_TEST flag Arun Ramadoss
2022-03-21 15:53 ` [RFC Patch net-next 3/3] net: phy: lan87xx: added ethtool SQI support Arun Ramadoss
2022-03-21 18:36   ` Andrew Lunn
2022-03-24 15:48     ` Arun.Ramadoss
2022-03-24 16:06       ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220321155337.16260-2-arun.ramadoss@microchip.com \
    --to=arun.ramadoss@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox