usb: gsmd: Save interrupt state when using spinlocks
Save and restore interrupt state when using spinlocks
to prevent re-enabling spinlocks when handling an
SMD notification.
CRs-Fixed: 303355
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
diff --git a/drivers/usb/gadget/u_smd.c b/drivers/usb/gadget/u_smd.c
index c4a5ce4..60826b9 100644
--- a/drivers/usb/gadget/u_smd.c
+++ b/drivers/usb/gadget/u_smd.c
@@ -166,6 +166,7 @@
{
struct list_head *pool;
struct usb_ep *out;
+ unsigned long flags;
int ret;
if (!port) {
@@ -173,7 +174,7 @@
return;
}
- spin_lock_irq(&port->port_lock);
+ spin_lock_irqsave(&port->port_lock, flags);
if (!port->port_usb) {
pr_debug("%s: USB disconnected\n", __func__);
@@ -190,9 +191,9 @@
list_del(&req->list);
req->length = SMD_RX_BUF_SIZE;
- spin_unlock_irq(&port->port_lock);
+ spin_unlock_irqrestore(&port->port_lock, flags);
ret = usb_ep_queue(out, req, GFP_KERNEL);
- spin_lock_irq(&port->port_lock);
+ spin_lock_irqsave(&port->port_lock, flags);
if (ret) {
pr_err("%s: usb ep out queue failed"
"port:%p, port#%d\n",
@@ -202,7 +203,7 @@
}
}
start_rx_end:
- spin_unlock_irq(&port->port_lock);
+ spin_unlock_irqrestore(&port->port_lock, flags);
}
static void gsmd_rx_push(struct work_struct *w)