From: Markus Stockhausen Date: Fri, 2 May 2025 12:47:22 +0000 (-0400) Subject: realtek: reuse RTMDIO_MAX_SMI_BUS define X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10519db5798bee4ef6134e36854712db010b9d35;p=thirdparty%2Fopenwrt.git realtek: reuse RTMDIO_MAX_SMI_BUS define Although a dfine is used to set the maxiumum number of SMI busses (=4) it is not used at all appropriate places in the code. Replace hard coded constants with that define. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/18402 Signed-off-by: Stijn Tintel --- diff --git a/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c index 29c7529469b..557df765937 100644 --- a/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c @@ -2028,7 +2028,7 @@ static int rtmdio_930x_reset(struct mii_bus *bus) sw_w32_mask(poll_ctrl, 0, RTL930X_SMI_GLB_CTRL); /* Configure which SMI busses are polled in c45 based on a c45 PHY being on that bus */ - for (int i = 0; i < 4; i++) + for (int i = 0; i < RTMDIO_MAX_SMI_BUS; i++) if (priv->smi_bus_isc45[i]) c45_mask |= BIT(i + 16); @@ -2130,7 +2130,7 @@ static int rtmdio_931x_reset(struct mii_bus *bus) } /* Configure which SMI bus is behind which port number */ - for (int i = 0; i < 4; i++) { + for (int i = 0; i < RTMDIO_MAX_SMI_BUS; i++) { pr_info("poll sel %d, %08x\n", i, poll_sel[i]); sw_w32(poll_sel[i], RTL931X_SMI_PORT_POLLING_SEL + (i * 4)); } @@ -2138,7 +2138,7 @@ static int rtmdio_931x_reset(struct mii_bus *bus) /* Configure which SMI busses */ pr_info("%s: WAS RTL931X_MAC_L2_GLOBAL_CTRL2 %08x\n", __func__, sw_r32(RTL931X_MAC_L2_GLOBAL_CTRL2)); pr_info("c45_mask: %08x, RTL931X_SMI_GLB_CTRL0 was %X", c45_mask, sw_r32(RTL931X_SMI_GLB_CTRL0)); - for (int i = 0; i < 4; i++) { + for (int i = 0; i < RTMDIO_MAX_SMI_BUS; i++) { /* bus is polled in c45 */ if (priv->smi_bus_isc45[i]) c45_mask |= 0x2 << (i * 2); /* Std. C45, non-standard is 0x3 */