pm: device_runtime: Return possible error on enable

Change the function pm_device_runtime_enable() to return 0 on
success or an error code in case of error.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-12-14 09:47:00 -08:00 committed by Anas Nashif
commit 18b932f10d
13 changed files with 29 additions and 22 deletions

View file

@ -28,8 +28,12 @@ extern "C" {
* @funcprops \pre_kernel_ok
*
* @param dev Device instance.
*
* @retval 0 If the device runtime PM is enabled successfully.
* @retval -EPERM If device has power state locked.
* @retval -ENOSYS If the functionality is not available.
*/
void pm_device_runtime_enable(const struct device *dev);
int pm_device_runtime_enable(const struct device *dev);
/**
* @brief Disable device runtime PM
@ -131,7 +135,7 @@ int pm_device_runtime_put_async(const struct device *dev);
bool pm_device_runtime_is_enabled(const struct device *dev);
#else
static inline void pm_device_runtime_enable(const struct device *dev) { }
static inline int pm_device_runtime_enable(const struct device *dev) { return -ENOSYS; }
static inline int pm_device_runtime_disable(const struct device *dev) { return -ENOSYS; }
static inline int pm_device_runtime_get(const struct device *dev) { return -ENOSYS; }
static inline int pm_device_runtime_put(const struct device *dev) { return -ENOSYS; }

View file

@ -1985,8 +1985,9 @@ void sys_trace_idle(void);
/**
* @brief Trace enabling device runtime PM call exit.
* @param dev Device instance.
* @param ret Return value.
*/
#define sys_port_trace_pm_device_runtime_enable_exit(dev)
#define sys_port_trace_pm_device_runtime_enable_exit(dev, ret)
/**
* @brief Trace disabling device runtime PM call entry.