diff options
| author | Markus Stockhausen | 2026-02-13 19:37:05 +0000 |
|---|---|---|
| committer | Robert Marko | 2026-02-16 14:44:20 +0000 |
| commit | 6d82a50575d516c04d1565b2953e9349a8e4eaaa (patch) | |
| tree | 8fee6b4202c1d1ab10453d230f8f8a6a23e3c6ad | |
| parent | 60d90f90171f957e6267414ddba662e80ab4aa20 (diff) | |
| download | openwrt-6d82a50575d516c04d1565b2953e9349a8e4eaaa.tar.gz | |
realtek: mdio: simplify phy_info handler
Add return value to function and add an internal pr_warn().
This simplifies the callers and avoids duplicate coding.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22008
Signed-off-by: Robert Marko <robimarko@gmail.com>
| -rw-r--r-- | target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c | 22 |
1 files changed, 8 insertions, 14 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 fac116e76b..bd5ad65a32 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 @@ -199,8 +199,6 @@ struct rtmdio_config { }; struct rtmdio_phy_info { - unsigned int phy_id; - bool phy_unknown; int mac_type; bool has_giga_lite; bool has_res_reg; @@ -604,10 +602,11 @@ static u32 rtmdio_get_phy_id(struct phy_device *phydev) return phydev->phy_id; } -static void rtmdio_get_phy_info(struct mii_bus *bus, int addr, struct rtmdio_phy_info *phyinfo) +static int rtmdio_get_phy_info(struct mii_bus *bus, int addr, struct rtmdio_phy_info *phyinfo) { struct phy_device *phydev = mdiobus_get_phy(bus, addr); u32 phyid = rtmdio_get_phy_id(phydev); + int ret = 0; /* * Depending on the attached PHY the polling mechanism must be fine tuned. Basically @@ -641,9 +640,12 @@ static void rtmdio_get_phy_info(struct mii_bus *bus, int addr, struct rtmdio_phy phyinfo->poll_lpa_1000 = RTMDIO_PHY_POLL_MMD(31, 0xa414, 11); break; default: - phyinfo->phy_unknown = true; + pr_warn("skip polling setup for unknown PHY %08x on port %d\n", phyid, addr); + ret = -EINVAL; break; } + + return ret; } static int rtmdio_838x_reset(struct mii_bus *bus) @@ -721,12 +723,8 @@ static void rtmdio_930x_setup_polling(struct mii_bus *bus) /* Define PHY specific polling parameters */ for_each_port(ctrl, addr) { - rtmdio_get_phy_info(bus, addr, &phyinfo); - if (phyinfo.phy_unknown) { - pr_warn("skip polling setup for unknown PHY %08x on port %d\n", - phyinfo.phy_id, addr); + if (rtmdio_get_phy_info(bus, addr, &phyinfo)) continue; - } /* port MAC type */ mask = addr > 23 ? 0x7 << ((addr - 24) * 3 + 12): 0x3 << ((addr / 4) * 2); @@ -806,12 +804,8 @@ static void rtmdio_931x_setup_polling(struct mii_bus *bus) int smi = ctrl->smi_bus[addr]; unsigned int mask, val; - rtmdio_get_phy_info(bus, addr, &phyinfo); - if (phyinfo.phy_unknown) { - pr_warn("skip polling setup for unknown PHY %08x on port %d\n", - phyinfo.phy_id, addr); + if (rtmdio_get_phy_info(bus, addr, &phyinfo)) continue; - } mask = val = 0; |