On Sun, Aug 24, 2025 at 06:08:34PM +0200, Andrew Lunn wrote:
On Sat, Aug 23, 2025 at 03:44:28PM +0200, Christian Marangi wrote:
quoted
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>
quoted
+/**
+ * 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.
Thanks for pointing this out, I wasn't sure to add a _model() variant as
there wasn't an user for it. I will submit a new series after this gets
merged introducing also this variant.
--
Ansuel