From d41dadc569e1201826ac977b8759da2a720be498 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Fri, 2 Jul 2021 18:09:07 +0200 Subject: [PATCH] pm: rename PM_DEVICE_STATE_SUSPEND to PM_DEVICE_STATE_SUSPENDED The verb tense for the suspended state was not consistent with other states. The likely reason: state was being used as a command/action. Signed-off-by: Gerard Marull-Paretas --- doc/reference/power_management/index.rst | 8 ++++---- drivers/ethernet/eth_mcux.c | 2 +- drivers/flash/spi_flash_at45.c | 2 +- drivers/flash/spi_nor.c | 4 ++-- drivers/gpio/gpio_dw.c | 2 +- drivers/gpio/gpio_stm32.c | 2 +- drivers/i2c/i2c_nrfx_twi.c | 2 +- drivers/i2c/i2c_nrfx_twim.c | 2 +- .../interrupt_controller/intc_arcv2_irq_unit.c | 2 +- drivers/interrupt_controller/intc_ioapic.c | 2 +- drivers/interrupt_controller/intc_loapic.c | 2 +- drivers/modem/modem_receiver.c | 2 +- drivers/pwm/pwm_nrfx.c | 2 +- drivers/sensor/bmp388/bmp388.c | 2 +- drivers/sensor/fdc2x1x/fdc2x1x.c | 2 +- drivers/sensor/sgp40/sgp40.c | 2 +- drivers/serial/uart_npcx.c | 2 +- drivers/spi/spi_nrfx_spi.c | 2 +- drivers/spi/spi_nrfx_spim.c | 2 +- include/pm/device.h | 2 +- samples/boards/nrf/system_off/src/main.c | 4 ++-- samples/drivers/spi_flash_at45/src/main.c | 2 +- samples/sensor/apds9960/src/main.c | 2 +- samples/sensor/fdc2x1x/src/main.c | 4 ++-- subsys/net/ip/net_shell.c | 2 +- subsys/pm/device.c | 10 +++++----- subsys/pm/device_runtime.c | 18 +++++++++--------- tests/drivers/uart/uart_pm/src/main.c | 10 +++++----- tests/kernel/device/src/main.c | 2 +- tests/net/pm/src/main.c | 6 +++--- tests/subsys/pm/device_runtime/src/main.c | 12 ++++++------ tests/subsys/pm/power_mgmt/src/main.c | 2 +- 32 files changed, 61 insertions(+), 61 deletions(-) diff --git a/doc/reference/power_management/index.rst b/doc/reference/power_management/index.rst index af23b0951fa..28a18023ec4 100644 --- a/doc/reference/power_management/index.rst +++ b/doc/reference/power_management/index.rst @@ -248,7 +248,7 @@ The four device power states: Device context is preserved by the HW and need not be restored by the driver. -:code:`PM_DEVICE_STATE_SUSPEND` +:code:`PM_DEVICE_STATE_SUSPENDED` Most device context is lost by the hardware. Device drivers must save and restore or reinitialize any context lost by the hardware. @@ -256,12 +256,12 @@ The four device power states: :code:`PM_DEVICE_STATE_SUSPENDING` Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_ACTIVE` to - :c:macro:`PM_DEVICE_STATE_SUSPEND`. + :c:macro:`PM_DEVICE_STATE_SUSPENDED`. :code:`PM_DEVICE_STATE_RESUMING` - Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_SUSPEND` to - :c:macro:`PM_DEVICE_STATE_ACTIVE`. + Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_SUSPENDED` + to :c:macro:`PM_DEVICE_STATE_ACTIVE`. :code:`PM_DEVICE_STATE_OFF` diff --git a/drivers/ethernet/eth_mcux.c b/drivers/ethernet/eth_mcux.c index 8105d98f163..29a38424377 100644 --- a/drivers/ethernet/eth_mcux.c +++ b/drivers/ethernet/eth_mcux.c @@ -197,7 +197,7 @@ static int eth_mcux_device_pm_control(const struct device *dev, goto out; } - if (state == PM_DEVICE_STATE_SUSPEND) { + if (state == PM_DEVICE_STATE_SUSPENDED) { LOG_DBG("Suspending"); ret = net_if_suspend(eth_ctx->iface); diff --git a/drivers/flash/spi_flash_at45.c b/drivers/flash/spi_flash_at45.c index 0339aee2a07..ed4e2be1028 100644 --- a/drivers/flash/spi_flash_at45.c +++ b/drivers/flash/spi_flash_at45.c @@ -636,7 +636,7 @@ static int spi_flash_at45_pm_control(const struct device *dev, release(dev); break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: case PM_DEVICE_STATE_OFF: acquire(dev); power_down_op(dev, diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index fa0b94b5344..4673de3a42a 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -38,8 +38,8 @@ LOG_MODULE_REGISTER(spi_nor, CONFIG_FLASH_LOG_LEVEL); * * When mapped to the Zephyr Device Power Management states: * * PM_DEVICE_STATE_ACTIVE covers both active and standby modes; - * * PM_DEVICE_STATE_SUSPEND, and PM_DEVICE_STATE_OFF all correspond - * to deep-power-down mode. + * * PM_DEVICE_STATE_SUSPENDED, and PM_DEVICE_STATE_OFF all correspond to + * deep-power-down mode. */ #define SPI_NOR_MAX_ADDR_WIDTH 4 diff --git a/drivers/gpio/gpio_dw.c b/drivers/gpio/gpio_dw.c index 70febf21ca4..16b4e1b263e 100644 --- a/drivers/gpio/gpio_dw.c +++ b/drivers/gpio/gpio_dw.c @@ -446,7 +446,7 @@ static int gpio_dw_device_ctrl(const struct device *port, { int ret = 0; - if (state == PM_DEVICE_STATE_SUSPEND) { + if (state == PM_DEVICE_STATE_SUSPENDED) { ret = gpio_dw_suspend_port(port); } else if (state == PM_DEVICE_STATE_ACTIVE) { ret = gpio_dw_resume_from_suspend_port(port); diff --git a/drivers/gpio/gpio_stm32.c b/drivers/gpio/gpio_stm32.c index 59333a0f4ef..edb0e186482 100644 --- a/drivers/gpio/gpio_stm32.c +++ b/drivers/gpio/gpio_stm32.c @@ -581,7 +581,7 @@ static int gpio_stm32_set_power_state(const struct device *dev, if (state == PM_DEVICE_STATE_ACTIVE) { ret = gpio_stm32_clock_request(dev, true); - } else if (state == PM_DEVICE_STATE_SUSPEND) { + } else if (state == PM_DEVICE_STATE_SUSPENDED) { ret = gpio_stm32_clock_request(dev, false); } diff --git a/drivers/i2c/i2c_nrfx_twi.c b/drivers/i2c/i2c_nrfx_twi.c index 5d777dabc8f..5d6a0f9c6ef 100644 --- a/drivers/i2c/i2c_nrfx_twi.c +++ b/drivers/i2c/i2c_nrfx_twi.c @@ -230,7 +230,7 @@ static int twi_nrfx_pm_control(const struct device *dev, } break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: case PM_DEVICE_STATE_OFF: nrfx_twi_uninit(&get_dev_config(dev)->twi); break; diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index eda78f7a37a..5ccd257dacc 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -268,7 +268,7 @@ static int twim_nrfx_pm_control(const struct device *dev, } break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: case PM_DEVICE_STATE_OFF: nrfx_twim_uninit(&get_dev_config(dev)->twim); break; diff --git a/drivers/interrupt_controller/intc_arcv2_irq_unit.c b/drivers/interrupt_controller/intc_arcv2_irq_unit.c index d1407b4d5c7..7875f249856 100644 --- a/drivers/interrupt_controller/intc_arcv2_irq_unit.c +++ b/drivers/interrupt_controller/intc_arcv2_irq_unit.c @@ -180,7 +180,7 @@ static int arc_v2_irq_unit_device_ctrl(const struct device *dev, int ret = 0; unsigned int key = arch_irq_lock(); - if (state == PM_DEVICE_STATE_SUSPEND) { + if (state == PM_DEVICE_STATE_SUSPENDED) { ret = arc_v2_irq_unit_suspend(dev); } else if (state == PM_DEVICE_STATE_ACTIVE) { ret = arc_v2_irq_unit_resume(dev); diff --git a/drivers/interrupt_controller/intc_ioapic.c b/drivers/interrupt_controller/intc_ioapic.c index c9b5245c6ab..c244b3ca339 100644 --- a/drivers/interrupt_controller/intc_ioapic.c +++ b/drivers/interrupt_controller/intc_ioapic.c @@ -318,7 +318,7 @@ static int ioapic_device_ctrl(const struct device *dev, case PM_DEVICE_STATE_ACTIVE: ret = ioapic_resume_from_suspend(dev); break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: case PM_DEVICE_STATE_OFF: ret = ioapic_suspend(dev); break; diff --git a/drivers/interrupt_controller/intc_loapic.c b/drivers/interrupt_controller/intc_loapic.c index 2f777226d4c..a8833cb9e74 100644 --- a/drivers/interrupt_controller/intc_loapic.c +++ b/drivers/interrupt_controller/intc_loapic.c @@ -413,7 +413,7 @@ static int loapic_device_ctrl(const struct device *port, { int ret = 0; - if (state == PM_DEVICE_STATE_SUSPEND) { + if (state == PM_DEVICE_STATE_SUSPENDED) { ret = loapic_suspend(port); } else if (state == PM_DEVICE_STATE_ACTIVE) { ret = loapic_resume(port); diff --git a/drivers/modem/modem_receiver.c b/drivers/modem/modem_receiver.c index c70315747ce..63aaa6ec338 100644 --- a/drivers/modem/modem_receiver.c +++ b/drivers/modem/modem_receiver.c @@ -199,7 +199,7 @@ int mdm_receiver_sleep(struct mdm_receiver_context *ctx) { uart_irq_rx_disable(ctx->uart_dev); #ifdef CONFIG_PM_DEVICE - pm_device_state_set(ctx->uart_dev, PM_DEVICE_STATE_SUSPEND); + pm_device_state_set(ctx->uart_dev, PM_DEVICE_STATE_SUSPENDED); #endif return 0; } diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index de4c6243c6b..c270e03a09d 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -301,7 +301,7 @@ static int pwm_nrfx_set_power_state(enum pm_device_state state, case PM_DEVICE_STATE_ACTIVE: err = pwm_nrfx_init(dev); break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: case PM_DEVICE_STATE_OFF: pwm_nrfx_uninit(dev); break; diff --git a/drivers/sensor/bmp388/bmp388.c b/drivers/sensor/bmp388/bmp388.c index df20d6d8fca..b379c47e7f7 100644 --- a/drivers/sensor/bmp388/bmp388.c +++ b/drivers/sensor/bmp388/bmp388.c @@ -556,7 +556,7 @@ static int bmp388_set_power_state(const struct device *dev, if (state == PM_DEVICE_STATE_ACTIVE) { reg_val = BMP388_PWR_CTRL_MODE_NORMAL; - } else if ((state == PM_DEVICE_STATE_SUSPEND) || + } else if ((state == PM_DEVICE_STATE_SUSPENDED) || (state == PM_DEVICE_STATE_OFF)) { reg_val = BMP388_PWR_CTRL_MODE_SLEEP; } else { diff --git a/drivers/sensor/fdc2x1x/fdc2x1x.c b/drivers/sensor/fdc2x1x/fdc2x1x.c index 941acf866fd..dfc0b267d5f 100644 --- a/drivers/sensor/fdc2x1x/fdc2x1x.c +++ b/drivers/sensor/fdc2x1x/fdc2x1x.c @@ -506,7 +506,7 @@ static int fdc2x1x_set_pm_state(const struct device *dev, } break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: if (curr_state == PM_DEVICE_STATE_OFF) { ret = fdc2x1x_set_shutdown(dev, false); if (ret) { diff --git a/drivers/sensor/sgp40/sgp40.c b/drivers/sensor/sgp40/sgp40.c index 3a5af61573e..7e07fd7bf18 100644 --- a/drivers/sensor/sgp40/sgp40.c +++ b/drivers/sensor/sgp40/sgp40.c @@ -195,7 +195,7 @@ static int sgp40_set_power_state(const struct device *dev, if (power_state == PM_DEVICE_STATE_ACTIVE) { /* activate the hotplate by sending a measure command */ cmd = SGP40_CMD_MEASURE_RAW; - } else if (power_state == PM_DEVICE_STATE_SUSPEND) { + } else if (power_state == PM_DEVICE_STATE_SUSPENDED) { cmd = SGP40_CMD_HEATER_OFF; } else { LOG_DBG("Power state not implemented."); diff --git a/drivers/serial/uart_npcx.c b/drivers/serial/uart_npcx.c index e534fb9fcfe..11c0916ab44 100644 --- a/drivers/serial/uart_npcx.c +++ b/drivers/serial/uart_npcx.c @@ -442,7 +442,7 @@ static inline int uart_npcx_set_power_state(const struct device *dev, enum pm_device_state next_state) { /* If next device power state is LOW or SUSPEND power state */ - if (next_state == PM_DEVICE_STATE_SUSPEND) { + if (next_state == PM_DEVICE_STATE_SUSPENDED) { /* * If uart device is busy with transmitting, the driver will * stay in while loop and wait for the transaction is completed. diff --git a/drivers/spi/spi_nrfx_spi.c b/drivers/spi/spi_nrfx_spi.c index f043edbfb89..7b02834bcf3 100644 --- a/drivers/spi/spi_nrfx_spi.c +++ b/drivers/spi/spi_nrfx_spi.c @@ -291,7 +291,7 @@ static int spi_nrfx_pm_control(const struct device *dev, data->ctx.config = NULL; break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: case PM_DEVICE_STATE_OFF: nrfx_spi_uninit(&config->spi); break; diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 19691e85862..e2cd11bbd36 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -338,7 +338,7 @@ static int spim_nrfx_pm_control(const struct device *dev, data->ctx.config = NULL; break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: case PM_DEVICE_STATE_OFF: nrfx_spim_uninit(&config->spim); break; diff --git a/include/pm/device.h b/include/pm/device.h index 555004fcf42..5a019e56640 100644 --- a/include/pm/device.h +++ b/include/pm/device.h @@ -41,7 +41,7 @@ enum pm_device_state { * @note * Device context may be lost. */ - PM_DEVICE_STATE_SUSPEND, + PM_DEVICE_STATE_SUSPENDED, /** * Device is suspended (forced). * diff --git a/samples/boards/nrf/system_off/src/main.c b/samples/boards/nrf/system_off/src/main.c index eeef121c356..a73f946700a 100644 --- a/samples/boards/nrf/system_off/src/main.c +++ b/samples/boards/nrf/system_off/src/main.c @@ -66,7 +66,7 @@ void main(void) k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC); printk("Busy-wait %u s with UART off\n", BUSY_WAIT_S); - rc = pm_device_state_set(cons, PM_DEVICE_STATE_SUSPEND); + rc = pm_device_state_set(cons, PM_DEVICE_STATE_SUSPENDED); k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC); rc = pm_device_state_set(cons, PM_DEVICE_STATE_ACTIVE); @@ -74,7 +74,7 @@ void main(void) k_sleep(K_SECONDS(SLEEP_S)); printk("Sleep %u s with UART off\n", SLEEP_S); - rc = pm_device_state_set(cons, PM_DEVICE_STATE_SUSPEND); + rc = pm_device_state_set(cons, PM_DEVICE_STATE_SUSPENDED); k_sleep(K_SECONDS(SLEEP_S)); rc = pm_device_state_set(cons, PM_DEVICE_STATE_ACTIVE); diff --git a/samples/drivers/spi_flash_at45/src/main.c b/samples/drivers/spi_flash_at45/src/main.c index 7f88f8693e0..49c4df09f94 100644 --- a/samples/drivers/spi_flash_at45/src/main.c +++ b/samples/drivers/spi_flash_at45/src/main.c @@ -151,7 +151,7 @@ void main(void) #if IS_ENABLED(CONFIG_PM_DEVICE) printk("Putting the flash device into suspended state... "); - err = pm_device_state_set(flash_dev, PM_DEVICE_STATE_SUSPEND); + err = pm_device_state_set(flash_dev, PM_DEVICE_STATE_SUSPENDED); if (err != 0) { printk("FAILED\n"); return; diff --git a/samples/sensor/apds9960/src/main.c b/samples/sensor/apds9960/src/main.c index d1b05577b9b..f16f9a0432c 100644 --- a/samples/sensor/apds9960/src/main.c +++ b/samples/sensor/apds9960/src/main.c @@ -79,7 +79,7 @@ void main(void) #ifdef CONFIG_PM_DEVICE enum pm_device_state p_state; - p_state = PM_DEVICE_STATE_SUSPEND; + p_state = PM_DEVICE_STATE_SUSPENDED; pm_device_state_set(dev, p_state); printk("set low power state for 2s\n"); k_sleep(K_MSEC(2000)); diff --git a/samples/sensor/fdc2x1x/src/main.c b/samples/sensor/fdc2x1x/src/main.c index 7d7119b8aed..04b40e9dfed 100644 --- a/samples/sensor/fdc2x1x/src/main.c +++ b/samples/sensor/fdc2x1x/src/main.c @@ -43,7 +43,7 @@ static void pm_info(enum pm_device_state state, int status) case PM_DEVICE_STATE_ACTIVE: printk("Enter ACTIVE_STATE "); break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: printk("Enter SUSPEND_STATE "); break; case PM_DEVICE_STATE_OFF: @@ -95,7 +95,7 @@ void main(void) enum pm_device_state p_state; int ret; - p_state = PM_DEVICE_STATE_SUSPEND; + p_state = PM_DEVICE_STATE_SUSPENDED; ret = pm_device_state_set(dev, p_state); pm_info(p_state, ret); diff --git a/subsys/net/ip/net_shell.c b/subsys/net/ip/net_shell.c index 902e3b59a3f..e56d89bfcfe 100644 --- a/subsys/net/ip/net_shell.c +++ b/subsys/net/ip/net_shell.c @@ -5532,7 +5532,7 @@ static int cmd_net_suspend(const struct shell *shell, size_t argc, dev = net_if_get_device(iface); - ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPEND); + ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPENDED); if (ret != 0) { PR_INFO("Iface could not be suspended: "); diff --git a/subsys/pm/device.c b/subsys/pm/device.c index 459200314dd..d19afbd1f3d 100644 --- a/subsys/pm/device.c +++ b/subsys/pm/device.c @@ -84,7 +84,7 @@ static int _pm_devices(uint32_t state) int pm_suspend_devices(void) { - return _pm_devices(PM_DEVICE_STATE_SUSPEND); + return _pm_devices(PM_DEVICE_STATE_SUSPENDED); } int pm_low_power_devices(void) @@ -117,8 +117,8 @@ const char *pm_device_state_str(enum pm_device_state state) return "active"; case PM_DEVICE_STATE_LOW_POWER: return "low power"; - case PM_DEVICE_STATE_SUSPEND: - return "suspend"; + case PM_DEVICE_STATE_SUSPENDED: + return "suspended"; case PM_DEVICE_STATE_FORCE_SUSPEND: return "force suspend"; case PM_DEVICE_STATE_OFF: @@ -138,8 +138,8 @@ int pm_device_state_set(const struct device *dev, } switch (state) { - case PM_DEVICE_STATE_SUSPEND: - if ((dev->pm->state == PM_DEVICE_STATE_SUSPEND) || + case PM_DEVICE_STATE_SUSPENDED: + if ((dev->pm->state == PM_DEVICE_STATE_SUSPENDED) || (dev->pm->state == PM_DEVICE_STATE_SUSPENDING)) { return -EALREADY; } diff --git a/subsys/pm/device_runtime.c b/subsys/pm/device_runtime.c index 9140cde895d..7239ef9634a 100644 --- a/subsys/pm/device_runtime.c +++ b/subsys/pm/device_runtime.c @@ -27,13 +27,13 @@ static void pm_device_runtime_state_set(struct pm_device *pm) switch (dev->pm->state) { case PM_DEVICE_STATE_ACTIVE: if ((dev->pm->usage == 0) && dev->pm->enable) { - ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPEND); + ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPENDED); if (ret == 0) { - dev->pm->state = PM_DEVICE_STATE_SUSPEND; + dev->pm->state = PM_DEVICE_STATE_SUSPENDED; } } break; - case PM_DEVICE_STATE_SUSPEND: + case PM_DEVICE_STATE_SUSPENDED: if ((dev->pm->usage > 0) || !dev->pm->enable) { ret = pm_device_state_set(dev, PM_DEVICE_STATE_ACTIVE); if (ret == 0) { @@ -77,7 +77,7 @@ static int pm_device_request(const struct device *dev, SYS_PORT_TRACING_FUNC_ENTER(pm, device_request, dev, target_state); __ASSERT((target_state == PM_DEVICE_STATE_ACTIVE) || - (target_state == PM_DEVICE_STATE_SUSPEND), + (target_state == PM_DEVICE_STATE_SUSPENDED), "Invalid device PM state requested"); if (k_is_pre_kernel()) { @@ -101,7 +101,7 @@ static int pm_device_request(const struct device *dev, if (dev->pm->usage == 1) { (void)pm_device_state_set(dev, PM_DEVICE_STATE_ACTIVE); } else if (dev->pm->usage == 0) { - (void)pm_device_state_set(dev, PM_DEVICE_STATE_SUSPEND); + (void)pm_device_state_set(dev, PM_DEVICE_STATE_SUSPENDED); } goto out; } @@ -164,12 +164,12 @@ int pm_device_get_async(const struct device *dev) int pm_device_put(const struct device *dev) { - return pm_device_request(dev, PM_DEVICE_STATE_SUSPEND, 0); + return pm_device_request(dev, PM_DEVICE_STATE_SUSPENDED, 0); } int pm_device_put_async(const struct device *dev) { - return pm_device_request(dev, PM_DEVICE_STATE_SUSPEND, PM_DEVICE_ASYNC); + return pm_device_request(dev, PM_DEVICE_STATE_SUSPENDED, PM_DEVICE_ASYNC); } void pm_device_enable(const struct device *dev) @@ -179,7 +179,7 @@ void pm_device_enable(const struct device *dev) dev->pm->dev = dev; if (dev->pm_control != NULL) { dev->pm->enable = true; - dev->pm->state = PM_DEVICE_STATE_SUSPEND; + dev->pm->state = PM_DEVICE_STATE_SUSPENDED; k_work_init_delayable(&dev->pm->work, pm_work_handler); } goto out; @@ -199,7 +199,7 @@ void pm_device_enable(const struct device *dev) */ if (!dev->pm->dev) { dev->pm->dev = dev; - dev->pm->state = PM_DEVICE_STATE_SUSPEND; + dev->pm->state = PM_DEVICE_STATE_SUSPENDED; k_work_init_delayable(&dev->pm->work, pm_work_handler); } else { k_work_schedule(&dev->pm->work, K_NO_WAIT); diff --git a/tests/drivers/uart/uart_pm/src/main.c b/tests/drivers/uart/uart_pm/src/main.c index 9a53c17bf93..d9c0052d98c 100644 --- a/tests/drivers/uart/uart_pm/src/main.c +++ b/tests/drivers/uart/uart_pm/src/main.c @@ -148,13 +148,13 @@ static void test_uart_pm_in_idle(void) state_verify(dev, PM_DEVICE_STATE_ACTIVE); communication_verify(dev, true); - state_set(dev, PM_DEVICE_STATE_SUSPEND, 0); + state_set(dev, PM_DEVICE_STATE_SUSPENDED, 0); communication_verify(dev, false); state_set(dev, PM_DEVICE_STATE_ACTIVE, 0); communication_verify(dev, true); - state_set(dev, PM_DEVICE_STATE_SUSPEND, 0); + state_set(dev, PM_DEVICE_STATE_SUSPENDED, 0); communication_verify(dev, false); state_set(dev, PM_DEVICE_STATE_ACTIVE, 0); @@ -171,7 +171,7 @@ static void test_uart_pm_poll_tx(void) communication_verify(dev, true); uart_poll_out(dev, 'a'); - state_set(dev, PM_DEVICE_STATE_SUSPEND, 0); + state_set(dev, PM_DEVICE_STATE_SUSPENDED, 0); communication_verify(dev, false); @@ -181,7 +181,7 @@ static void test_uart_pm_poll_tx(void) /* Now same thing but with callback */ uart_poll_out(dev, 'a'); - state_set(dev, PM_DEVICE_STATE_SUSPEND, 0); + state_set(dev, PM_DEVICE_STATE_SUSPENDED, 0); communication_verify(dev, false); @@ -194,7 +194,7 @@ static void timeout(struct k_timer *timer) { const struct device *uart = k_timer_user_data_get(timer); - state_set(uart, PM_DEVICE_STATE_SUSPEND, 0); + state_set(uart, PM_DEVICE_STATE_SUSPENDED, 0); } static K_TIMER_DEFINE(pm_timer, timeout, NULL); diff --git a/tests/kernel/device/src/main.c b/tests/kernel/device/src/main.c index c4ea2c46d4c..581bac484d7 100644 --- a/tests/kernel/device/src/main.c +++ b/tests/kernel/device/src/main.c @@ -287,7 +287,7 @@ void test_dummy_device_pm(void) { const struct device *dev; int busy, ret; - enum pm_device_state device_power_state = PM_DEVICE_STATE_SUSPEND; + enum pm_device_state device_power_state = PM_DEVICE_STATE_SUSPENDED; dev = device_get_binding(DUMMY_PORT_2); zassert_false((dev == NULL), NULL); diff --git a/tests/net/pm/src/main.c b/tests/net/pm/src/main.c index 42e1a29943f..25e5a836bd8 100644 --- a/tests/net/pm/src/main.c +++ b/tests/net/pm/src/main.c @@ -27,7 +27,7 @@ static int fake_dev_pm_control(const struct device *dev, struct fake_dev_context *ctx = dev->data; int ret = 0; - if (state == PM_DEVICE_STATE_SUSPEND) { + if (state == PM_DEVICE_STATE_SUSPENDED) { ret = net_if_suspend(ctx->iface); if (ret == -EBUSY) { goto out; @@ -142,13 +142,13 @@ void test_pm(void) */ k_yield(); - ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPEND); + ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPENDED); zassert_true(ret == 0, "Could not set state"); zassert_true(net_if_is_suspended(iface), "net iface is not suspended"); /* Let's try to suspend it again, it should fail relevantly */ - ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPEND); + ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPENDED); zassert_true(ret == -EALREADY, "Could change state"); zassert_true(net_if_is_suspended(iface), "net iface is not suspended"); diff --git a/tests/subsys/pm/device_runtime/src/main.c b/tests/subsys/pm/device_runtime/src/main.c index 29e66387b2a..ba32406719c 100644 --- a/tests/subsys/pm/device_runtime/src/main.c +++ b/tests/subsys/pm/device_runtime/src/main.c @@ -48,7 +48,7 @@ void threadA_func(void *arg1, void *arg2, void *arg3) /* At this point threadB should have put the device and * the current state should be SUSPENDED. */ - zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPEND, "Wrong state"); + zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPENDED, "Wrong state"); k_sem_take(&sem, K_FOREVER); @@ -81,7 +81,7 @@ void threadB_func(void *arg1, void *arg2, void *arg3) zassert_true(ret == 0, "Fail to wait transaction"); /* Check the state */ - zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPEND, "Wrong state"); + zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPENDED, "Wrong state"); } /* @@ -135,7 +135,7 @@ void test_teardown(void) ret = api->close_sync(dev); zassert_true(ret == 0, "Fail to suspend device"); - zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPEND, "Wrong state"); + zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPENDED, "Wrong state"); } /* @@ -161,7 +161,7 @@ void test_sync(void) ret = api->close_sync(dev); zassert_true(ret == 0, "Fail to suspend device"); - zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPEND, "Wrong state"); + zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPENDED, "Wrong state"); } /* @@ -186,7 +186,7 @@ void test_multiple_times(void) ret = api->close_sync(dev); zassert_true(ret == 0, "Fail to suspend device"); - zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPEND, "Wrong state"); + zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPENDED, "Wrong state"); } /* Now do all requests for get and then all for put*/ @@ -204,7 +204,7 @@ void test_multiple_times(void) zassert_true(ret == 0, "Fail to wait transaction"); /* Check the state */ - zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPEND, "Wrong state"); + zassert_true(dev->pm->state == PM_DEVICE_STATE_SUSPENDED, "Wrong state"); /* Finally off by one to keep the device active*/ for (i = 0; i < MAX_TIMES; i++) { diff --git a/tests/subsys/pm/power_mgmt/src/main.c b/tests/subsys/pm/power_mgmt/src/main.c index d27610bee9d..1b17bb4370d 100644 --- a/tests/subsys/pm/power_mgmt/src/main.c +++ b/tests/subsys/pm/power_mgmt/src/main.c @@ -181,7 +181,7 @@ void test_power_state_notification(void) api->close(dev); pm_device_state_get(dev, &device_power_state); - zassert_equal(device_power_state, PM_DEVICE_STATE_SUSPEND, NULL); + zassert_equal(device_power_state, PM_DEVICE_STATE_SUSPENDED, NULL); /* reopen device as it will be closed in teardown */ api->open(dev); }