summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/s3c-hsotg.c
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2012-06-14 10:02:25 +0200
committerFelipe Balbi <balbi@ti.com>2012-06-15 14:37:50 +0300
commit2b19a52cc8a31ede990323d46a7faeeeba76bb8f (patch)
tree18ab359eb637516306b7a23e360285f27ca5bc0d /drivers/usb/gadget/s3c-hsotg.c
parent22258f4906aa87e0c0debcad22cb292453e2ebfb (diff)
downloadop-kernel-dev-2b19a52cc8a31ede990323d46a7faeeeba76bb8f.zip
op-kernel-dev-2b19a52cc8a31ede990323d46a7faeeeba76bb8f.tar.gz
usb: hsotg: samsung: Protect the udc_stop routine with spinlock
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/s3c-hsotg.c')
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index b107912..ee1fe2b8 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -2988,6 +2988,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
struct usb_gadget_driver *driver)
{
struct s3c_hsotg *hsotg = to_hsotg(gadget);
+ unsigned long flags = 0;
int ep;
if (!hsotg)
@@ -3000,6 +3001,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
for (ep = 0; ep < hsotg->num_of_eps; ep++)
s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
+ spin_lock_irqsave(&hsotg->lock, flags);
+
s3c_hsotg_phy_disable(hsotg);
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
@@ -3007,6 +3010,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
hsotg->gadget.speed = USB_SPEED_UNKNOWN;
hsotg->gadget.dev.driver = NULL;
+ spin_unlock_irqrestore(&hsotg->lock, flags);
+
dev_info(hsotg->dev, "unregistered gadget driver '%s'\n",
driver->driver.name);
OpenPOWER on IntegriCloud