diff mbox series

[net-next,v2,3/5] net: phylink: allow mac_select_pcs() to remove a PCS

Message ID E1t10na-000AWc-M6@rmk-PC.armlinux.org.uk (mailing list archive)
State Accepted
Commit 486dc391ef439d45db3f7eda2229560fd2b52a78
Delegated to: Netdev Maintainers
Headers show
Series Removing more phylink cruft | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5 this patch: 5
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
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: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 19 this patch: 19
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-17--00-00 (tests: 776)

Commit Message

Russell King (Oracle) Oct. 16, 2024, 9:58 a.m. UTC
phylink has historically not permitted a PCS to be removed. An attempt
to permit this with phylink_set_pcs() resulted in comments indicating
that there was no need for this. This behaviour has been propagated
forward to the mac_select_pcs() approach as it was believed from these
comments that changing this would be NAK'd.

However, with mac_select_pcs(), it takes more code and thus complexity
to maintain this behaviour, which can - and in this case has - resulted
in a bug. If mac_select_pcs() returns NULL for a particular interface
type, but there is already a PCS in-use, then we skip the pcs_validate()
method, but continue using the old PCS. Also, it wouldn't be expected
behaviour by implementers of mac_select_pcs().

Allow this by removing this old unnecessary restriction.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phylink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vladimir Oltean Oct. 17, 2024, 7 a.m. UTC | #1
On Wed, Oct 16, 2024 at 10:58:34AM +0100, Russell King (Oracle) wrote:
> phylink has historically not permitted a PCS to be removed. An attempt
> to permit this with phylink_set_pcs() resulted in comments indicating
> that there was no need for this. This behaviour has been propagated
> forward to the mac_select_pcs() approach as it was believed from these
> comments that changing this would be NAK'd.
> 
> However, with mac_select_pcs(), it takes more code and thus complexity
> to maintain this behaviour, which can - and in this case has - resulted
> in a bug. If mac_select_pcs() returns NULL for a particular interface
> type, but there is already a PCS in-use, then we skip the pcs_validate()
> method, but continue using the old PCS. Also, it wouldn't be expected
> behaviour by implementers of mac_select_pcs().
> 
> Allow this by removing this old unnecessary restriction.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 24a3144e870a..aa1139efc7e4 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1184,7 +1184,7 @@  static void phylink_major_config(struct phylink *pl, bool restart,
 			return;
 		}
 
-		pcs_changed = pcs && pl->pcs != pcs;
+		pcs_changed = pl->pcs != pcs;
 	}
 
 	phylink_pcs_poll_stop(pl);