[PATCH v4 08/22] net: phy: Simplify the logic of phy_connect_fixed()
Bin Meng
bmeng.cn at gmail.com
Sun Mar 14 13:14:52 CET 2021
Simplify the logic of phy_connect_fixed() by using the new API
ofnode_phy_is_fixed_link(), which brings additional bonus of
supporting the old DT bindings.
Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
Reviewed-by: Ramon Fried <rfried.dev at gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean at nxp.com>
---
(no changes since v1)
drivers/net/phy/phy.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index c7cdf64a0a..dcdef9e661 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -18,6 +18,7 @@
#include <phy.h>
#include <errno.h>
#include <asm/global_data.h>
+#include <dm/of_extra.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/err.h>
@@ -1008,15 +1009,14 @@ static struct phy_device *phy_connect_fixed(struct mii_dev *bus,
phy_interface_t interface)
{
ofnode node = dev_ofnode(dev), subnode;
- struct phy_device *phydev;
-
- subnode = ofnode_find_subnode(node, "fixed-link");
- if (!ofnode_valid(subnode))
- return NULL;
+ struct phy_device *phydev = NULL;
- phydev = phy_device_create(bus, 0, PHY_FIXED_ID, false, interface);
- if (phydev)
- phydev->node = subnode;
+ if (ofnode_phy_is_fixed_link(node, &subnode)) {
+ phydev = phy_device_create(bus, 0, PHY_FIXED_ID,
+ false, interface);
+ if (phydev)
+ phydev->node = subnode;
+ }
return phydev;
}
--
2.25.1
More information about the U-Boot
mailing list