pm: Account device pm state lock

Do not execute pm operations on devices that the device pm state is
locked.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-11-17 21:50:08 -08:00 committed by Anas Nashif
commit 0a32eadd13
4 changed files with 16 additions and 3 deletions

View file

@ -298,6 +298,7 @@ const char *pm_device_state_str(enum pm_device_state state);
* @retval -EALREADY If device is already at the requested state.
* @retval -EBUSY If device is changing its state.
* @retval -ENOSYS If device does not support PM.
* @retval -EPERM If device has power state locked.
* @retval Errno Other negative errno on failure.
*/
__deprecated int pm_device_state_set(const struct device *dev,
@ -418,6 +419,8 @@ bool pm_device_wakeup_is_capable(const struct device *dev);
* system power management or device runtime power
* management until unlocked.
*
* @note The given device should not have device runtime enabled.
*
* @see pm_device_state_unlock
*
* @param dev Device instance.