Re: [PATCH net-next 2/2] net: lan966x: convert fwnode to of
From: Daniel Machon <daniel.machon@microchip.com>
Date: 2025-09-01 11:38:44
quoted
quoted
@@ -1179,7 +1179,7 @@ static int lan966x_probe(struct platform_device *pdev) } } - ports = device_get_named_child_node(&pdev->dev, "ethernet-ports"); + ports = of_get_child_by_name(pdev->dev.of_node, "ethernet-ports"); if (!ports) return dev_err_probe(&pdev->dev, -ENODEV, "no ethernet-ports child found\n");@@ -1191,25 +1191,27 @@ static int lan966x_probe(struct platform_device *pdev) lan966x_stats_init(lan966x); /* go over the child nodes */ - fwnode_for_each_available_child_node(ports, portnp) { + for_each_available_child_of_node(ports, portnp) { phy_interface_t phy_mode; struct phy *serdes; u32 p; - if (fwnode_property_read_u32(portnp, "reg", &p)) + if (of_property_read_u32(portnp, "reg", &p)) continue; - phy_mode = fwnode_get_phy_mode(portnp); - err = lan966x_probe_port(lan966x, p, phy_mode, portnp); + err = of_get_phy_mode(portnp, &phy_mode); + if (err) + goto cleanup_ports; + + err = lan966x_probe_port(lan966x, p, phy_mode, of_fwnode_handle(portnp));As I see it, you could change the signature of lan966x_probe_port() to accept a struct device_node, and instead pass that. Then you can convert it to fwnode for phylink_create, and ditch to_of_node().Will fix.
Thanks.
quoted
Same goes for lan966x_port_parse_delays(), here you can change fwnode_for_each_available_child_node() to for_each_available_child_of_node() and fwnode_property_read_u32() to of_property_read_u32().I don't see this lan966x_port_parse_delays function.
Sorry, I was looking at an internal version that had this function. Disregard this. The first comment still applies though. /Daniel