]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: use ARRAY_SIZE kernel macro
authorJonas Jelonek <jelonek.jonas@gmail.com>
Mon, 5 Jan 2026 14:44:41 +0000 (14:44 +0000)
committerRobert Marko <robimarko@gmail.com>
Wed, 7 Jan 2026 09:46:54 +0000 (10:46 +0100)
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>
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c

index 4d4cf19f8a667008869a0363ca74610215fa0c37..3de7d746821dd40b2f0214915bc6e479888e190f 100644 (file)
@@ -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,