diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2018-06-25 00:08:42 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-06-28 19:36:06 +0900 |
commit | 957ada71b69e6da4d8131b082c5d57558f7fa415 (patch) | |
tree | 93dfca2cd9d8e221cf2d121a975569d7ef232eb9 | |
parent | 7375fc9f5f162e783661ee9cdb85a62ec5f6b6d5 (diff) | |
download | linux-stable-957ada71b69e6da4d8131b082c5d57558f7fa415.tar.gz linux-stable-957ada71b69e6da4d8131b082c5d57558f7fa415.tar.bz2 linux-stable-957ada71b69e6da4d8131b082c5d57558f7fa415.zip |
usb: adutux: 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: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/misc/adutux.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index b3160afe0458..9465fb95d70a 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -155,11 +155,12 @@ static void adu_interrupt_in_callback(struct urb *urb) { struct adu_device *dev = urb->context; int status = urb->status; + unsigned long flags; adu_debug_data(&dev->udev->dev, __func__, urb->actual_length, urb->transfer_buffer); - spin_lock(&dev->buflock); + spin_lock_irqsave(&dev->buflock, flags); if (status != 0) { if ((status != -ENOENT) && (status != -ECONNRESET) && @@ -190,7 +191,7 @@ static void adu_interrupt_in_callback(struct urb *urb) exit: dev->read_urb_finished = 1; - spin_unlock(&dev->buflock); + spin_unlock_irqrestore(&dev->buflock, flags); /* always wake up so we recover from errors */ wake_up_interruptible(&dev->read_wait); } @@ -199,6 +200,7 @@ static void adu_interrupt_out_callback(struct urb *urb) { struct adu_device *dev = urb->context; int status = urb->status; + unsigned long flags; adu_debug_data(&dev->udev->dev, __func__, urb->actual_length, urb->transfer_buffer); @@ -213,10 +215,10 @@ static void adu_interrupt_out_callback(struct urb *urb) return; } - spin_lock(&dev->buflock); + spin_lock_irqsave(&dev->buflock, flags); dev->out_urb_finished = 1; wake_up(&dev->write_wait); - spin_unlock(&dev->buflock); + spin_unlock_irqrestore(&dev->buflock, flags); } static int adu_open(struct inode *inode, struct file *file) |