aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2016-11-16 14:21:22 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-17 10:25:39 -0500
commitc723bd6ec2b50e7c8b3424d9cb8febd8ffa3da1f (patch)
treedea28900666d75706f1a5056410ef9086317c1b5
parenta5d906bb261cde5f881a949d3b0fbaa285dcc574 (diff)
usb: musb: Fix broken use of static variable for multiple instances
We can't use static variable first for checking when musb is initialized when we have multiple musb instances like on am335x. Tested-by: Ladislav Michl <ladis@linux-mips.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/musb/musb_core.c9
-rw-r--r--drivers/usb/musb/musb_core.h2
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index e01116e4c067..f1ea4494dcb2 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2291,6 +2291,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
2291 if (status) 2291 if (status)
2292 goto fail5; 2292 goto fail5;
2293 2293
2294 musb->is_initialized = 1;
2294 pm_runtime_mark_last_busy(musb->controller); 2295 pm_runtime_mark_last_busy(musb->controller);
2295 pm_runtime_put_autosuspend(musb->controller); 2296 pm_runtime_put_autosuspend(musb->controller);
2296 2297
@@ -2629,7 +2630,6 @@ static int musb_runtime_suspend(struct device *dev)
2629static int musb_runtime_resume(struct device *dev) 2630static int musb_runtime_resume(struct device *dev)
2630{ 2631{
2631 struct musb *musb = dev_to_musb(dev); 2632 struct musb *musb = dev_to_musb(dev);
2632 static int first = 1;
2633 2633
2634 /* 2634 /*
2635 * When pm_runtime_get_sync called for the first time in driver 2635 * When pm_runtime_get_sync called for the first time in driver
@@ -2640,9 +2640,10 @@ static int musb_runtime_resume(struct device *dev)
2640 * Also context restore without save does not make 2640 * Also context restore without save does not make
2641 * any sense 2641 * any sense
2642 */ 2642 */
2643 if (!first) 2643 if (!musb->is_initialized)
2644 musb_restore_context(musb); 2644 return 0;
2645 first = 0; 2645
2646 musb_restore_context(musb);
2646 2647
2647 if (musb->need_finish_resume) { 2648 if (musb->need_finish_resume) {
2648 musb->need_finish_resume = 0; 2649 musb->need_finish_resume = 0;
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 2cb88a498f8a..c04abf424c5c 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -385,6 +385,8 @@ struct musb {
385 int a_wait_bcon; /* VBUS timeout in msecs */ 385 int a_wait_bcon; /* VBUS timeout in msecs */
386 unsigned long idle_timeout; /* Next timeout in jiffies */ 386 unsigned long idle_timeout; /* Next timeout in jiffies */
387 387
388 unsigned is_initialized:1;
389
388 /* active means connected and not suspended */ 390 /* active means connected and not suspended */
389 unsigned is_active:1; 391 unsigned is_active:1;
390 392