From 501f4edb04c434ed966a9443788b2f968abca38f Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Wed, 5 Nov 2025 09:43:36 +0100 Subject: [PATCH] realtek: dsa: Clarify statistic port iterator variable The functions iterating through the port statistic/counter (for initialization or polling) use the generic name "i" for the iterator. This makes reading the actual body of the loop cumbersome because it is not clear that various parameters of functions are about a ports. Suggested-by: Felix Baumann Signed-off-by: Sven Eckelmann Link: https://github.com/openwrt/openwrt/pull/20631 Signed-off-by: Hauke Mehrtens --- .../files-6.12/drivers/net/dsa/rtl83xx/dsa.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c index 0c20f626a7..abe45dc65e 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c @@ -1195,13 +1195,13 @@ static void rtldsa_poll_counters(struct work_struct *work) struct rtl838x_switch_priv, counters_work); - for (int i = 0; i < priv->cpu_port; i++) { - if (!priv->ports[i].phy && !priv->pcs[i]) + for (int port = 0; port < priv->cpu_port; port++) { + if (!priv->ports[port].phy && !priv->pcs[port]) continue; - rtldsa_counters_lock(priv, i); - rtldsa_update_port_counters(priv, i); - rtldsa_counters_unlock(priv, i); + rtldsa_counters_lock(priv, port); + rtldsa_update_port_counters(priv, port); + rtldsa_counters_unlock(priv, port); } queue_delayed_work(priv->wq, &priv->counters_work, @@ -1212,11 +1212,11 @@ static void rtldsa_init_counters(struct rtl838x_switch_priv *priv) { struct rtldsa_counter_state *counters; - for (int i = 0; i < priv->cpu_port; i++) { - if (!priv->ports[i].phy && !priv->pcs[i]) + for (int port = 0; port < priv->cpu_port; port++) { + if (!priv->ports[port].phy && !priv->pcs[port]) continue; - counters = &priv->ports[i].counters; + counters = &priv->ports[port].counters; memset(counters, 0, sizeof(*counters)); spin_lock_init(&counters->lock); -- 2.30.2