]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: phy: fixed_phy: add helper fixed_phy_register_100fd
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 30 Oct 2025 21:41:19 +0000 (22:41 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 5 Nov 2025 02:46:13 +0000 (18:46 -0800)
In few places a 100FD fixed PHY is used. Create a helper so that users
don't have to define the struct fixed_phy_status.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/bf564b19-e9bc-4896-aeae-9f721cc4fecd@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/fixed_phy.c
include/linux/phy_fixed.h

index 0e1b28f06f18987e69a6138788a8c6698881aa5e..bdc3a4bffededc1d560b6c367f8ca0efa448504e 100644 (file)
@@ -227,6 +227,18 @@ struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
 }
 EXPORT_SYMBOL_GPL(fixed_phy_register);
 
+struct phy_device *fixed_phy_register_100fd(void)
+{
+       static const struct fixed_phy_status status = {
+               .link   = 1,
+               .speed  = SPEED_100,
+               .duplex = DUPLEX_FULL,
+       };
+
+       return fixed_phy_register(&status, NULL);
+}
+EXPORT_SYMBOL_GPL(fixed_phy_register_100fd);
+
 void fixed_phy_unregister(struct phy_device *phy)
 {
        phy_device_remove(phy);
index d17ff750c70820b191538f38f45bcd96b2c5afea..08275ef641478e49a32bd0fbc0e26b994368af55 100644 (file)
@@ -20,6 +20,7 @@ extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
 void fixed_phy_add(const struct fixed_phy_status *status);
 struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
                                      struct device_node *np);
+struct phy_device *fixed_phy_register_100fd(void);
 
 extern void fixed_phy_unregister(struct phy_device *phydev);
 extern int fixed_phy_set_link_update(struct phy_device *phydev,
@@ -34,6 +35,11 @@ fixed_phy_register(const struct fixed_phy_status *status,
        return ERR_PTR(-ENODEV);
 }
 
+static inline struct phy_device *fixed_phy_register_100fd(void)
+{
+       return ERR_PTR(-ENODEV);
+}
+
 static inline void fixed_phy_unregister(struct phy_device *phydev)
 {
 }