realtek: dsa: Clarify statistic port iterator variable
authorSven Eckelmann <[email protected]>
Wed, 5 Nov 2025 08:43:36 +0000 (09:43 +0100)
committerHauke Mehrtens <[email protected]>
Sat, 15 Nov 2025 23:10:56 +0000 (00:10 +0100)
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 <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20631
Signed-off-by: Hauke Mehrtens <[email protected]>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c

index 0c20f626a7dd2604f0c6a577b39c31d2f5ed23b0..abe45dc65e7194768247ab5d3b6c27d05b02ee31 100644 (file)
@@ -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);