# Re: \[net-next PATCH v2 1/2\] net: phy: introduce phy\_id\_compare\_vendor() PHY ID helper

- From: Andrew Lunn \<andrew@lunn.ch\>
- Date: 2025-08-24 16:08:42 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/08/3184619
- Thread: https://ratatoskr.run/netdev/2025/08/3183986/t.md

```text
On Sat, Aug 23, 2025 at 03:44:28PM +0200, Christian Marangi wrote:
> Introduce phy_id_compare_vendor() PHY ID helper to compare a PHY ID with
> the PHY ID Vendor using the generic PHY ID Vendor mask.
> 
> While at it also rework the PHY_ID_MATCH macro and move the mask to
> dedicated define so that PHY driver can make use of the mask if needed.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>

Hi Christian

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

> +/**
> + * phy_id_compare_vendor - compare @id with @vendor mask
> + * @id: PHY ID
> + * @vendor_mask: PHY Vendor mask
> + *
> + * Return: true if the bits from @id match @vendor using the
> + *	   generic PHY Vendor mask.
> + */
> +static inline bool phy_id_compare_vendor(u32 id, u32 vendor_mask)
> +{
> +	return phy_id_compare(id, vendor_mask, PHY_ID_MATCH_VENDOR_MASK);
> +}
> +

broadcom.c:	if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
broadcom.c:	    BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) {
broadcom.c:	if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM57780) {
broadcom.c:	if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
broadcom.c:	     BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) &&
broadcom.c:		if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E ||
broadcom.c:		    BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 ||
broadcom.c:		    BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811)
broadcom.c:	if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
broadcom.c:	     BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) &&

It looks like there is a use case of phy_id_compare_model(), if you
feel like adding it.

	Andrew
```
