Commit d7cdbdd0 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

usb: ldusb: 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.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent efd61e94
...@@ -225,6 +225,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) ...@@ -225,6 +225,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb)
size_t *actual_buffer; size_t *actual_buffer;
unsigned int next_ring_head; unsigned int next_ring_head;
int status = urb->status; int status = urb->status;
unsigned long flags;
int retval; int retval;
if (status) { if (status) {
...@@ -236,12 +237,12 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) ...@@ -236,12 +237,12 @@ static void ld_usb_interrupt_in_callback(struct urb *urb)
dev_dbg(&dev->intf->dev, dev_dbg(&dev->intf->dev,
"%s: nonzero status received: %d\n", __func__, "%s: nonzero status received: %d\n", __func__,
status); status);
spin_lock(&dev->rbsl); spin_lock_irqsave(&dev->rbsl, flags);
goto resubmit; /* maybe we can recover */ goto resubmit; /* maybe we can recover */
} }
} }
spin_lock(&dev->rbsl); spin_lock_irqsave(&dev->rbsl, flags);
if (urb->actual_length > 0) { if (urb->actual_length > 0) {
next_ring_head = (dev->ring_head+1) % ring_buffer_size; next_ring_head = (dev->ring_head+1) % ring_buffer_size;
if (next_ring_head != dev->ring_tail) { if (next_ring_head != dev->ring_tail) {
...@@ -270,7 +271,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) ...@@ -270,7 +271,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb)
dev->buffer_overflow = 1; dev->buffer_overflow = 1;
} }
} }
spin_unlock(&dev->rbsl); spin_unlock_irqrestore(&dev->rbsl, flags);
exit: exit:
dev->interrupt_in_done = 1; dev->interrupt_in_done = 1;
wake_up_interruptible(&dev->read_wait); wake_up_interruptible(&dev->read_wait);
......
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