]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: phy: introduce phy_id_compare_model() PHY ID helper
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 11 Sep 2025 13:08:31 +0000 (15:08 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sun, 14 Sep 2025 19:48:17 +0000 (12:48 -0700)
Similar to phy_id_compare_vendor(), introduce the equivalent
phy_id_compare_model() helper for the generic PHY ID Model mask.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://patch.msgid.link/20250911130840.23569-1-ansuelsmth@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/phy.h

index 04553419adc3ffbacd8b1f60415069c4151eefd7..6f3b25cb7f4e8b2d3d48f83e8ec6c70de4826b82 100644 (file)
@@ -1308,6 +1308,19 @@ static inline bool phy_id_compare_vendor(u32 id, u32 vendor_mask)
        return phy_id_compare(id, vendor_mask, PHY_ID_MATCH_VENDOR_MASK);
 }
 
+/**
+ * phy_id_compare_model - compare @id with @model mask
+ * @id: PHY ID
+ * @model_mask: PHY Model mask
+ *
+ * Return: true if the bits from @id match @model using the
+ *        generic PHY Model mask.
+ */
+static inline bool phy_id_compare_model(u32 id, u32 model_mask)
+{
+       return phy_id_compare(id, model_mask, PHY_ID_MATCH_MODEL_MASK);
+}
+
 /**
  * phydev_id_compare - compare @id with the PHY's Clause 22 ID
  * @phydev: the PHY device