From 3753805b2aa01fc132b774c8964f004f75da0e9b Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Mon, 5 Jan 2026 14:44:41 +0000 Subject: [PATCH] realtek: pcs: use ARRAY_SIZE kernel macro In the RTL931X configuration code, the array size of configuration arrays was still calculated with 'sizeof(...) / sizeof(...)'. There's a dedicated macro in the kernel for exactly that usecase. Use that instead to avoid possible errors and make the line shorter. The RTL930X code is already doing it the good way. Signed-off-by: Jonas Jelonek Link: https://github.com/openwrt/openwrt/pull/21410 Signed-off-by: Robert Marko --- .../linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c index 4d4cf19f8a..3de7d74682 100644 --- a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c +++ b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c @@ -2840,14 +2840,14 @@ static int rtpcs_931x_sds_config_hw_mode(struct rtpcs_serdes *sds, if (chiptype) { rtpcs_sds_write_bits(sds, 0x6, 0x2, 12, 12, 1); - for (int i = 0; i < sizeof(sds_config_10p3125g_type1) / sizeof(struct rtpcs_sds_config); ++i) { + for (int i = 0; i < ARRAY_SIZE(sds_config_10p3125g_type1); ++i) { rtpcs_sds_write(sds, sds_config_10p3125g_type1[i].page - 0x4, sds_config_10p3125g_type1[i].reg, sds_config_10p3125g_type1[i].data); } - for (int i = 0; i < sizeof(sds_config_10p3125g_cmu_type1) / sizeof(struct rtpcs_sds_config); ++i) { + for (int i = 0; i < ARRAY_SIZE(sds_config_10p3125g_cmu_type1); ++i) { rtpcs_sds_write(even_sds, sds_config_10p3125g_cmu_type1[i].page - 0x4, sds_config_10p3125g_cmu_type1[i].reg,