diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index eeecedb63cd0..e870366ad871 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -813,29 +813,24 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
813 | struct txdone_entry_desc txdesc; | 813 | struct txdone_entry_desc txdesc; |
814 | u32 word; | 814 | u32 word; |
815 | u32 reg; | 815 | u32 reg; |
816 | u32 old_reg; | ||
817 | int wcid, ack, pid, tx_wcid, tx_ack, tx_pid; | 816 | int wcid, ack, pid, tx_wcid, tx_ack, tx_pid; |
818 | u16 mcs, real_mcs; | 817 | u16 mcs, real_mcs; |
818 | int i; | ||
819 | 819 | ||
820 | /* | 820 | /* |
821 | * During each loop we will compare the freshly read | 821 | * TX_STA_FIFO is a stack of X entries, hence read TX_STA_FIFO |
822 | * TX_STA_FIFO register value with the value read from | 822 | * at most X times and also stop processing once the TX_STA_FIFO_VALID |
823 | * the previous loop. If the 2 values are equal then | 823 | * flag is not set anymore. |
824 | * we should stop processing because the chance it | 824 | * |
825 | * quite big that the device has been unplugged and | 825 | * The legacy drivers use X=TX_RING_SIZE but state in a comment |
826 | * we risk going into an endless loop. | 826 | * that the TX_STA_FIFO stack has a size of 16. We stick to our |
827 | * tx ring size for now. | ||
827 | */ | 828 | */ |
828 | old_reg = 0; | 829 | for (i = 0; i < TX_ENTRIES; i++) { |
829 | |||
830 | while (1) { | ||
831 | rt2800_register_read(rt2x00dev, TX_STA_FIFO, ®); | 830 | rt2800_register_read(rt2x00dev, TX_STA_FIFO, ®); |
832 | if (!rt2x00_get_field32(reg, TX_STA_FIFO_VALID)) | 831 | if (!rt2x00_get_field32(reg, TX_STA_FIFO_VALID)) |
833 | break; | 832 | break; |
834 | 833 | ||
835 | if (old_reg == reg) | ||
836 | break; | ||
837 | old_reg = reg; | ||
838 | |||
839 | wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID); | 834 | wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID); |
840 | ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED); | 835 | ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED); |
841 | pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE); | 836 | pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE); |