Skip to content

Commit a3128fe

Browse files
Sebastian Andrzej SiewiorKalle Valo
authored andcommitted
libertas: use irqsave() in USB's complete callback
The USB completion callback does not disable interrupts while acquiring the lock. We want to remove the local_irq_disable() invocation from __usb_hcd_giveback_urb() and therefore it is required for the callback handler to disable the interrupts while acquiring the lock. The callback may be invoked either in IRQ or BH context depending on the USB host controller. Use the _irqsave() variant of the locking primitives. I am removing the BUG_ON(!in_interrupt()); check because it serves no purpose. Running the completion callback in BH context makes in_interrupt() still return true but the interrupts could be enabled. The important part is that ->driver_lock is acquired with disabled interrupts which is the case now. Cc: Kalle Valo <kvalo@codeaurora.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: libertas-dev@lists.infradead.org Cc: linux-wireless@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent fc75122 commit a3128fe

File tree

1 file changed

+3
-4
lines changed
  • drivers/net/wireless/marvell/libertas

1 file changed

+3
-4
lines changed

drivers/net/wireless/marvell/libertas/if_usb.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
614614
struct if_usb_card *cardp,
615615
struct lbs_private *priv)
616616
{
617+
unsigned long flags;
617618
u8 i;
618619

619620
if (recvlength > LBS_CMD_BUFFER_SIZE) {
@@ -623,9 +624,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
623624
return;
624625
}
625626

626-
BUG_ON(!in_interrupt());
627-
628-
spin_lock(&priv->driver_lock);
627+
spin_lock_irqsave(&priv->driver_lock, flags);
629628

630629
i = (priv->resp_idx == 0) ? 1 : 0;
631630
BUG_ON(priv->resp_len[i]);
@@ -635,7 +634,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
635634
kfree_skb(skb);
636635
lbs_notify_command_response(priv, i);
637636

638-
spin_unlock(&priv->driver_lock);
637+
spin_unlock_irqrestore(&priv->driver_lock, flags);
639638

640639
lbs_deb_usbd(&cardp->udev->dev,
641640
"Wake up main thread to handle cmd response\n");

0 commit comments

Comments
 (0)