]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: mdio: rename foreach iterator
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sat, 21 Feb 2026 08:30:40 +0000 (09:30 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 1 Mar 2026 13:41:05 +0000 (14:41 +0100)
The driver covers phys and not ports. Adapt the iterator to
align with this naming convention. While we are here convert
some open coding to this iterator macro.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22131
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c

index 9a57a01e9acdeae7e664b3eb9b911b58cd1fac60..5b37e211bd9c3a89eeaf8c7008349032d49d6236 100644 (file)
 #define RTMDIO_931X_SMI_10GPHY_POLLING_SEL3    (0x0CFC)
 #define RTMDIO_931X_SMI_10GPHY_POLLING_SEL4    (0x0D00)
 
-#define for_each_port(ctrl, addr) \
+#define for_each_phy(ctrl, addr) \
        for (int addr = 0; addr < (ctrl)->cfg->num_phys; addr++) \
                if ((ctrl)->smi_bus[addr] >= 0)
 
@@ -567,7 +567,7 @@ static void rtmdio_setup_smi_topology(struct mii_bus *bus)
        struct rtmdio_ctrl *ctrl = bus->priv;
        u32 reg, mask, val;
 
-       for_each_port(ctrl, addr) {
+       for_each_phy(ctrl, addr) {
                if (ctrl->cfg->bus_map_base) {
                        reg = (addr / 16) * 4;
                        mask = 0x3 << ((addr % 16) * 2);
@@ -727,7 +727,7 @@ static void rtmdio_930x_setup_polling(struct mii_bus *bus)
        regmap_write(ctrl->map, RTMDIO_930X_SMI_MAC_TYPE_CTRL, 0);
 
        /* Define PHY specific polling parameters */
-       for_each_port(ctrl, addr) {
+       for_each_phy(ctrl, addr) {
                if (rtmdio_get_phy_info(bus, addr, &phyinfo))
                        continue;
 
@@ -804,7 +804,7 @@ static void rtmdio_931x_setup_polling(struct mii_bus *bus)
                             RTMDIO_931X_SMI_PHY_ABLTY_SDS * 0x55555555U);
 
        /* Define PHY specific polling parameters */
-       for_each_port(ctrl, addr) {
+       for_each_phy(ctrl, addr) {
                int smi = ctrl->smi_bus[addr];
                unsigned int mask, val;
                
@@ -938,10 +938,7 @@ static int rtmdio_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       for (addr = 0; addr < ctrl->cfg->num_phys; addr++) {
-               if (ctrl->smi_bus[addr] < 0)
-                       continue;
-
+       for_each_phy(ctrl, addr) {
                ret = fwnode_mdiobus_register_phy(bus, of_fwnode_handle(dn[addr]), addr);
                of_node_put(dn[addr]);
                if (ret)