Skip to content

Commit

Permalink
ath5k: Fix queue debug file
Browse files Browse the repository at this point in the history
Take txq lock in debug file and fix reporting of used buffers.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Bruno Randolf authored and John W. Linville committed Sep 21, 2010
1 parent 925e0b0 commit cfddc11
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/wireless/ath/ath5k/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,

struct ath5k_txq *txq;
struct ath5k_buf *bf, *bf0;
int i, n = 0;
int i, n;

len += snprintf(buf+len, sizeof(buf)-len,
"available txbuffers: %d\n", sc->txbuf_len);
Expand All @@ -777,9 +777,14 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
if (!txq->setup)
continue;

n = 0;
spin_lock_bh(&txq->lock);
list_for_each_entry_safe(bf, bf0, &txq->q, list)
n++;
len += snprintf(buf+len, sizeof(buf)-len, " len: %d\n", n);
spin_unlock_bh(&txq->lock);

len += snprintf(buf+len, sizeof(buf)-len,
" len: %d bufs: %d\n", txq->txq_len, n);
}

if (len > sizeof(buf))
Expand Down

0 comments on commit cfddc11

Please sign in to comment.