Re: [PATCH] net: phylink: Separating two unrelated definitions for improving code readability
From: Vladimir Oltean
Date: Thu Nov 21 2024 - 05:51:03 EST
On Wed, Nov 20, 2024 at 05:46:14PM +0800, Cong Yi wrote:
> 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.
For the record, I agree that tying together unrelated constants inside
the same anonymous enum and resetting the counter is a confusing coding
pattern, to which I don't see the benefit. Separating them and giving
names to the enums also gives the opportunity for stronger typing, which
was done here. I think the patch (or at least its idea) is ok.