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>
This commit is contained in:
Jonas Jelonek 2026-01-05 14:44:41 +00:00 committed by Robert Marko
parent 7aa7e97e53
commit 3753805b2a

View 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,