@@ -1723,9 +1723,11 @@ mode_show(struct device *dev, struct device_attribute *attr, char *buf)
unsigned long flags;
int ret;
+ pm_runtime_get_sync(dev);
spin_lock_irqsave(&musb->lock, flags);
ret = sprintf(buf, "%s\n", usb_otg_state_string(musb->xceiv->otg->state));
spin_unlock_irqrestore(&musb->lock, flags);
+ pm_runtime_put_sync(dev);
return ret;
}
@@ -1738,6 +1740,7 @@ mode_store(struct device *dev, struct device_attribute *attr,
unsigned long flags;
int status;
+ pm_runtime_get_sync(dev);
spin_lock_irqsave(&musb->lock, flags);
if (sysfs_streq(buf, "host"))
status = musb_platform_set_mode(musb, MUSB_HOST);
@@ -1748,6 +1751,7 @@ mode_store(struct device *dev, struct device_attribute *attr,
else
status = -EINVAL;
spin_unlock_irqrestore(&musb->lock, flags);
+ pm_runtime_put_sync(dev);
return (status == 0) ? n : status;
}
@@ -1766,6 +1770,7 @@ vbus_store(struct device *dev, struct device_attribute *attr,
return -EINVAL;
}
+ pm_runtime_get_sync(dev);
spin_lock_irqsave(&musb->lock, flags);
/* force T(a_wait_bcon) to be zero/unlimited *OR* valid */
musb->a_wait_bcon = val ? max_t(int, val, OTG_TIME_A_WAIT_BCON) : 0 ;
@@ -1773,6 +1778,7 @@ vbus_store(struct device *dev, struct device_attribute *attr,
musb->is_active = 0;
musb_platform_try_idle(musb, jiffies + msecs_to_jiffies(val));
spin_unlock_irqrestore(&musb->lock, flags);
+ pm_runtime_put_sync(dev);
return n;
}