[openwrt/openwrt] realtek: pcs: use ARRAY_SIZE kernel macro
LEDE Commits
lede-commits at lists.infradead.org
Wed Jan 7 01:47:00 PST 2026
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/3753805b2aa01fc132b774c8964f004f75da0e9b
commit 3753805b2aa01fc132b774c8964f004f75da0e9b
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Mon Jan 5 14:44:41 2026 +0000
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 <jelonek.jonas at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21410
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
target/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,
More information about the lede-commits
mailing list