pm: device: runtime: refactor API
This patch refactors the runtime API to make it more clear and simple.
Relevant changes:
- API uses the action callback in a direct manner, avoiding unnecessary
overhead.
- API documentation has been improved to include detailed return error
codes.
- pm_runtime_disable() is now synchronous (to simplify possible error
paths) and returns error in case it fails. It is also safe to disable
in pre-kernel now.
- pm_runtime_put(_async)() will return -EALREADY if called with usage
count at zero (result of an unbalanced get/put call sequence)
- A transitional state has been added back. This makes code more
readable, and avoids using atomics (not required).
TODO:
- Solve in a better manner the asynchronous suspend error path (now
"solved" using asserts).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
4 files changed