Search Linux Wireless

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux