public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Csókás Bence" <csokas.bence@prolan.hu>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<trivial@kernel.org>, Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>
Subject: Re: [RFC PATCH 1/2] net: include: mii: Refactor: Define LPA_* in terms of ADVERTISE_*
Date: Wed, 5 Jun 2024 15:37:51 +0200	[thread overview]
Message-ID: <3f9b6129-e81e-4cc1-93ff-9d4cc6ffc035@prolan.hu> (raw)
In-Reply-To: <331930db-f5a1-4ad7-947f-7aaf5618c646@lunn.ch>

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


      reply	other threads:[~2024-06-05 13:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 12:16 [RFC PATCH 1/2] net: include: mii: Refactor: Define LPA_* in terms of ADVERTISE_* Csókás, Bence
2024-06-05 12:16 ` [RFC PATCH 2/2] net: include: mii: Refactor: Use BIT() for ADVERTISE_* bits Csókás, Bence
2024-06-05 14:13   ` Vladimir Oltean
2024-06-05 14:47     ` Csókás Bence
2024-06-05 15:31       ` Vladimir Oltean
2024-06-05 16:48       ` Andrew Lunn
2024-06-05 12:51 ` [RFC PATCH 1/2] net: include: mii: Refactor: Define LPA_* in terms of ADVERTISE_* Andrew Lunn
2024-06-05 13:37   ` Csókás Bence [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f9b6129-e81e-4cc1-93ff-9d4cc6ffc035@prolan.hu \
    --to=csokas.bence@prolan.hu \
    --cc=andrew@lunn.ch \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox