summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndy Green <andy.green@linaro.org>2011-12-14 07:31:01 +0800
committerSebastien Jan <s-jan@ti.com>2011-12-19 15:17:11 +0100
commita1331b60acdae81a09fe916f45bdf974912e4b76 (patch)
treed55f2e2db273b3aa6294e0902d40ef57aaacbf9e /drivers
parent84dd8f09e0eadb64d7fca33465f1ba173d267149 (diff)
musb protect mode store with rpm
Signed-off-by: Andy Green <andy.green@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/musb/musb_core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2d3f1edf37d2..aa23a16593be 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1663,6 +1663,8 @@ musb_mode_store(struct device *dev, struct device_attribute *attr,
unsigned long flags;
int status;
+ pm_runtime_get_sync(musb->controller);
+
spin_lock_irqsave(&musb->lock, flags);
if (sysfs_streq(buf, "host"))
status = musb_platform_set_mode(musb, MUSB_HOST);
@@ -1674,6 +1676,8 @@ musb_mode_store(struct device *dev, struct device_attribute *attr,
status = -EINVAL;
spin_unlock_irqrestore(&musb->lock, flags);
+ pm_runtime_put(musb->controller);
+
return (status == 0) ? n : status;
}
static DEVICE_ATTR(mode, 0644, musb_mode_show, musb_mode_store);