[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-ZeRhR73FS4iOzz@shell.armlinux.org.uk>
Date: Fri, 28 Mar 2025 08:31:02 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
Marek BehĂșn <kabel@...nel.org>,
Andrei Botila <andrei.botila@....nxp.com>,
Sabrina Dubroca <sd@...asysnail.net>,
Daniel Golle <daniel@...rotopia.org>,
Eric Woudstra <ericwouds@...il.com>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [net-next RFC PATCH v4 3/6] net: phy: nxp-c45-tja11xx: simplify
.match_phy_device OP
On Thu, Mar 27, 2025 at 11:45:14PM +0100, Christian Marangi wrote:
> Simplify .match_phy_device OP by using a generic function and using the
> new phy_id PHY driver info instead of hardcoding the matching PHY ID
> with new variant for macsec and no_macsec PHYs.
>
> Also make use of PHY_ID_MATCH_MODEL macro and drop PHY_ID_MASK define to
> introduce phy_id and phy_id_mask again in phy_driver struct.
>
> Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> ---
> drivers/net/phy/nxp-c45-tja11xx.c | 39 +++++++++++--------------------
> 1 file changed, 14 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
> index bc2b7cc0cebe..fccfc1468698 100644
> --- a/drivers/net/phy/nxp-c45-tja11xx.c
> +++ b/drivers/net/phy/nxp-c45-tja11xx.c
> @@ -19,7 +19,6 @@
>
> #include "nxp-c45-tja11xx.h"
>
> -#define PHY_ID_MASK GENMASK(31, 4)
> /* Same id: TJA1103, TJA1104 */
> #define PHY_ID_TJA_1103 0x001BB010
> /* Same id: TJA1120, TJA1121 */
> @@ -1971,31 +1970,17 @@ static int nxp_c45_macsec_ability(struct phy_device *phydev)
> return macsec_ability;
> }
>
> -static int tja1103_match_phy_device(struct phy_device *phydev,
> - const struct phy_driver *phydrv)
> +static int tja11xx_no_macsec_match_phy_device(struct phy_device *phydev,
> + const struct phy_driver *phydrv)
> {
> - return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1103, PHY_ID_MASK) &&
> + return phy_id_compare(phydev->phy_id, phydrv->phy_id, phydrv->phy_id_mask) &&
We try to keep to less than 80 columns in networking, and this driver
does so, so please keep it that way.
(Note: the 80 column limit doesn't apply to printing messages, which
should not be line-wrapped to allow them to be searched for).
Other than that, thanks for addressing the other driver I pointed out
that benefits from this.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists