realtek: dsa: Clarify statistic port iterator variable
Some checks are pending
Build Kernel / Build all affected Kernels (push) Waiting to run

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 <felix.bau@gmx.de>
Signed-off-by: Sven Eckelmann <se@simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/20631
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Sven Eckelmann 2025-11-05 09:43:36 +01:00 committed by Hauke Mehrtens
parent e20ab65281
commit 501f4edb04

View 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);