diff mbox series

net: phylink: don't try to stop halted PHY

Message ID 20221201175302.2732938-1-l.stach@pengutronix.de (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series net: phylink: don't try to stop halted PHY | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 4 maintainers not CCed: edumazet@google.com davem@davemloft.net pabeni@redhat.com kuba@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Lucas Stach Dec. 1, 2022, 5:53 p.m. UTC
When the PHY driver has encountered a non-recoverable error condition, e.g
due to a failure in MDIO communication it may have already halted the PHY
by calling phy_error(). If that is the case then phylink should not try to
stop the PHY again.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/net/phy/phylink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Russell King (Oracle) Dec. 1, 2022, 6:09 p.m. UTC | #1
On Thu, Dec 01, 2022 at 06:53:02PM +0100, Lucas Stach wrote:
> When the PHY driver has encountered a non-recoverable error condition, e.g
> due to a failure in MDIO communication it may have already halted the PHY
> by calling phy_error(). If that is the case then phylink should not try to
> stop the PHY again.

No. phylib doesn't say this is necessary, and if you grep the many
network drivers, they don't do such a test.

If we want to do this then obviously all network drivers need to be
updated to do the same test before calling phy_stop()... but it would
be better if phylib avoided being rather silly in this case.
diff mbox series

Patch

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 6547b6cc6cbe..1e2be9197567 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1935,7 +1935,7 @@  void phylink_stop(struct phylink *pl)
 
 	if (pl->sfp_bus)
 		sfp_upstream_stop(pl->sfp_bus);
-	if (pl->phydev)
+	if (pl->phydev && phy_is_started(pl->phydev))
 		phy_stop(pl->phydev);
 	del_timer_sync(&pl->link_poll);
 	if (pl->link_irq) {