>From 038b4a505c82c91a84caaf7832967ffac2faf93b Mon Sep 17 00:00:00 2001 From: Ivo van Doorn <IvDoorn@xxxxxxxxx> Date: Sat, 18 Aug 2007 13:03:32 +0200 Subject: [PATCH 13/30] rt2x00: rt2x00_ring_free returns invalid length rt2x00_ring_free returned the incorrect number of available entries because it accidently used ring->stats.len minus the number of used entries. This always results in 0 available entries, obviously this in turn would lead to problems regarding the TX handling. We can fix and optimize the code quite simply by doing the limit - length Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx> --- drivers/net/wireless/rt2x00ring.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/rt2x00ring.h b/drivers/net/wireless/rt2x00ring.h index 2adc8e5..9c94d06 100644 --- a/drivers/net/wireless/rt2x00ring.h +++ b/drivers/net/wireless/rt2x00ring.h @@ -219,9 +219,7 @@ static inline int rt2x00_ring_full(struct data_ring *ring) static inline int rt2x00_ring_free(struct data_ring *ring) { - if (ring->index_done >= ring->index) - return ring->index_done - ring->index; - return ring->stats.len - (ring->index - ring->index_done); + return ring->stats.limit - ring->stats.len; } /* -- 1.5.3.rc5 - To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html