lkml.org 
[lkml]   [2021]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 41/50] wilc1000: use more descriptive variable name
Date
Now that the factoring is done, again rename "i" to "vmm_table_len" to
improve readability.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
.../net/wireless/microchip/wilc1000/wlan.c | 31 +++++++++----------
1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index f01f7bade6189..f89ea4839aa61 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -681,7 +681,7 @@ static void set_header(struct wilc *wilc, struct sk_buff *tqe,
* WILC_VMM_TBL_SIZE packets or up to WILC_TX_BUFF_SIZE bytes.
*/
static int schedule_packets(struct wilc *wilc,
- int i, u32 vmm_table[WILC_VMM_TBL_SIZE])
+ int vmm_table_len, u32 vmm_table[WILC_VMM_TBL_SIZE])
{
u8 k, ac;
static const u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1};
@@ -702,8 +702,8 @@ static int schedule_packets(struct wilc *wilc,

ac_exist = 1;
for (k = 0; k < num_pkts_to_add[ac]; k++) {
- if (i >= WILC_VMM_TBL_SIZE - 1)
- return i;
+ if (vmm_table_len >= WILC_VMM_TBL_SIZE - 1)
+ return vmm_table_len;

tqe = skb_dequeue(&wilc->txq[ac]);
if (!tqe)
@@ -717,21 +717,21 @@ static int schedule_packets(struct wilc *wilc,
if (wilc->chipq_bytes + vmm_sz > WILC_TX_BUFF_SIZE) {
/* return packet to its queue */
skb_queue_head(&wilc->txq[ac], tqe);
- return i;
+ return vmm_table_len;
}
atomic_dec(&wilc->txq_entries);

__skb_queue_tail(&wilc->chipq, tqe);
wilc->chipq_bytes += tqe->len;

- vmm_table[i] = vmm_table_entry(tqe, vmm_sz);
- i++;
+ vmm_table[vmm_table_len] = vmm_table_entry(tqe, vmm_sz);
+ vmm_table_len++;

}
}
num_pkts_to_add = ac_preserve_ratio;
} while (ac_exist);
- return i;
+ return vmm_table_len;
}

/**
@@ -747,13 +747,10 @@ static int schedule_packets(struct wilc *wilc,
*/
static int fill_vmm_table(struct wilc *wilc, u32 vmm_table[WILC_VMM_TBL_SIZE])
{
- int i;
- int vmm_sz = 0;
+ int vmm_table_len = 0, vmm_sz = 0;
struct sk_buff *tqe;
struct wilc_skb_tx_cb *tx_cb;

- i = 0;
-
if (unlikely(wilc->chipq_bytes > 0)) {
/* fill in packets that are already on the chipq: */
skb_queue_walk(&wilc->chipq, tqe) {
@@ -761,16 +758,16 @@ static int fill_vmm_table(struct wilc *wilc, u32 vmm_table[WILC_VMM_TBL_SIZE])
vmm_sz = tx_hdr_len(tx_cb->type);
vmm_sz += tqe->len;
vmm_sz = ALIGN(vmm_sz, 4);
- vmm_table[i++] = vmm_table_entry(tqe, vmm_sz);
+ vmm_table[vmm_table_len++] = vmm_table_entry(tqe, vmm_sz);
}
}

- i = schedule_packets(wilc, i, vmm_table);
- if (i > 0) {
- WARN_ON(i >= WILC_VMM_TBL_SIZE);
- vmm_table[i] = 0x0;
+ vmm_table_len = schedule_packets(wilc, vmm_table_len, vmm_table);
+ if (vmm_table_len > 0) {
+ WARN_ON(vmm_table_len >= WILC_VMM_TBL_SIZE);
+ vmm_table[vmm_table_len] = 0x0;
}
- return i;
+ return vmm_table_len;
}

/**
--
2.25.1
\
 
 \ /
  Last update: 2021-12-23 02:16    [W:0.198 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site