/* If @check_resume is set and there's a resume request pending when __pm_runtime_disable() is called and power.disable_depth is zero, the function will wake up the device before disabling its run-time PM.  */
void __pm_runtime_disable(struct device *dev, bool check_resume)
/* If @check_resume is set and there's a resume request pending when __pm_runtime_disable() is called and power.disable_depth is zero, the function will wake up the device before disabling its run-time PM.  */
void __pm_runtime_disable(struct device *dev, bool check_resume)
{
	spin_lock_irq(&dev->power.lock);
	if (dev->power.disable_depth > 0) {
		dev->power.disable_depth++;
		goto out;
	}
	if (check_resume && dev->power.request_pending
	    && dev->power.request == RPM_REQ_RESUME) {
		pm_runtime_get_noresume(dev);
		__pm_runtime_resume(dev, false);
		pm_runtime_put_noidle(dev);
	}
	if (!dev->power.disable_depth++)
		__pm_runtime_barrier(dev);
 out:
	spin_unlock_irq(&dev->power.lock);
}