diff options
Diffstat (limited to 'drivers/base/power/runtime.c')
-rw-r--r-- | drivers/base/power/runtime.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 0a4b75f834c0..6e8577d1f750 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -185,6 +185,7 @@ int __pm_runtime_suspend(struct device *dev, bool from_wq) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | dev->power.runtime_status = RPM_SUSPENDING; | 187 | dev->power.runtime_status = RPM_SUSPENDING; |
188 | dev->power.deferred_resume = false; | ||
188 | 189 | ||
189 | if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend) { | 190 | if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend) { |
190 | spin_unlock_irq(&dev->power.lock); | 191 | spin_unlock_irq(&dev->power.lock); |
@@ -200,7 +201,6 @@ int __pm_runtime_suspend(struct device *dev, bool from_wq) | |||
200 | if (retval) { | 201 | if (retval) { |
201 | dev->power.runtime_status = RPM_ACTIVE; | 202 | dev->power.runtime_status = RPM_ACTIVE; |
202 | pm_runtime_cancel_pending(dev); | 203 | pm_runtime_cancel_pending(dev); |
203 | dev->power.deferred_resume = false; | ||
204 | 204 | ||
205 | if (retval == -EAGAIN || retval == -EBUSY) { | 205 | if (retval == -EAGAIN || retval == -EBUSY) { |
206 | notify = true; | 206 | notify = true; |
@@ -217,7 +217,6 @@ int __pm_runtime_suspend(struct device *dev, bool from_wq) | |||
217 | wake_up_all(&dev->power.wait_queue); | 217 | wake_up_all(&dev->power.wait_queue); |
218 | 218 | ||
219 | if (dev->power.deferred_resume) { | 219 | if (dev->power.deferred_resume) { |
220 | dev->power.deferred_resume = false; | ||
221 | __pm_runtime_resume(dev, false); | 220 | __pm_runtime_resume(dev, false); |
222 | retval = -EAGAIN; | 221 | retval = -EAGAIN; |
223 | goto out; | 222 | goto out; |
@@ -659,13 +658,17 @@ static int __pm_request_resume(struct device *dev) | |||
659 | 658 | ||
660 | pm_runtime_deactivate_timer(dev); | 659 | pm_runtime_deactivate_timer(dev); |
661 | 660 | ||
661 | if (dev->power.runtime_status == RPM_SUSPENDING) { | ||
662 | dev->power.deferred_resume = true; | ||
663 | return retval; | ||
664 | } | ||
662 | if (dev->power.request_pending) { | 665 | if (dev->power.request_pending) { |
663 | /* If non-resume request is pending, we can overtake it. */ | 666 | /* If non-resume request is pending, we can overtake it. */ |
664 | dev->power.request = retval ? RPM_REQ_NONE : RPM_REQ_RESUME; | 667 | dev->power.request = retval ? RPM_REQ_NONE : RPM_REQ_RESUME; |
665 | return retval; | 668 | return retval; |
666 | } else if (retval) { | ||
667 | return retval; | ||
668 | } | 669 | } |
670 | if (retval) | ||
671 | return retval; | ||
669 | 672 | ||
670 | dev->power.request = RPM_REQ_RESUME; | 673 | dev->power.request = RPM_REQ_RESUME; |
671 | dev->power.request_pending = true; | 674 | dev->power.request_pending = true; |