Re: [PATCH v1 05/49] USB: usblp: prepare for enabling irq in complete()

2013-08-17 Thread Pete Zaitcev
On Sun, 18 Aug 2013 00:24:30 +0800
Ming Lei  wrote:

> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Signed-off-by: Pete Zaitcev 
> Signed-off-by: Ming Lei 

Still looks good.

-- P
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v1 05/49] USB: usblp: prepare for enabling irq in complete()

2013-08-17 Thread Ming Lei
Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Signed-off-by: Pete Zaitcev 
Signed-off-by: Ming Lei 
---
 drivers/usb/class/usblp.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index d4c47d5..04163d8 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -297,6 +297,7 @@ static void usblp_bulk_read(struct urb *urb)
 {
struct usblp *usblp = urb->context;
int status = urb->status;
+   unsigned long flags;
 
if (usblp->present && usblp->used) {
if (status)
@@ -304,14 +305,14 @@ static void usblp_bulk_read(struct urb *urb)
"nonzero read bulk status received: %d\n",
usblp->minor, status);
}
-   spin_lock(&usblp->lock);
+   spin_lock_irqsave(&usblp->lock, flags);
if (status < 0)
usblp->rstatus = status;
else
usblp->rstatus = urb->actual_length;
usblp->rcomplete = 1;
wake_up(&usblp->rwait);
-   spin_unlock(&usblp->lock);
+   spin_unlock_irqrestore(&usblp->lock, flags);
 
usb_free_urb(urb);
 }
@@ -320,6 +321,7 @@ static void usblp_bulk_write(struct urb *urb)
 {
struct usblp *usblp = urb->context;
int status = urb->status;
+   unsigned long flags;
 
if (usblp->present && usblp->used) {
if (status)
@@ -327,7 +329,7 @@ static void usblp_bulk_write(struct urb *urb)
"nonzero write bulk status received: %d\n",
usblp->minor, status);
}
-   spin_lock(&usblp->lock);
+   spin_lock_irqsave(&usblp->lock, flags);
if (status < 0)
usblp->wstatus = status;
else
@@ -335,7 +337,7 @@ static void usblp_bulk_write(struct urb *urb)
usblp->no_paper = 0;
usblp->wcomplete = 1;
wake_up(&usblp->wwait);
-   spin_unlock(&usblp->lock);
+   spin_unlock_irqrestore(&usblp->lock, flags);
 
usb_free_urb(urb);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html