diff mbox series

[v2,27/50] wilc1000: simplify ac_balance() a bit

Message ID 20211223011358.4031459-28-davidm@egauge.net
State New
Headers show
Series wilc1000: rework tx path to use sk_buffs throughout | expand

Commit Message

David Mosberger-Tang Dec. 23, 2021, 1:14 a.m. UTC
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 mbox series

Patch

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