]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
usb: gadget: s3c-hsotg: fix spinlock locking
authorRobert Baldyga <r.baldyga@samsung.com>
Thu, 21 Nov 2013 12:49:17 +0000 (13:49 +0100)
committerFelipe Balbi <balbi@ti.com>
Mon, 25 Nov 2013 16:25:57 +0000 (10:25 -0600)
This patch adds missing spinlock locking in s3c_hsotg_complete_setup function,
and unlocking for gadget setup call.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/s3c-hsotg.c

index 9875d9c0823f7c554744a40acb0a70897dde0bc6..56fad76baa533b6a0739eb5e0e23b07637dce539 100644 (file)
@@ -1245,7 +1245,9 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
        /* as a fallback, try delivering it to the driver to deal with */
 
        if (ret == 0 && hsotg->driver) {
+               spin_unlock(&hsotg->lock);
                ret = hsotg->driver->setup(&hsotg->gadget, ctrl);
+               spin_lock(&hsotg->lock);
                if (ret < 0)
                        dev_dbg(hsotg->dev, "driver->setup() ret %d\n", ret);
        }
@@ -1308,10 +1310,12 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
                return;
        }
 
+       spin_lock(&hsotg->lock);
        if (req->actual == 0)
                s3c_hsotg_enqueue_setup(hsotg);
        else
                s3c_hsotg_process_control(hsotg, req->buf);
+       spin_unlock(&hsotg->lock);
 }
 
 /**