netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: "David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>, Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	Arun Ramadoss <arun.ramadoss@microchip.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Yuiko Oshino <yuiko.oshino@microchip.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, UNGLinuxDriver@microchip.com
Subject: [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link
Date: Wed,  3 Jul 2024 15:28:01 +0200	[thread overview]
Message-ID: <20240703132801.623218-2-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20240703132801.623218-1-o.rempel@pengutronix.de>

Do not report SQI if no link is detected. Otherwise ethtool will show
non zero value even if no cable is attached.

Fixes: b649695248b15 ("net: phy: LAN87xx: add ethtool SQI support")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/microchip_t1.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index a35528497a576..22530a5b76365 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -840,6 +840,9 @@ static int lan87xx_get_sqi(struct phy_device *phydev)
 	u8 sqi_value = 0;
 	int rc;
 
+	if (!phydev->link)
+		return 0;
+
 	rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE,
 			 PHYACC_ATTR_BANK_DSP, T1_COEF_RW_CTL_CFG, 0x0301);
 	if (rc < 0)
-- 
2.39.2


  reply	other threads:[~2024-07-03 13:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 13:28 [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Oleksij Rempel
2024-07-03 13:28 ` Oleksij Rempel [this message]
2024-07-03 14:01   ` [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link Michal Kubiak
2024-07-03 18:57   ` Andrew Lunn
2024-07-03 19:26     ` Woojung.Huh
2024-07-03 14:00 ` [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Michal Kubiak
2024-07-03 18:48 ` Andrew Lunn
2024-07-04 14:52 ` Florian Fainelli
2024-07-04 14:54 ` Florian Fainelli

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=20240703132801.623218-2-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=arun.ramadoss@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=woojung.huh@microchip.com \
    --cc=yuiko.oshino@microchip.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;
as well as URLs for NNTP newsgroup(s).