* [PATCH] net: phylink: Separating two unrelated definitions for improving code readability
@ 2024-11-20 6:27 Cong Yi
2024-11-20 8:48 ` Russell King (Oracle)
0 siblings, 1 reply; 3+ messages in thread
From: Cong Yi @ 2024-11-20 6:27 UTC (permalink / raw)
To: linux, andrew, hkallweit1; +Cc: netdev, linux-kernel, Cong Yi
From: Cong Yi <yicong@kylinos.cn>
After the support of PCS state machine, phylink and pcs two
unrelated state enum definitions are put together, which brings
some confusion to code reading.
This patch defines the two separately.
Signed-off-by: Cong Yi <yicong@kylinos.cn>
---
drivers/net/phy/phylink.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 3e9957b6aa14..1c65fd29538d 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -30,11 +30,13 @@
(ADVERTISED_TP | ADVERTISED_MII | ADVERTISED_FIBRE | \
ADVERTISED_BNC | ADVERTISED_AUI | ADVERTISED_Backplane)
-enum {
+enum phylink_disable_state {
PHYLINK_DISABLE_STOPPED,
PHYLINK_DISABLE_LINK,
PHYLINK_DISABLE_MAC_WOL,
+};
+enum phylink_pcs_state {
PCS_STATE_DOWN = 0,
PCS_STATE_STARTING,
PCS_STATE_STARTED,
@@ -76,7 +78,7 @@ struct phylink {
struct phylink_link_state phy_state;
struct work_struct resolve;
unsigned int pcs_neg_mode;
- unsigned int pcs_state;
+ enum phylink_pcs_state pcs_state;
bool link_failed;
bool using_mac_select_pcs;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net: phylink: Separating two unrelated definitions for improving code readability
2024-11-20 6:27 [PATCH] net: phylink: Separating two unrelated definitions for improving code readability Cong Yi
@ 2024-11-20 8:48 ` Russell King (Oracle)
2024-11-20 9:46 ` Cong Yi
0 siblings, 1 reply; 3+ messages in thread
From: Russell King (Oracle) @ 2024-11-20 8:48 UTC (permalink / raw)
To: Cong Yi; +Cc: andrew, hkallweit1, netdev, linux-kernel, Cong Yi
On Wed, Nov 20, 2024 at 02:27:53PM +0800, Cong Yi wrote:
> From: Cong Yi <yicong@kylinos.cn>
>
> After the support of PCS state machine, phylink and pcs two
> unrelated state enum definitions are put together, which brings
> some confusion to code reading.
Hmm, so the definitions being prefixed with "PCS_STATE_" and the
variable being called "pcs_state" isn't enough?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phylink: Separating two unrelated definitions for improving code readability
2024-11-20 8:48 ` Russell King (Oracle)
@ 2024-11-20 9:46 ` Cong Yi
0 siblings, 0 replies; 3+ messages in thread
From: Cong Yi @ 2024-11-20 9:46 UTC (permalink / raw)
To: linux; +Cc: andrew, hkallweit1, linux-kernel, netdev, yicong
Hi, Russell King:
Thank you for your reply!
Yes, as you say, there is no problem with the definitions themselves
being named. When I just read from Linux-5.4 to 6.6, I thought
that PCS_STATE_ and PHYLINK_DISABLE- were associated in some way.
After reading the code carefully, I found that there was no correlation。
In order to avoid similar confusion, I sent this patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-20 9:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20 6:27 [PATCH] net: phylink: Separating two unrelated definitions for improving code readability Cong Yi
2024-11-20 8:48 ` Russell King (Oracle)
2024-11-20 9:46 ` Cong Yi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox