diff options
author | Tony Lindgren <tony@atomide.com> | 2016-11-16 13:21:22 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-17 16:25:39 +0100 |
commit | c723bd6ec2b50e7c8b3424d9cb8febd8ffa3da1f (patch) | |
tree | dea28900666d75706f1a5056410ef9086317c1b5 /drivers/usb/musb/musb_core.c | |
parent | a5d906bb261cde5f881a949d3b0fbaa285dcc574 (diff) | |
download | op-kernel-dev-c723bd6ec2b50e7c8b3424d9cb8febd8ffa3da1f.zip op-kernel-dev-c723bd6ec2b50e7c8b3424d9cb8febd8ffa3da1f.tar.gz |
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>
Diffstat (limited to 'drivers/usb/musb/musb_core.c')
-rw-r--r-- | drivers/usb/musb/musb_core.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index e01116e..f1ea449 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) if (status) goto fail5; + musb->is_initialized = 1; pm_runtime_mark_last_busy(musb->controller); pm_runtime_put_autosuspend(musb->controller); @@ -2629,7 +2630,6 @@ static int musb_runtime_suspend(struct device *dev) static int musb_runtime_resume(struct device *dev) { struct musb *musb = dev_to_musb(dev); - static int first = 1; /* * When pm_runtime_get_sync called for the first time in driver @@ -2640,9 +2640,10 @@ static int musb_runtime_resume(struct device *dev) * Also context restore without save does not make * any sense */ - if (!first) - musb_restore_context(musb); - first = 0; + if (!musb->is_initialized) + return 0; + + musb_restore_context(musb); if (musb->need_finish_resume) { musb->need_finish_resume = 0; |