Skip to contentSkip to conversation

usb: serial: digi_acceleport: use irqsave() in USB's complete callback

PATCH New Johan Hovold 1 participant 1 message Jun 26, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH 2/12 usb: serial: digi_acceleport: use irqsave() in USB's complete callback

Quoted 24 lines · Sebastian Andrzej Siewior

From: John Ogness <[email protected]>

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.

---
 drivers/usb/serial/digi_acceleport.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/usb/serial/digi_acceleport.c +0 -0
index b0526786fb02..ae512fed08af 100644

drivers/usb/serial/digi_acceleport.c static int digi_read_inb_callback(struct urb *urb) · line 1388

Quoted 7 lines
drivers/usb/serial/digi_acceleport.c +1 -0
@@ -1381,6 +1382,7 @@ static int digi_read_inb_callback(struct urb *urb)
 	struct usb_serial_port *port = urb->context;
 	struct digi_port *priv = usb_get_serial_port_data(port);
 	unsigned char *buf = urb->transfer_buffer;
+	unsigned long flags;
 	int opcode;
 	int len;
 	int port_status;

We already had a "flag" variable in this function, which could now possibly get mixed up with "flags". I'll add a "tty_" prefix to the former in a follow-up patch.

Thanks,
Johan
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html