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 <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-07-02 18:09:07 +02:00 committed by Anas Nashif
commit d41dadc569
32 changed files with 61 additions and 61 deletions

View file

@ -248,7 +248,7 @@ The four device power states:
Device context is preserved by the HW and need not be restored by the driver. 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 Most device context is lost by the hardware. Device drivers must save and
restore or reinitialize any context lost by the hardware. restore or reinitialize any context lost by the hardware.
@ -256,12 +256,12 @@ The four device power states:
:code:`PM_DEVICE_STATE_SUSPENDING` :code:`PM_DEVICE_STATE_SUSPENDING`
Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_ACTIVE` to 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` :code:`PM_DEVICE_STATE_RESUMING`
Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_SUSPEND` to Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_SUSPENDED`
:c:macro:`PM_DEVICE_STATE_ACTIVE`. to :c:macro:`PM_DEVICE_STATE_ACTIVE`.
:code:`PM_DEVICE_STATE_OFF` :code:`PM_DEVICE_STATE_OFF`

View file

@ -197,7 +197,7 @@ static int eth_mcux_device_pm_control(const struct device *dev,
goto out; goto out;
} }
if (state == PM_DEVICE_STATE_SUSPEND) { if (state == PM_DEVICE_STATE_SUSPENDED) {
LOG_DBG("Suspending"); LOG_DBG("Suspending");
ret = net_if_suspend(eth_ctx->iface); ret = net_if_suspend(eth_ctx->iface);

View file

@ -636,7 +636,7 @@ static int spi_flash_at45_pm_control(const struct device *dev,
release(dev); release(dev);
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
acquire(dev); acquire(dev);
power_down_op(dev, power_down_op(dev,

View file

@ -38,8 +38,8 @@ LOG_MODULE_REGISTER(spi_nor, CONFIG_FLASH_LOG_LEVEL);
* *
* When mapped to the Zephyr Device Power Management states: * When mapped to the Zephyr Device Power Management states:
* * PM_DEVICE_STATE_ACTIVE covers both active and standby modes; * * PM_DEVICE_STATE_ACTIVE covers both active and standby modes;
* * PM_DEVICE_STATE_SUSPEND, and PM_DEVICE_STATE_OFF all correspond * * PM_DEVICE_STATE_SUSPENDED, and PM_DEVICE_STATE_OFF all correspond to
* to deep-power-down mode. * deep-power-down mode.
*/ */
#define SPI_NOR_MAX_ADDR_WIDTH 4 #define SPI_NOR_MAX_ADDR_WIDTH 4

View file

@ -446,7 +446,7 @@ static int gpio_dw_device_ctrl(const struct device *port,
{ {
int ret = 0; int ret = 0;
if (state == PM_DEVICE_STATE_SUSPEND) { if (state == PM_DEVICE_STATE_SUSPENDED) {
ret = gpio_dw_suspend_port(port); ret = gpio_dw_suspend_port(port);
} else if (state == PM_DEVICE_STATE_ACTIVE) { } else if (state == PM_DEVICE_STATE_ACTIVE) {
ret = gpio_dw_resume_from_suspend_port(port); ret = gpio_dw_resume_from_suspend_port(port);

View file

@ -581,7 +581,7 @@ static int gpio_stm32_set_power_state(const struct device *dev,
if (state == PM_DEVICE_STATE_ACTIVE) { if (state == PM_DEVICE_STATE_ACTIVE) {
ret = gpio_stm32_clock_request(dev, true); 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); ret = gpio_stm32_clock_request(dev, false);
} }

View file

@ -230,7 +230,7 @@ static int twi_nrfx_pm_control(const struct device *dev,
} }
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
nrfx_twi_uninit(&get_dev_config(dev)->twi); nrfx_twi_uninit(&get_dev_config(dev)->twi);
break; break;

View file

@ -268,7 +268,7 @@ static int twim_nrfx_pm_control(const struct device *dev,
} }
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
nrfx_twim_uninit(&get_dev_config(dev)->twim); nrfx_twim_uninit(&get_dev_config(dev)->twim);
break; break;

View file

@ -180,7 +180,7 @@ static int arc_v2_irq_unit_device_ctrl(const struct device *dev,
int ret = 0; int ret = 0;
unsigned int key = arch_irq_lock(); 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); ret = arc_v2_irq_unit_suspend(dev);
} else if (state == PM_DEVICE_STATE_ACTIVE) { } else if (state == PM_DEVICE_STATE_ACTIVE) {
ret = arc_v2_irq_unit_resume(dev); ret = arc_v2_irq_unit_resume(dev);

View file

@ -318,7 +318,7 @@ static int ioapic_device_ctrl(const struct device *dev,
case PM_DEVICE_STATE_ACTIVE: case PM_DEVICE_STATE_ACTIVE:
ret = ioapic_resume_from_suspend(dev); ret = ioapic_resume_from_suspend(dev);
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
ret = ioapic_suspend(dev); ret = ioapic_suspend(dev);
break; break;

View file

@ -413,7 +413,7 @@ static int loapic_device_ctrl(const struct device *port,
{ {
int ret = 0; int ret = 0;
if (state == PM_DEVICE_STATE_SUSPEND) { if (state == PM_DEVICE_STATE_SUSPENDED) {
ret = loapic_suspend(port); ret = loapic_suspend(port);
} else if (state == PM_DEVICE_STATE_ACTIVE) { } else if (state == PM_DEVICE_STATE_ACTIVE) {
ret = loapic_resume(port); ret = loapic_resume(port);

View file

@ -199,7 +199,7 @@ int mdm_receiver_sleep(struct mdm_receiver_context *ctx)
{ {
uart_irq_rx_disable(ctx->uart_dev); uart_irq_rx_disable(ctx->uart_dev);
#ifdef CONFIG_PM_DEVICE #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 #endif
return 0; return 0;
} }

View file

@ -301,7 +301,7 @@ static int pwm_nrfx_set_power_state(enum pm_device_state state,
case PM_DEVICE_STATE_ACTIVE: case PM_DEVICE_STATE_ACTIVE:
err = pwm_nrfx_init(dev); err = pwm_nrfx_init(dev);
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
pwm_nrfx_uninit(dev); pwm_nrfx_uninit(dev);
break; break;

View file

@ -556,7 +556,7 @@ static int bmp388_set_power_state(const struct device *dev,
if (state == PM_DEVICE_STATE_ACTIVE) { if (state == PM_DEVICE_STATE_ACTIVE) {
reg_val = BMP388_PWR_CTRL_MODE_NORMAL; 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)) { (state == PM_DEVICE_STATE_OFF)) {
reg_val = BMP388_PWR_CTRL_MODE_SLEEP; reg_val = BMP388_PWR_CTRL_MODE_SLEEP;
} else { } else {

View file

@ -506,7 +506,7 @@ static int fdc2x1x_set_pm_state(const struct device *dev,
} }
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
if (curr_state == PM_DEVICE_STATE_OFF) { if (curr_state == PM_DEVICE_STATE_OFF) {
ret = fdc2x1x_set_shutdown(dev, false); ret = fdc2x1x_set_shutdown(dev, false);
if (ret) { if (ret) {

View file

@ -195,7 +195,7 @@ static int sgp40_set_power_state(const struct device *dev,
if (power_state == PM_DEVICE_STATE_ACTIVE) { if (power_state == PM_DEVICE_STATE_ACTIVE) {
/* activate the hotplate by sending a measure command */ /* activate the hotplate by sending a measure command */
cmd = SGP40_CMD_MEASURE_RAW; 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; cmd = SGP40_CMD_HEATER_OFF;
} else { } else {
LOG_DBG("Power state not implemented."); LOG_DBG("Power state not implemented.");

View file

@ -442,7 +442,7 @@ static inline int uart_npcx_set_power_state(const struct device *dev,
enum pm_device_state next_state) enum pm_device_state next_state)
{ {
/* If next device power state is LOW or SUSPEND power 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 * If uart device is busy with transmitting, the driver will
* stay in while loop and wait for the transaction is completed. * stay in while loop and wait for the transaction is completed.

View file

@ -291,7 +291,7 @@ static int spi_nrfx_pm_control(const struct device *dev,
data->ctx.config = NULL; data->ctx.config = NULL;
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
nrfx_spi_uninit(&config->spi); nrfx_spi_uninit(&config->spi);
break; break;

View file

@ -338,7 +338,7 @@ static int spim_nrfx_pm_control(const struct device *dev,
data->ctx.config = NULL; data->ctx.config = NULL;
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
nrfx_spim_uninit(&config->spim); nrfx_spim_uninit(&config->spim);
break; break;

View file

@ -41,7 +41,7 @@ enum pm_device_state {
* @note * @note
* Device context may be lost. * Device context may be lost.
*/ */
PM_DEVICE_STATE_SUSPEND, PM_DEVICE_STATE_SUSPENDED,
/** /**
* Device is suspended (forced). * Device is suspended (forced).
* *

View file

@ -66,7 +66,7 @@ void main(void)
k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC); k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC);
printk("Busy-wait %u s with UART off\n", BUSY_WAIT_S); 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); k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC);
rc = pm_device_state_set(cons, PM_DEVICE_STATE_ACTIVE); rc = pm_device_state_set(cons, PM_DEVICE_STATE_ACTIVE);
@ -74,7 +74,7 @@ void main(void)
k_sleep(K_SECONDS(SLEEP_S)); k_sleep(K_SECONDS(SLEEP_S));
printk("Sleep %u s with UART off\n", 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)); k_sleep(K_SECONDS(SLEEP_S));
rc = pm_device_state_set(cons, PM_DEVICE_STATE_ACTIVE); rc = pm_device_state_set(cons, PM_DEVICE_STATE_ACTIVE);

View file

@ -151,7 +151,7 @@ void main(void)
#if IS_ENABLED(CONFIG_PM_DEVICE) #if IS_ENABLED(CONFIG_PM_DEVICE)
printk("Putting the flash device into suspended state... "); 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) { if (err != 0) {
printk("FAILED\n"); printk("FAILED\n");
return; return;

View file

@ -79,7 +79,7 @@ void main(void)
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
enum pm_device_state p_state; 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); pm_device_state_set(dev, p_state);
printk("set low power state for 2s\n"); printk("set low power state for 2s\n");
k_sleep(K_MSEC(2000)); k_sleep(K_MSEC(2000));

View file

@ -43,7 +43,7 @@ static void pm_info(enum pm_device_state state, int status)
case PM_DEVICE_STATE_ACTIVE: case PM_DEVICE_STATE_ACTIVE:
printk("Enter ACTIVE_STATE "); printk("Enter ACTIVE_STATE ");
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
printk("Enter SUSPEND_STATE "); printk("Enter SUSPEND_STATE ");
break; break;
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
@ -95,7 +95,7 @@ void main(void)
enum pm_device_state p_state; enum pm_device_state p_state;
int ret; int ret;
p_state = PM_DEVICE_STATE_SUSPEND; p_state = PM_DEVICE_STATE_SUSPENDED;
ret = pm_device_state_set(dev, p_state); ret = pm_device_state_set(dev, p_state);
pm_info(p_state, ret); pm_info(p_state, ret);

View file

@ -5532,7 +5532,7 @@ static int cmd_net_suspend(const struct shell *shell, size_t argc,
dev = net_if_get_device(iface); 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) { if (ret != 0) {
PR_INFO("Iface could not be suspended: "); PR_INFO("Iface could not be suspended: ");

View file

@ -84,7 +84,7 @@ static int _pm_devices(uint32_t state)
int pm_suspend_devices(void) 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) int pm_low_power_devices(void)
@ -117,8 +117,8 @@ const char *pm_device_state_str(enum pm_device_state state)
return "active"; return "active";
case PM_DEVICE_STATE_LOW_POWER: case PM_DEVICE_STATE_LOW_POWER:
return "low power"; return "low power";
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
return "suspend"; return "suspended";
case PM_DEVICE_STATE_FORCE_SUSPEND: case PM_DEVICE_STATE_FORCE_SUSPEND:
return "force suspend"; return "force suspend";
case PM_DEVICE_STATE_OFF: case PM_DEVICE_STATE_OFF:
@ -138,8 +138,8 @@ int pm_device_state_set(const struct device *dev,
} }
switch (state) { switch (state) {
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
if ((dev->pm->state == PM_DEVICE_STATE_SUSPEND) || if ((dev->pm->state == PM_DEVICE_STATE_SUSPENDED) ||
(dev->pm->state == PM_DEVICE_STATE_SUSPENDING)) { (dev->pm->state == PM_DEVICE_STATE_SUSPENDING)) {
return -EALREADY; return -EALREADY;
} }

View file

@ -27,13 +27,13 @@ static void pm_device_runtime_state_set(struct pm_device *pm)
switch (dev->pm->state) { switch (dev->pm->state) {
case PM_DEVICE_STATE_ACTIVE: case PM_DEVICE_STATE_ACTIVE:
if ((dev->pm->usage == 0) && dev->pm->enable) { 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) { if (ret == 0) {
dev->pm->state = PM_DEVICE_STATE_SUSPEND; dev->pm->state = PM_DEVICE_STATE_SUSPENDED;
} }
} }
break; break;
case PM_DEVICE_STATE_SUSPEND: case PM_DEVICE_STATE_SUSPENDED:
if ((dev->pm->usage > 0) || !dev->pm->enable) { if ((dev->pm->usage > 0) || !dev->pm->enable) {
ret = pm_device_state_set(dev, PM_DEVICE_STATE_ACTIVE); ret = pm_device_state_set(dev, PM_DEVICE_STATE_ACTIVE);
if (ret == 0) { 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); SYS_PORT_TRACING_FUNC_ENTER(pm, device_request, dev, target_state);
__ASSERT((target_state == PM_DEVICE_STATE_ACTIVE) || __ASSERT((target_state == PM_DEVICE_STATE_ACTIVE) ||
(target_state == PM_DEVICE_STATE_SUSPEND), (target_state == PM_DEVICE_STATE_SUSPENDED),
"Invalid device PM state requested"); "Invalid device PM state requested");
if (k_is_pre_kernel()) { if (k_is_pre_kernel()) {
@ -101,7 +101,7 @@ static int pm_device_request(const struct device *dev,
if (dev->pm->usage == 1) { if (dev->pm->usage == 1) {
(void)pm_device_state_set(dev, PM_DEVICE_STATE_ACTIVE); (void)pm_device_state_set(dev, PM_DEVICE_STATE_ACTIVE);
} else if (dev->pm->usage == 0) { } 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; goto out;
} }
@ -164,12 +164,12 @@ int pm_device_get_async(const struct device *dev)
int pm_device_put(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) 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) void pm_device_enable(const struct device *dev)
@ -179,7 +179,7 @@ void pm_device_enable(const struct device *dev)
dev->pm->dev = dev; dev->pm->dev = dev;
if (dev->pm_control != NULL) { if (dev->pm_control != NULL) {
dev->pm->enable = true; 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); k_work_init_delayable(&dev->pm->work, pm_work_handler);
} }
goto out; goto out;
@ -199,7 +199,7 @@ void pm_device_enable(const struct device *dev)
*/ */
if (!dev->pm->dev) { if (!dev->pm->dev) {
dev->pm->dev = 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); k_work_init_delayable(&dev->pm->work, pm_work_handler);
} else { } else {
k_work_schedule(&dev->pm->work, K_NO_WAIT); k_work_schedule(&dev->pm->work, K_NO_WAIT);

View file

@ -148,13 +148,13 @@ static void test_uart_pm_in_idle(void)
state_verify(dev, PM_DEVICE_STATE_ACTIVE); state_verify(dev, PM_DEVICE_STATE_ACTIVE);
communication_verify(dev, true); communication_verify(dev, true);
state_set(dev, PM_DEVICE_STATE_SUSPEND, 0); state_set(dev, PM_DEVICE_STATE_SUSPENDED, 0);
communication_verify(dev, false); communication_verify(dev, false);
state_set(dev, PM_DEVICE_STATE_ACTIVE, 0); state_set(dev, PM_DEVICE_STATE_ACTIVE, 0);
communication_verify(dev, true); communication_verify(dev, true);
state_set(dev, PM_DEVICE_STATE_SUSPEND, 0); state_set(dev, PM_DEVICE_STATE_SUSPENDED, 0);
communication_verify(dev, false); communication_verify(dev, false);
state_set(dev, PM_DEVICE_STATE_ACTIVE, 0); state_set(dev, PM_DEVICE_STATE_ACTIVE, 0);
@ -171,7 +171,7 @@ static void test_uart_pm_poll_tx(void)
communication_verify(dev, true); communication_verify(dev, true);
uart_poll_out(dev, 'a'); 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); communication_verify(dev, false);
@ -181,7 +181,7 @@ static void test_uart_pm_poll_tx(void)
/* Now same thing but with callback */ /* Now same thing but with callback */
uart_poll_out(dev, 'a'); 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); 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); 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); static K_TIMER_DEFINE(pm_timer, timeout, NULL);

View file

@ -287,7 +287,7 @@ void test_dummy_device_pm(void)
{ {
const struct device *dev; const struct device *dev;
int busy, ret; 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); dev = device_get_binding(DUMMY_PORT_2);
zassert_false((dev == NULL), NULL); zassert_false((dev == NULL), NULL);

View file

@ -27,7 +27,7 @@ static int fake_dev_pm_control(const struct device *dev,
struct fake_dev_context *ctx = dev->data; struct fake_dev_context *ctx = dev->data;
int ret = 0; int ret = 0;
if (state == PM_DEVICE_STATE_SUSPEND) { if (state == PM_DEVICE_STATE_SUSPENDED) {
ret = net_if_suspend(ctx->iface); ret = net_if_suspend(ctx->iface);
if (ret == -EBUSY) { if (ret == -EBUSY) {
goto out; goto out;
@ -142,13 +142,13 @@ void test_pm(void)
*/ */
k_yield(); 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(ret == 0, "Could not set state");
zassert_true(net_if_is_suspended(iface), "net iface is not suspended"); zassert_true(net_if_is_suspended(iface), "net iface is not suspended");
/* Let's try to suspend it again, it should fail relevantly */ /* 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(ret == -EALREADY, "Could change state");
zassert_true(net_if_is_suspended(iface), "net iface is not suspended"); zassert_true(net_if_is_suspended(iface), "net iface is not suspended");

View file

@ -48,7 +48,7 @@ void threadA_func(void *arg1, void *arg2, void *arg3)
/* At this point threadB should have put the device and /* At this point threadB should have put the device and
* the current state should be SUSPENDED. * 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); 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"); zassert_true(ret == 0, "Fail to wait transaction");
/* Check the state */ /* 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); ret = api->close_sync(dev);
zassert_true(ret == 0, "Fail to suspend device"); 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); ret = api->close_sync(dev);
zassert_true(ret == 0, "Fail to suspend device"); 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); ret = api->close_sync(dev);
zassert_true(ret == 0, "Fail to suspend device"); 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*/ /* 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"); zassert_true(ret == 0, "Fail to wait transaction");
/* Check the state */ /* 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*/ /* Finally off by one to keep the device active*/
for (i = 0; i < MAX_TIMES; i++) { for (i = 0; i < MAX_TIMES; i++) {

View file

@ -181,7 +181,7 @@ void test_power_state_notification(void)
api->close(dev); api->close(dev);
pm_device_state_get(dev, &device_power_state); 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 */ /* reopen device as it will be closed in teardown */
api->open(dev); api->open(dev);
} }