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 27/50] wilc1000: simplify ac_balance() a bit
Date
ac_balance() is never going to fail ("ratio" is always non-NULL), so
there is no reason to pretend otherwise.

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

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 5ea9129b36925..287c0843ba152 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -345,21 +345,23 @@ static inline u8 ac_classify(struct wilc *wilc, struct sk_buff *skb)
return q_num;
}

-static inline int ac_balance(struct wilc *wl, u8 *ratio)
+/**
+ * ac_balance() - balance queues by favoring ones with fewer packets pending
+ * @wl: Pointer to the wilc structure.
+ * @ratio: Pointer to array of length NQUEUES in which this function
+ * returns the number of packets that may be scheduled for each
+ * access category.
+ */
+static inline void ac_balance(const struct wilc *wl, u8 *ratio)
{
u8 i, max_count = 0;

- if (!ratio)
- return -EINVAL;
-
for (i = 0; i < NQUEUES; i++)
if (wl->fw[i].count > max_count)
max_count = wl->fw[i].count;

for (i = 0; i < NQUEUES; i++)
ratio[i] = max_count - wl->fw[i].count;
-
- return 0;
}

static inline void ac_update_fw_ac_pkt_info(struct wilc *wl, u32 reg)
@@ -894,8 +896,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
if (wilc->quit)
goto out_update_cnt;

- if (ac_balance(wilc, ac_desired_ratio))
- return -EINVAL;
+ ac_balance(wilc, ac_desired_ratio);

mutex_lock(&wilc->txq_add_to_head_cs);

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