[openwrt/openwrt] realtek: dsa: Clarify statistic port iterator variable
LEDE Commits
lede-commits at lists.infradead.org
Sat Nov 15 15:18:32 PST 2025
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/501f4edb04c434ed966a9443788b2f968abca38f
commit 501f4edb04c434ed966a9443788b2f968abca38f
Author: Sven Eckelmann <se at simonwunderlich.de>
AuthorDate: Wed Nov 5 09:43:36 2025 +0100
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 <felix.bau at gmx.de>
Signed-off-by: Sven Eckelmann <se at simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/20631
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
.../realtek/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);
More information about the lede-commits
mailing list