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>
This commit is contained in:
committed by
Rafael J. Wysocki
parent
8bea8672ed
commit
1d531c14d2
@@ -701,14 +701,14 @@ EXPORT_SYMBOL_GPL(pm_request_resume);
|
|||||||
* @dev: Device to handle.
|
* @dev: Device to handle.
|
||||||
* @sync: If set and the device is suspended, resume it synchronously.
|
* @sync: If set and the device is suspended, resume it synchronously.
|
||||||
*
|
*
|
||||||
* Increment the usage count of the device and if it was zero previously,
|
* Increment the usage count of the device and resume it or submit a resume
|
||||||
* resume it or submit a resume request for it, depending on the value of @sync.
|
* request for it, depending on the value of @sync.
|
||||||
*/
|
*/
|
||||||
int __pm_runtime_get(struct device *dev, bool sync)
|
int __pm_runtime_get(struct device *dev, bool sync)
|
||||||
{
|
{
|
||||||
int retval = 1;
|
int retval;
|
||||||
|
|
||||||
if (atomic_add_return(1, &dev->power.usage_count) == 1)
|
atomic_inc(&dev->power.usage_count);
|
||||||
retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
|
retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
Reference in New Issue
Block a user