]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: mdio: move phy_node attribute into port structure
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Wed, 25 Mar 2026 10:31:18 +0000 (11:31 +0100)
committerRobert Marko <robimarko@gmail.com>
Fri, 27 Mar 2026 19:51:43 +0000 (20:51 +0100)
The phy_node attribute is defined per port. Move it into the new
port structure. Now it is clear that it belongs to the port.

While we are here rename it to dn (aka device_node) to align with
upstream style. As all usage locations must be adapted it makes
no sense to make two commits (relocate/rename) to change the
code twice.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22604
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c

index 47ada0f682155d26e88c8b066bc7b3cf78164a94..7fa4528e95814f85b938c02e396e6e78741c6a4b 100644 (file)
  */
 
 struct rtmdio_port {
+       struct device_node *dn;
        int page;
        bool raw;
        u8 smi_addr;
@@ -183,7 +184,6 @@ struct rtmdio_ctrl {
        struct regmap *map;
        const struct rtmdio_config *cfg;
        struct rtmdio_port port[RTMDIO_MAX_PHY];
-       struct device_node *phy_node[RTMDIO_MAX_PHY];
        bool smi_bus_is_c45[RTMDIO_MAX_SMI_BUS];
        DECLARE_BITMAP(valid_ports, RTMDIO_MAX_PHY);
 };
@@ -891,7 +891,7 @@ static int rtmdio_map_ports(struct device *dev)
 
                ctrl->port[addr].smi_bus = smi_bus;
                ctrl->port[addr].smi_addr = smi_addr;
-               ctrl->phy_node[addr] = of_node_get(phy);
+               ctrl->port[addr].dn = of_node_get(phy);
                __set_bit(addr, ctrl->valid_ports);
        }
 
@@ -919,7 +919,7 @@ static int rtmdio_probe(struct platform_device *pdev)
        ret = rtmdio_map_ports(dev);
        if (ret) {
                for_each_phy(ctrl, addr)
-                       of_node_put(ctrl->phy_node[addr]);
+                       of_node_put(ctrl->port[addr].dn);
                return ret;
        }
 
@@ -943,8 +943,8 @@ static int rtmdio_probe(struct platform_device *pdev)
        for_each_phy(ctrl, addr) {
                if (!ret)
                        ret = fwnode_mdiobus_register_phy(bus,
-                               of_fwnode_handle(ctrl->phy_node[addr]), addr);
-               of_node_put(ctrl->phy_node[addr]);
+                               of_fwnode_handle(ctrl->port[addr].dn), addr);
+               of_node_put(ctrl->port[addr].dn);
        }
        if (ret)
                return ret;