]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: phy: improve phy_driver_is_genphy
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 14 Jun 2025 20:31:57 +0000 (22:31 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 17 Jun 2025 01:15:16 +0000 (18:15 -0700)
Use new flag phydev->is_genphy_driven to simplify this function.
Note that this includes a minor functional change:
Now this function returns true if ANY of the genphy drivers
is bound to the PHY device.

We have only one user in DSA driver mt7530, and there the
functional change doesn't matter.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/c9ac3a7d-262a-425d-9153-97fe3ca6280a@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phy_device.c
include/linux/phy.h

index 2aae97b2ffd8bcfff84f088334c836265bff690a..fa0890ebf2eae71da0d3dc92397dd5d86dfde3e3 100644 (file)
@@ -1729,13 +1729,6 @@ static bool phy_driver_is_genphy_kind(struct phy_device *phydev,
        return ret;
 }
 
-bool phy_driver_is_genphy(struct phy_device *phydev)
-{
-       return phy_driver_is_genphy_kind(phydev,
-                                        &genphy_driver.mdiodrv.driver);
-}
-EXPORT_SYMBOL_GPL(phy_driver_is_genphy);
-
 bool phy_driver_is_genphy_10g(struct phy_device *phydev)
 {
        return phy_driver_is_genphy_kind(phydev,
index 32ed27f10639a3ddca807f53ed245960fb241337..97a09e5743ef5b8b4324a9adb43b5f09e5c18008 100644 (file)
@@ -1295,6 +1295,17 @@ static inline bool phy_is_started(struct phy_device *phydev)
        return phydev->state >= PHY_UP;
 }
 
+/**
+ * phy_driver_is_genphy - Convenience function to check whether PHY is driven
+ *                        by one of the generic PHY drivers
+ * @phydev: The phy_device struct
+ * Return: true if PHY is driven by one of the genphy drivers
+ */
+static inline bool phy_driver_is_genphy(struct phy_device *phydev)
+{
+       return phydev->is_genphy_driven;
+}
+
 /**
  * phy_disable_eee_mode - Don't advertise an EEE mode.
  * @phydev: The phy_device struct
@@ -2097,7 +2108,6 @@ module_exit(phy_module_exit)
 #define module_phy_driver(__phy_drivers)                               \
        phy_module_driver(__phy_drivers, ARRAY_SIZE(__phy_drivers))
 
-bool phy_driver_is_genphy(struct phy_device *phydev);
 bool phy_driver_is_genphy_10g(struct phy_device *phydev);
 
 #endif /* __PHY_H */