aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-12-13 14:28:30 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2009-12-15 14:42:06 -0500
commit1d531c14d2ed4b24472a4d773f00ed6d1cd34ee7 (patch)
treea61fd40d1104c9a02e15baa4496c11e148f20804 /drivers/base
parent8bea8672edfca7ec5f661cafb218f1205863b343 (diff)
PM: allow for usage_count > 0 in pm_runtime_get()
This patch (as1308c) fixes __pm_runtime_get(). Currently the routine will resume a device if the prior usage count was 0. But this isn't right; thanks to pm_runtime_get_noresume() the usage count can be positive even while the device is suspended. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/runtime.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 5a01ecef4af..40d7720a4b2 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -701,15 +701,15 @@ EXPORT_SYMBOL_GPL(pm_request_resume);
701 * @dev: Device to handle. 701 * @dev: Device to handle.
702 * @sync: If set and the device is suspended, resume it synchronously. 702 * @sync: If set and the device is suspended, resume it synchronously.
703 * 703 *
704 * Increment the usage count of the device and if it was zero previously, 704 * Increment the usage count of the device and resume it or submit a resume
705 * resume it or submit a resume request for it, depending on the value of @sync. 705 * request for it, depending on the value of @sync.
706 */ 706 */
707int __pm_runtime_get(struct device *dev, bool sync) 707int __pm_runtime_get(struct device *dev, bool sync)
708{ 708{
709 int retval = 1; 709 int retval;
710 710
711 if (atomic_add_return(1, &dev->power.usage_count) == 1) 711 atomic_inc(&dev->power.usage_count);
712 retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev); 712 retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
713 713
714 return retval; 714 return retval;
715} 715}