linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	richardcochran@gmail.com, o.rempel@pengutronix.de,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/4] net: phy: micrel: Replace hardcoded pages with defines
Date: Thu, 24 Jul 2025 21:45:29 +0100	[thread overview]
Message-ID: <aIKbaS8ASndR7Xe_@shell.armlinux.org.uk> (raw)
In-Reply-To: <20250724200826.2662658-4-horatiu.vultur@microchip.com>

On Thu, Jul 24, 2025 at 10:08:25PM +0200, Horatiu Vultur wrote:
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index b04c471c11a4a..d20f028106b7d 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -2788,6 +2788,13 @@ static int ksz886x_cable_test_get_status(struct phy_device *phydev,
>  	return ret;
>  }
>  
> +#define LAN_EXT_PAGE_0					0
> +#define LAN_EXT_PAGE_1					1
> +#define LAN_EXT_PAGE_2					2
> +#define LAN_EXT_PAGE_4					4
> +#define LAN_EXT_PAGE_5					5
> +#define LAN_EXT_PAGE_31					31

I don't see the point of this change. This is almost as bad as:

#define ZERO 0
#define ONE 1
#define TWO 2
#define THREE 3
...
#define ONE_HUNDRED_AND_FIFTY_FIVE 155
etc

It doesn't give us any new information, and just adds extra clutter,
making the code less readable.

The point of using register definitions is to describe the purpose
of the number, giving the number a meaning, not to just hide the
number because we don't want to see such things in C code.

I'm sorry if you were asked to do this in v1, but I think if you
were asked to do it, it would've been assuming that the definitions
could be more meaningful.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2025-07-24 20:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24 20:08 [PATCH net-next v2 0/4] net: phy: micrel: Add support for lan8842 Horatiu Vultur
2025-07-24 20:08 ` [PATCH net-next v2 1/4] net: phy: micrel: Start using PHY_ID_MATCH_MODEL Horatiu Vultur
2025-07-24 20:08 ` [PATCH net-next v2 2/4] net: phy: micrel: Introduce lanphy_modify_page_reg Horatiu Vultur
2025-07-24 20:41   ` Russell King (Oracle)
2025-07-25  6:43     ` Horatiu Vultur
2025-07-24 20:08 ` [PATCH net-next v2 3/4] net: phy: micrel: Replace hardcoded pages with defines Horatiu Vultur
2025-07-24 20:45   ` Russell King (Oracle) [this message]
2025-07-25  6:48     ` Horatiu Vultur
2025-07-26  6:21       ` Oleksij Rempel
2025-07-28  6:56         ` Horatiu Vultur
2025-07-24 20:08 ` [PATCH net-next v2 4/4] net: phy: micrel: Add support for lan8842 Horatiu Vultur
2025-07-26 11:53   ` ALOK TIWARI
2025-07-28  6:48     ` Horatiu Vultur

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=aIKbaS8ASndR7Xe_@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).