On Mon, 2 May 2011, Guennadi Liakhovetski wrote: > Hi all > > There are currently several functions similar to __pm_runtime_suspend() in > runtime.c, working according to the same principle: they check if the > RPM_GET_PUT flag is set, if so, they increment, or decrement-and-test the > usage-count, then call the actual worker function, e.g., rpm_suspend(). > This latter function can fail, then its return code will be passed back to > the caller, but - the usage counter will not be restored. Is this a design > decision or a bug? It's a design decision. In the case of suspend it really is the right thing to do. By calling the function you are telling the PM core that you're finished using the device. But some other code might be waiting to use it, therefore we do indeed want to decrement usage_count while leaving the device active. For resumes, you have the option of writing a little wrapper function that calls the underlying pm_runtime_get_* routine and then decrements usage_count if there was an error. Alan Stern _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm