aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 9de9dbe94399..d63b582b6875 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -27,6 +27,7 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/log2.h>
30 31
31#include "rt2x00.h" 32#include "rt2x00.h"
32#include "rt2x00lib.h" 33#include "rt2x00lib.h"
@@ -811,13 +812,18 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
811 */ 812 */
812 if (test_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags)) { 813 if (test_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags)) {
813 /* 814 /*
814 * Allocate txstatus fifo and tasklet, we use a size of 512 815 * Allocate the txstatus fifo. In the worst case the tx
815 * for the kfifo which is big enough to store 512/4=128 tx 816 * status fifo has to hold the tx status of all entries
816 * status reports. In the worst case (tx status for all tx 817 * in all tx queues. Hence, calculate the kfifo size as
817 * queues gets reported before we've got a chance to handle 818 * tx_queues * entry_num and round up to the nearest
818 * them) 24*4=384 tx status reports need to be cached. 819 * power of 2.
819 */ 820 */
820 status = kfifo_alloc(&rt2x00dev->txstatus_fifo, 512, 821 int kfifo_size =
822 roundup_pow_of_two(rt2x00dev->ops->tx_queues *
823 rt2x00dev->ops->tx->entry_num *
824 sizeof(u32));
825
826 status = kfifo_alloc(&rt2x00dev->txstatus_fifo, kfifo_size,
821 GFP_KERNEL); 827 GFP_KERNEL);
822 if (status) 828 if (status)
823 return status; 829 return status;