ar9170usb: atomic pending urbs counter
This patch follows "ar9170: atomic pending A-MPDU counter" idea and converts another critical counter to atomic_*. Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
02bdf5b48a
commit
731d6bfc2d
2 changed files with 7 additions and 7 deletions
|
@ -108,15 +108,15 @@ static void ar9170_usb_submit_urb(struct ar9170_usb *aru)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
spin_lock_irqsave(&aru->tx_urb_lock, flags);
|
spin_lock_irqsave(&aru->tx_urb_lock, flags);
|
||||||
if (aru->tx_submitted_urbs >= AR9170_NUM_TX_URBS) {
|
if (atomic_read(&aru->tx_submitted_urbs) >= AR9170_NUM_TX_URBS) {
|
||||||
spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
|
spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
aru->tx_submitted_urbs++;
|
atomic_inc(&aru->tx_submitted_urbs);
|
||||||
|
|
||||||
urb = usb_get_from_anchor(&aru->tx_pending);
|
urb = usb_get_from_anchor(&aru->tx_pending);
|
||||||
if (!urb) {
|
if (!urb) {
|
||||||
aru->tx_submitted_urbs--;
|
atomic_dec(&aru->tx_submitted_urbs);
|
||||||
spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
|
spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
|
@ -133,7 +133,7 @@ static void ar9170_usb_submit_urb(struct ar9170_usb *aru)
|
||||||
err);
|
err);
|
||||||
|
|
||||||
usb_unanchor_urb(urb);
|
usb_unanchor_urb(urb);
|
||||||
aru->tx_submitted_urbs--;
|
atomic_dec(&aru->tx_submitted_urbs);
|
||||||
ar9170_tx_callback(&aru->common, urb->context);
|
ar9170_tx_callback(&aru->common, urb->context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ static void ar9170_usb_tx_urb_complete_frame(struct urb *urb)
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
aru->tx_submitted_urbs--;
|
atomic_dec(&aru->tx_submitted_urbs);
|
||||||
|
|
||||||
ar9170_tx_callback(&aru->common, skb);
|
ar9170_tx_callback(&aru->common, skb);
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ static int ar9170_usb_probe(struct usb_interface *intf,
|
||||||
spin_lock_init(&aru->tx_urb_lock);
|
spin_lock_init(&aru->tx_urb_lock);
|
||||||
|
|
||||||
aru->tx_pending_urbs = 0;
|
aru->tx_pending_urbs = 0;
|
||||||
aru->tx_submitted_urbs = 0;
|
atomic_set(&aru->tx_submitted_urbs, 0);
|
||||||
|
|
||||||
aru->common.stop = ar9170_usb_stop;
|
aru->common.stop = ar9170_usb_stop;
|
||||||
aru->common.flush = ar9170_usb_flush;
|
aru->common.flush = ar9170_usb_flush;
|
||||||
|
|
|
@ -67,7 +67,7 @@ struct ar9170_usb {
|
||||||
bool req_one_stage_fw;
|
bool req_one_stage_fw;
|
||||||
|
|
||||||
spinlock_t tx_urb_lock;
|
spinlock_t tx_urb_lock;
|
||||||
unsigned int tx_submitted_urbs;
|
atomic_t tx_submitted_urbs;
|
||||||
unsigned int tx_pending_urbs;
|
unsigned int tx_pending_urbs;
|
||||||
|
|
||||||
struct completion cmd_wait;
|
struct completion cmd_wait;
|
||||||
|
|
Loading…
Reference in a new issue