[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211218235404.3963475-21-davidm@egauge.net>
Date: Sat, 18 Dec 2021 23:54:17 +0000 (UTC)
From: David Mosberger-Tang <davidm@...uge.net>
To: Ajay Singh <ajay.kathat@...rochip.com>
Cc: Claudiu Beznea <claudiu.beznea@...rochip.com>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
David Mosberger-Tang <davidm@...uge.net>
Subject: [PATCH 20/23] wilc1000: eliminate "max_size_over" variable in
fill_vmm_table
This makes the code tighter and easier to understand.
Signed-off-by: David Mosberger-Tang <davidm@...uge.net>
---
drivers/net/wireless/microchip/wilc1000/wlan.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 8652ec9f6d9c8..88a981b00bda2 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -635,7 +635,7 @@ static int fill_vmm_table(const struct wilc *wilc,
u32 sum;
u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1};
u8 *num_pkts_to_add;
- bool max_size_over = 0, ac_exist = 0;
+ bool ac_exist = 0;
int vmm_sz = 0;
struct sk_buff *tqe_q[NQUEUES];
struct wilc_skb_tx_cb *tx_cb;
@@ -645,20 +645,17 @@ static int fill_vmm_table(const struct wilc *wilc,
i = 0;
sum = 0;
- max_size_over = 0;
num_pkts_to_add = ac_desired_ratio;
do {
ac_exist = 0;
- for (ac = 0; (ac < NQUEUES) && (!max_size_over); ac++) {
+ for (ac = 0; ac < NQUEUES; ac++) {
if (!tqe_q[ac])
continue;
ac_exist = 1;
- for (k = 0; (k < num_pkts_to_add[ac]) &&
- (!max_size_over) && tqe_q[ac]; k++) {
+ for (k = 0; (k < num_pkts_to_add[ac]) && tqe_q[ac]; k++) {
if (i >= (WILC_VMM_TBL_SIZE - 1)) {
- max_size_over = 1;
- break;
+ goto out;
}
tx_cb = WILC_SKB_TX_CB(tqe_q[ac]);
@@ -673,8 +670,7 @@ static int fill_vmm_table(const struct wilc *wilc,
vmm_sz = ALIGN(vmm_sz, 4);
if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE) {
- max_size_over = 1;
- break;
+ goto out;
}
vmm_table[i] = vmm_sz / 4;
if (tx_cb->type == WILC_CFG_PKT)
@@ -690,8 +686,8 @@ static int fill_vmm_table(const struct wilc *wilc,
}
}
num_pkts_to_add = ac_preserve_ratio;
- } while (!max_size_over && ac_exist);
-
+ } while (ac_exist);
+out:
vmm_table[i] = 0x0;
return i;
}
--
2.25.1
Powered by blists - more mailing lists