summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Stockhausen2026-01-12 16:33:19 +0000
committerHauke Mehrtens2026-01-21 22:32:54 +0000
commit3722b006a69cfa9545844739258f67e92fd4d823 (patch)
treeb3a492983ee329435fcbb27b96ea510050fb30a3
parent631e066bc3b58ed40ebdec1fdc8d2349c8074efe (diff)
downloadopenwrt-3722b006a69cfa9545844739258f67e92fd4d823.tar.gz
realtek: mdio: rename iterator to "addr"
During initialization the mdio driver registers phys with the iterator "pn". To make clear that it is a phy address rename it to "addr". While we are here improve the upper bound check of the maximum possible address. This is the family specific cpu port and not the generic upper bound constant for all devices. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://github.com/openwrt/openwrt/pull/21438 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c b/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c
index 83fcb935a4..b87497fe6a 100644
--- a/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c
+++ b/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c
@@ -1016,14 +1016,14 @@ static int rtmdio_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct rtmdio_bus_priv *priv;
struct mii_bus *bus;
- u32 pn;
+ int addr;
bus = devm_mdiobus_alloc_size(dev, sizeof(*priv));
if (!bus)
return -ENOMEM;
priv = bus->priv;
- for (int addr = 0; addr < RTMDIO_MAX_PORT; addr++)
+ for (addr = 0; addr < RTMDIO_MAX_PORT; addr++)
priv->smi_bus[addr] = -1;
priv->cfg = (const struct rtmdio_config *)device_get_match_data(dev);
@@ -1040,29 +1040,29 @@ static int rtmdio_probe(struct platform_device *pdev)
for_each_node_by_name(dn, "ethernet-phy") {
u32 smi_addr[2];
- if (of_property_read_u32(dn, "reg", &pn))
+ if (of_property_read_u32(dn, "reg", &addr))
continue;
- if (pn >= RTMDIO_MAX_PORT) {
- pr_err("%s: illegal port number %d\n", __func__, pn);
+ if (addr >= priv->cfg->cpu_port) {
+ pr_err("%s: illegal port number %d\n", __func__, addr);
return -ENODEV;
}
if (of_property_read_u32_array(dn, "realtek,smi-address", &smi_addr[0], 2)) {
- priv->smi_bus[pn] = 0;
- priv->smi_addr[pn] = pn;
+ priv->smi_bus[addr] = 0;
+ priv->smi_addr[addr] = addr;
} else {
- priv->smi_bus[pn] = smi_addr[0];
- priv->smi_addr[pn] = smi_addr[1];
+ priv->smi_bus[addr] = smi_addr[0];
+ priv->smi_addr[addr] = smi_addr[1];
}
- if (priv->smi_bus[pn] >= RTMDIO_MAX_SMI_BUS) {
- pr_err("%s: illegal SMI bus number %d\n", __func__, priv->smi_bus[pn]);
+ if (priv->smi_bus[addr] >= RTMDIO_MAX_SMI_BUS) {
+ pr_err("%s: illegal SMI bus number %d\n", __func__, priv->smi_bus[addr]);
return -ENODEV;
}
if (of_device_is_compatible(dn, "ethernet-phy-ieee802.3-c45"))
- priv->smi_bus_isc45[priv->smi_bus[pn]] = true;
+ priv->smi_bus_isc45[priv->smi_bus[addr]] = true;
}
dn = of_find_compatible_node(NULL, NULL, "realtek,rtl83xx-switch");