usb: gadget: serial: resolve spinlock inconsistencies

kernel throws Possbile dead lock at f_serial  completion handlers,
if we use plain spinlock which dont disables interrupts.
To avoid this use spinlock_irqsave instead of plain spinlock
which disables interrupts.

Signed-off-by: Anji Jonnala <anjir@qualcomm.com>
This commit is contained in:
Anji Jonnala 2009-09-08 20:38:04 +05:30 committed by Stephen Boyd
parent 5f2b17e59d
commit 966c3cd67d

View file

@ -592,20 +592,22 @@ recycle:
static void gs_read_complete(struct usb_ep *ep, struct usb_request *req)
{
struct gs_port *port = ep->driver_data;
unsigned long flags;
/* Queue all received data until the tty layer is ready for it. */
spin_lock(&port->port_lock);
spin_lock_irqsave(&port->port_lock, flags);
port->nbytes_from_host += req->actual;
list_add_tail(&req->list, &port->read_queue);
tasklet_schedule(&port->push);
spin_unlock(&port->port_lock);
spin_unlock_irqrestore(&port->port_lock, flags);
}
static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
{
struct gs_port *port = ep->driver_data;
unsigned long flags;
spin_lock(&port->port_lock);
spin_lock_irqsave(&port->port_lock, flags);
port->nbytes_to_host += req->actual;
list_add(&req->list, &port->write_pool);
port->write_started--;
@ -628,7 +630,7 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
break;
}
spin_unlock(&port->port_lock);
spin_unlock_irqrestore(&port->port_lock, flags);
}
static void gs_free_requests(struct usb_ep *ep, struct list_head *head,