pm: use enum for device PM states

Move all PM_DEVICE_STATE_* definitions to an enum. The
PM_DEVICE_STATE_SET and PM_DEVICE_STATE_GET definitions have been kept
out of the enum since they do not represent any state. However, their
name has not been changed since they will be removed soon.

All drivers and tests have been adjusted accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-06-03 19:06:53 +02:00 committed by Anas Nashif
commit cc2f0e9c08
53 changed files with 214 additions and 231 deletions

View file

@ -41,7 +41,7 @@ struct uart_npcx_data {
void *user_data;
#endif
#ifdef CONFIG_PM_DEVICE
uint32_t pm_state;
enum pm_device_state pm_state;
#endif
};
@ -442,7 +442,7 @@ static inline bool uart_npcx_device_is_transmitting(const struct device *dev)
}
static inline int uart_npcx_get_power_state(const struct device *dev,
uint32_t *state)
enum pm_device_state *state)
{
const struct uart_npcx_data *const data = DRV_DATA(dev);
@ -451,7 +451,7 @@ static inline int uart_npcx_get_power_state(const struct device *dev,
}
static inline int uart_npcx_set_power_state(const struct device *dev,
uint32_t next_state)
enum pm_device_state next_state)
{
struct uart_npcx_data *const data = DRV_DATA(dev);
@ -473,7 +473,7 @@ static inline int uart_npcx_set_power_state(const struct device *dev,
/* Implements the device power management control functionality */
static int uart_npcx_pm_control(const struct device *dev, uint32_t ctrl_command,
uint32_t *state, pm_device_cb cb, void *arg)
enum pm_device_state *state, pm_device_cb cb, void *arg)
{
int ret = 0;