[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f9b6129-e81e-4cc1-93ff-9d4cc6ffc035@prolan.hu>
Date: Wed, 5 Jun 2024 15:37:51 +0200
From: Csókás Bence <csokas.bence@...lan.hu>
To: Andrew Lunn <andrew@...n.ch>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<trivial@...nel.org>, Heiner Kallweit <hkallweit1@...il.com>, Russell King
<linux@...linux.org.uk>
Subject: Re: [RFC PATCH 1/2] net: include: mii: Refactor: Define LPA_* in
terms of ADVERTISE_*
Hi!
On 6/5/24 14:51, Andrew Lunn wrote:
> On Wed, Jun 05, 2024 at 02:16:47PM +0200, Csókás, Bence wrote:
>> Ethernet specification mandates that these bits will be equal.
>> To reduce the amount of magix hex'es in the code, just define
>> them in terms of each other.
>
> Are magic hexes in this context actually bad?
Yes, as if it ever needs to be changed (for instance in the 2/2 of the
series, when I replaced them with BIT() macros), it needs to be changed
twice in the file.
> In .c files i would
> agree. But what you have in effect done is force me into jump another
> hoop to find the actual hex value so i can manually decode a register
> value.
True. I expected this concern, hence why I tagged this as RFC. However,
I believe that from a maintainability perspective, it's best to only
have one definition, and since these #define's are right under one
another, the "jumping around" is minimal anyways.
> And you have made the compile slightly slower.
C'mon, that's negligible. The time it takes to load the header file from
disk will probably take longer than it does to resolve an extra layer of
simple #define's.
> These defines have been like this since the beginning of the git
> history. Is there a good reason to change them after all that time?
Just because something was "always like this" doesn't mean that it
cannot be changed. Especially since this patch is 100%
backwards-compatible, just maybe slightly more future-proof.
> Andrew
>
Bence
Powered by blists - more mailing lists