summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Jelonek2026-01-05 14:44:41 +0000
committerRobert Marko2026-01-07 09:46:54 +0000
commit3753805b2aa01fc132b774c8964f004f75da0e9b (patch)
tree61935fc492b900f0fd2c888811ca4ada411321a1
parent7aa7e97e531c75f7fdbb68ca032b19bad0c1cbbe (diff)
downloadopenwrt-3753805b2aa01fc132b774c8964f004f75da0e9b.tar.gz
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@gmail.com> Link: https://github.com/openwrt/openwrt/pull/21410 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c4
1 files 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,