Commit cf83be24 authored by John Ogness's avatar John Ogness Committed by Johan Hovold

USB: serial: ti_usb_3410_5052: 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 avatarJohn Ogness <john.ogness@linutronix.de>
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 5e02bfcf
...@@ -1215,6 +1215,7 @@ static void ti_bulk_in_callback(struct urb *urb) ...@@ -1215,6 +1215,7 @@ static void ti_bulk_in_callback(struct urb *urb)
struct usb_serial_port *port = tport->tp_port; struct usb_serial_port *port = tport->tp_port;
struct device *dev = &urb->dev->dev; struct device *dev = &urb->dev->dev;
int status = urb->status; int status = urb->status;
unsigned long flags;
int retval = 0; int retval = 0;
switch (status) { switch (status) {
...@@ -1247,20 +1248,20 @@ static void ti_bulk_in_callback(struct urb *urb) ...@@ -1247,20 +1248,20 @@ static void ti_bulk_in_callback(struct urb *urb)
__func__); __func__);
else else
ti_recv(port, urb->transfer_buffer, urb->actual_length); ti_recv(port, urb->transfer_buffer, urb->actual_length);
spin_lock(&tport->tp_lock); spin_lock_irqsave(&tport->tp_lock, flags);
port->icount.rx += urb->actual_length; port->icount.rx += urb->actual_length;
spin_unlock(&tport->tp_lock); spin_unlock_irqrestore(&tport->tp_lock, flags);
} }
exit: exit:
/* continue to read unless stopping */ /* continue to read unless stopping */
spin_lock(&tport->tp_lock); spin_lock_irqsave(&tport->tp_lock, flags);
if (tport->tp_read_urb_state == TI_READ_URB_RUNNING) if (tport->tp_read_urb_state == TI_READ_URB_RUNNING)
retval = usb_submit_urb(urb, GFP_ATOMIC); retval = usb_submit_urb(urb, GFP_ATOMIC);
else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING) else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING)
tport->tp_read_urb_state = TI_READ_URB_STOPPED; tport->tp_read_urb_state = TI_READ_URB_STOPPED;
spin_unlock(&tport->tp_lock); spin_unlock_irqrestore(&tport->tp_lock, flags);
if (retval) if (retval)
dev_err(dev, "%s - resubmit read urb failed, %d\n", dev_err(dev, "%s - resubmit read urb failed, %d\n",
__func__, retval); __func__, retval);
......
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