Commit be49c535 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: usb: rely on mt76_for_each_q_rx

Rely on mt76_for_each_q_rx whenever possible in order to simply the code
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent a28bef56
...@@ -54,9 +54,6 @@ static int mt76_rx_queues_read(struct seq_file *s, void *data) ...@@ -54,9 +54,6 @@ static int mt76_rx_queues_read(struct seq_file *s, void *data)
mt76_for_each_q_rx(dev, i) { mt76_for_each_q_rx(dev, i) {
struct mt76_queue *q = &dev->q_rx[i]; struct mt76_queue *q = &dev->q_rx[i];
if (!q->ndesc)
continue;
queued = mt76_is_usb(dev) ? q->ndesc - q->queued : q->queued; queued = mt76_is_usb(dev) ? q->ndesc - q->queued : q->queued;
seq_printf(s, "%d: queued=%d head=%d tail=%d\n", seq_printf(s, "%d: queued=%d head=%d tail=%d\n",
i, queued, q->head, q->tail); i, queued, q->head, q->tail);
......
...@@ -672,17 +672,11 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q) ...@@ -672,17 +672,11 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
static void mt76u_rx_tasklet(unsigned long data) static void mt76u_rx_tasklet(unsigned long data)
{ {
struct mt76_dev *dev = (struct mt76_dev *)data; struct mt76_dev *dev = (struct mt76_dev *)data;
struct mt76_queue *q;
int i; int i;
rcu_read_lock(); rcu_read_lock();
for (i = 0; i < __MT_RXQ_MAX; i++) { mt76_for_each_q_rx(dev, i)
q = &dev->q_rx[i]; mt76u_process_rx_queue(dev, &dev->q_rx[i]);
if (!q->ndesc)
continue;
mt76u_process_rx_queue(dev, q);
}
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -756,27 +750,19 @@ mt76u_free_rx_queue(struct mt76_dev *dev, struct mt76_queue *q) ...@@ -756,27 +750,19 @@ mt76u_free_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
static void mt76u_free_rx(struct mt76_dev *dev) static void mt76u_free_rx(struct mt76_dev *dev)
{ {
struct mt76_queue *q;
int i; int i;
for (i = 0; i < __MT_RXQ_MAX; i++) { mt76_for_each_q_rx(dev, i)
q = &dev->q_rx[i]; mt76u_free_rx_queue(dev, &dev->q_rx[i]);
if (!q->ndesc)
continue;
mt76u_free_rx_queue(dev, q);
}
} }
void mt76u_stop_rx(struct mt76_dev *dev) void mt76u_stop_rx(struct mt76_dev *dev)
{ {
struct mt76_queue *q; int i;
int i, j;
for (i = 0; i < __MT_RXQ_MAX; i++) { mt76_for_each_q_rx(dev, i) {
q = &dev->q_rx[i]; struct mt76_queue *q = &dev->q_rx[i];
if (!q->ndesc) int j;
continue;
for (j = 0; j < q->ndesc; j++) for (j = 0; j < q->ndesc; j++)
usb_poison_urb(q->entry[j].urb); usb_poison_urb(q->entry[j].urb);
...@@ -788,14 +774,11 @@ EXPORT_SYMBOL_GPL(mt76u_stop_rx); ...@@ -788,14 +774,11 @@ EXPORT_SYMBOL_GPL(mt76u_stop_rx);
int mt76u_resume_rx(struct mt76_dev *dev) int mt76u_resume_rx(struct mt76_dev *dev)
{ {
struct mt76_queue *q; int i;
int i, j, err;
for (i = 0; i < __MT_RXQ_MAX; i++) {
q = &dev->q_rx[i];
if (!q->ndesc) mt76_for_each_q_rx(dev, i) {
continue; struct mt76_queue *q = &dev->q_rx[i];
int err, j;
for (j = 0; j < q->ndesc; j++) for (j = 0; j < q->ndesc; j++)
usb_unpoison_urb(q->entry[j].urb); usb_unpoison_urb(q->entry[j].urb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment