On 05/11/2017 04:59 PM, Sakari Ailus wrote:
On 05/11/2017 08:30 AM, Tomasz Figa wrote:
[...]
rval = pm_runtime_get_sync(dev);
if (rval < 0) {
pm_runtime_put(dev);
return rval;
}
Aren't we supposed to call pm_runtime_put() only when corresponding
pm_runtime_get() succeeds? I think the pm_runtime_put() call above
is not needed.
>
pm_runtime_get() increments the usage_count independently of whether it
succeeded. See __pm_runtime_resume().
You're right, sorry. I'd expect such things to be better covered in
the API documentation. Probably pm_runtime_put_noidle() is a better
match for just decreasing usage_count. Now many drivers appear to not
be balancing usage_count when when pm_runtime_get_sync() fails.
--
Regards,
Sylwester