diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2014-11-21 09:14:48 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-11-21 10:07:38 -0500 |
commit | 7ad8096edfe0529eabb3ad466184c8fbd6134e1a (patch) | |
tree | d9e479cd47769a80c56846db375b339f5df26e77 /drivers/usb/dwc2/platform.c | |
parent | 4ace06e8b3c32d6a601474af31580bbc1027fa9f (diff) |
usb: dwc2: gadget: add mutex to serialize init/deinit calls
This patch adds mutex, which protects initialization and
deinitialization procedures against suspend/resume methods. This mutex
will be needed by the updated suspend/resume calls, which tracks gadget
state.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2/platform.c')
-rw-r--r-- | drivers/usb/dwc2/platform.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 57eb8a3e022b..ec5658ac52ba 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/device.h> | 40 | #include <linux/device.h> |
41 | #include <linux/dma-mapping.h> | 41 | #include <linux/dma-mapping.h> |
42 | #include <linux/of_device.h> | 42 | #include <linux/of_device.h> |
43 | #include <linux/mutex.h> | ||
43 | #include <linux/platform_device.h> | 44 | #include <linux/platform_device.h> |
44 | 45 | ||
45 | #include <linux/usb/of.h> | 46 | #include <linux/usb/of.h> |
@@ -212,6 +213,7 @@ static int dwc2_driver_probe(struct platform_device *dev) | |||
212 | hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node); | 213 | hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node); |
213 | 214 | ||
214 | spin_lock_init(&hsotg->lock); | 215 | spin_lock_init(&hsotg->lock); |
216 | mutex_init(&hsotg->init_mutex); | ||
215 | retval = dwc2_gadget_init(hsotg, irq); | 217 | retval = dwc2_gadget_init(hsotg, irq); |
216 | if (retval) | 218 | if (retval) |
217 | return retval; | 219 | return retval; |