Skip to content

Commit d41dadc

Browse files
gmarullnashif
authored andcommitted
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 <[email protected]>
1 parent 56a35e5 commit d41dadc

File tree

32 files changed

+61
-61
lines changed

32 files changed

+61
-61
lines changed

doc/reference/power_management/index.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -248,20 +248,20 @@ The four device power states:
248248

249249
Device context is preserved by the HW and need not be restored by the driver.
250250

251-
:code:`PM_DEVICE_STATE_SUSPEND`
251+
:code:`PM_DEVICE_STATE_SUSPENDED`
252252

253253
Most device context is lost by the hardware. Device drivers must save and
254254
restore or reinitialize any context lost by the hardware.
255255

256256
:code:`PM_DEVICE_STATE_SUSPENDING`
257257

258258
Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_ACTIVE` to
259-
:c:macro:`PM_DEVICE_STATE_SUSPEND`.
259+
:c:macro:`PM_DEVICE_STATE_SUSPENDED`.
260260

261261
:code:`PM_DEVICE_STATE_RESUMING`
262262

263-
Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_SUSPEND` to
264-
:c:macro:`PM_DEVICE_STATE_ACTIVE`.
263+
Device is currently transitioning from :c:macro:`PM_DEVICE_STATE_SUSPENDED`
264+
to :c:macro:`PM_DEVICE_STATE_ACTIVE`.
265265

266266
:code:`PM_DEVICE_STATE_OFF`
267267

drivers/ethernet/eth_mcux.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static int eth_mcux_device_pm_control(const struct device *dev,
197197
goto out;
198198
}
199199

200-
if (state == PM_DEVICE_STATE_SUSPEND) {
200+
if (state == PM_DEVICE_STATE_SUSPENDED) {
201201
LOG_DBG("Suspending");
202202

203203
ret = net_if_suspend(eth_ctx->iface);

drivers/flash/spi_flash_at45.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ static int spi_flash_at45_pm_control(const struct device *dev,
636636
release(dev);
637637
break;
638638

639-
case PM_DEVICE_STATE_SUSPEND:
639+
case PM_DEVICE_STATE_SUSPENDED:
640640
case PM_DEVICE_STATE_OFF:
641641
acquire(dev);
642642
power_down_op(dev,

drivers/flash/spi_nor.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ LOG_MODULE_REGISTER(spi_nor, CONFIG_FLASH_LOG_LEVEL);
3838
*
3939
* When mapped to the Zephyr Device Power Management states:
4040
* * PM_DEVICE_STATE_ACTIVE covers both active and standby modes;
41-
* * PM_DEVICE_STATE_SUSPEND, and PM_DEVICE_STATE_OFF all correspond
42-
* to deep-power-down mode.
41+
* * PM_DEVICE_STATE_SUSPENDED, and PM_DEVICE_STATE_OFF all correspond to
42+
* deep-power-down mode.
4343
*/
4444

4545
#define SPI_NOR_MAX_ADDR_WIDTH 4

drivers/gpio/gpio_dw.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ static int gpio_dw_device_ctrl(const struct device *port,
446446
{
447447
int ret = 0;
448448

449-
if (state == PM_DEVICE_STATE_SUSPEND) {
449+
if (state == PM_DEVICE_STATE_SUSPENDED) {
450450
ret = gpio_dw_suspend_port(port);
451451
} else if (state == PM_DEVICE_STATE_ACTIVE) {
452452
ret = gpio_dw_resume_from_suspend_port(port);

drivers/gpio/gpio_stm32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ static int gpio_stm32_set_power_state(const struct device *dev,
581581

582582
if (state == PM_DEVICE_STATE_ACTIVE) {
583583
ret = gpio_stm32_clock_request(dev, true);
584-
} else if (state == PM_DEVICE_STATE_SUSPEND) {
584+
} else if (state == PM_DEVICE_STATE_SUSPENDED) {
585585
ret = gpio_stm32_clock_request(dev, false);
586586
}
587587

drivers/i2c/i2c_nrfx_twi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static int twi_nrfx_pm_control(const struct device *dev,
230230
}
231231
break;
232232

233-
case PM_DEVICE_STATE_SUSPEND:
233+
case PM_DEVICE_STATE_SUSPENDED:
234234
case PM_DEVICE_STATE_OFF:
235235
nrfx_twi_uninit(&get_dev_config(dev)->twi);
236236
break;

drivers/i2c/i2c_nrfx_twim.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static int twim_nrfx_pm_control(const struct device *dev,
268268
}
269269
break;
270270

271-
case PM_DEVICE_STATE_SUSPEND:
271+
case PM_DEVICE_STATE_SUSPENDED:
272272
case PM_DEVICE_STATE_OFF:
273273
nrfx_twim_uninit(&get_dev_config(dev)->twim);
274274
break;

drivers/interrupt_controller/intc_arcv2_irq_unit.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static int arc_v2_irq_unit_device_ctrl(const struct device *dev,
180180
int ret = 0;
181181
unsigned int key = arch_irq_lock();
182182

183-
if (state == PM_DEVICE_STATE_SUSPEND) {
183+
if (state == PM_DEVICE_STATE_SUSPENDED) {
184184
ret = arc_v2_irq_unit_suspend(dev);
185185
} else if (state == PM_DEVICE_STATE_ACTIVE) {
186186
ret = arc_v2_irq_unit_resume(dev);

drivers/interrupt_controller/intc_ioapic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static int ioapic_device_ctrl(const struct device *dev,
318318
case PM_DEVICE_STATE_ACTIVE:
319319
ret = ioapic_resume_from_suspend(dev);
320320
break;
321-
case PM_DEVICE_STATE_SUSPEND:
321+
case PM_DEVICE_STATE_SUSPENDED:
322322
case PM_DEVICE_STATE_OFF:
323323
ret = ioapic_suspend(dev);
324324
break;

drivers/interrupt_controller/intc_loapic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static int loapic_device_ctrl(const struct device *port,
413413
{
414414
int ret = 0;
415415

416-
if (state == PM_DEVICE_STATE_SUSPEND) {
416+
if (state == PM_DEVICE_STATE_SUSPENDED) {
417417
ret = loapic_suspend(port);
418418
} else if (state == PM_DEVICE_STATE_ACTIVE) {
419419
ret = loapic_resume(port);

drivers/modem/modem_receiver.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ int mdm_receiver_sleep(struct mdm_receiver_context *ctx)
199199
{
200200
uart_irq_rx_disable(ctx->uart_dev);
201201
#ifdef CONFIG_PM_DEVICE
202-
pm_device_state_set(ctx->uart_dev, PM_DEVICE_STATE_SUSPEND);
202+
pm_device_state_set(ctx->uart_dev, PM_DEVICE_STATE_SUSPENDED);
203203
#endif
204204
return 0;
205205
}

drivers/pwm/pwm_nrfx.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static int pwm_nrfx_set_power_state(enum pm_device_state state,
301301
case PM_DEVICE_STATE_ACTIVE:
302302
err = pwm_nrfx_init(dev);
303303
break;
304-
case PM_DEVICE_STATE_SUSPEND:
304+
case PM_DEVICE_STATE_SUSPENDED:
305305
case PM_DEVICE_STATE_OFF:
306306
pwm_nrfx_uninit(dev);
307307
break;

drivers/sensor/bmp388/bmp388.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ static int bmp388_set_power_state(const struct device *dev,
556556

557557
if (state == PM_DEVICE_STATE_ACTIVE) {
558558
reg_val = BMP388_PWR_CTRL_MODE_NORMAL;
559-
} else if ((state == PM_DEVICE_STATE_SUSPEND) ||
559+
} else if ((state == PM_DEVICE_STATE_SUSPENDED) ||
560560
(state == PM_DEVICE_STATE_OFF)) {
561561
reg_val = BMP388_PWR_CTRL_MODE_SLEEP;
562562
} else {

drivers/sensor/fdc2x1x/fdc2x1x.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ static int fdc2x1x_set_pm_state(const struct device *dev,
506506
}
507507

508508
break;
509-
case PM_DEVICE_STATE_SUSPEND:
509+
case PM_DEVICE_STATE_SUSPENDED:
510510
if (curr_state == PM_DEVICE_STATE_OFF) {
511511
ret = fdc2x1x_set_shutdown(dev, false);
512512
if (ret) {

drivers/sensor/sgp40/sgp40.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static int sgp40_set_power_state(const struct device *dev,
195195
if (power_state == PM_DEVICE_STATE_ACTIVE) {
196196
/* activate the hotplate by sending a measure command */
197197
cmd = SGP40_CMD_MEASURE_RAW;
198-
} else if (power_state == PM_DEVICE_STATE_SUSPEND) {
198+
} else if (power_state == PM_DEVICE_STATE_SUSPENDED) {
199199
cmd = SGP40_CMD_HEATER_OFF;
200200
} else {
201201
LOG_DBG("Power state not implemented.");

drivers/serial/uart_npcx.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ static inline int uart_npcx_set_power_state(const struct device *dev,
442442
enum pm_device_state next_state)
443443
{
444444
/* If next device power state is LOW or SUSPEND power state */
445-
if (next_state == PM_DEVICE_STATE_SUSPEND) {
445+
if (next_state == PM_DEVICE_STATE_SUSPENDED) {
446446
/*
447447
* If uart device is busy with transmitting, the driver will
448448
* stay in while loop and wait for the transaction is completed.

drivers/spi/spi_nrfx_spi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static int spi_nrfx_pm_control(const struct device *dev,
291291
data->ctx.config = NULL;
292292
break;
293293

294-
case PM_DEVICE_STATE_SUSPEND:
294+
case PM_DEVICE_STATE_SUSPENDED:
295295
case PM_DEVICE_STATE_OFF:
296296
nrfx_spi_uninit(&config->spi);
297297
break;

drivers/spi/spi_nrfx_spim.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static int spim_nrfx_pm_control(const struct device *dev,
338338
data->ctx.config = NULL;
339339
break;
340340

341-
case PM_DEVICE_STATE_SUSPEND:
341+
case PM_DEVICE_STATE_SUSPENDED:
342342
case PM_DEVICE_STATE_OFF:
343343
nrfx_spim_uninit(&config->spim);
344344
break;

include/pm/device.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ enum pm_device_state {
4141
* @note
4242
* Device context may be lost.
4343
*/
44-
PM_DEVICE_STATE_SUSPEND,
44+
PM_DEVICE_STATE_SUSPENDED,
4545
/**
4646
* Device is suspended (forced).
4747
*

samples/boards/nrf/system_off/src/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ void main(void)
6666
k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC);
6767

6868
printk("Busy-wait %u s with UART off\n", BUSY_WAIT_S);
69-
rc = pm_device_state_set(cons, PM_DEVICE_STATE_SUSPEND);
69+
rc = pm_device_state_set(cons, PM_DEVICE_STATE_SUSPENDED);
7070
k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC);
7171
rc = pm_device_state_set(cons, PM_DEVICE_STATE_ACTIVE);
7272

7373
printk("Sleep %u s\n", SLEEP_S);
7474
k_sleep(K_SECONDS(SLEEP_S));
7575

7676
printk("Sleep %u s with UART off\n", SLEEP_S);
77-
rc = pm_device_state_set(cons, PM_DEVICE_STATE_SUSPEND);
77+
rc = pm_device_state_set(cons, PM_DEVICE_STATE_SUSPENDED);
7878
k_sleep(K_SECONDS(SLEEP_S));
7979
rc = pm_device_state_set(cons, PM_DEVICE_STATE_ACTIVE);
8080

samples/drivers/spi_flash_at45/src/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void main(void)
151151

152152
#if IS_ENABLED(CONFIG_PM_DEVICE)
153153
printk("Putting the flash device into suspended state... ");
154-
err = pm_device_state_set(flash_dev, PM_DEVICE_STATE_SUSPEND);
154+
err = pm_device_state_set(flash_dev, PM_DEVICE_STATE_SUSPENDED);
155155
if (err != 0) {
156156
printk("FAILED\n");
157157
return;

samples/sensor/apds9960/src/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void main(void)
7979
#ifdef CONFIG_PM_DEVICE
8080
enum pm_device_state p_state;
8181

82-
p_state = PM_DEVICE_STATE_SUSPEND;
82+
p_state = PM_DEVICE_STATE_SUSPENDED;
8383
pm_device_state_set(dev, p_state);
8484
printk("set low power state for 2s\n");
8585
k_sleep(K_MSEC(2000));

samples/sensor/fdc2x1x/src/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static void pm_info(enum pm_device_state state, int status)
4343
case PM_DEVICE_STATE_ACTIVE:
4444
printk("Enter ACTIVE_STATE ");
4545
break;
46-
case PM_DEVICE_STATE_SUSPEND:
46+
case PM_DEVICE_STATE_SUSPENDED:
4747
printk("Enter SUSPEND_STATE ");
4848
break;
4949
case PM_DEVICE_STATE_OFF:
@@ -95,7 +95,7 @@ void main(void)
9595
enum pm_device_state p_state;
9696
int ret;
9797

98-
p_state = PM_DEVICE_STATE_SUSPEND;
98+
p_state = PM_DEVICE_STATE_SUSPENDED;
9999
ret = pm_device_state_set(dev, p_state);
100100
pm_info(p_state, ret);
101101

subsys/net/ip/net_shell.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5532,7 +5532,7 @@ static int cmd_net_suspend(const struct shell *shell, size_t argc,
55325532

55335533
dev = net_if_get_device(iface);
55345534

5535-
ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPEND);
5535+
ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPENDED);
55365536
if (ret != 0) {
55375537
PR_INFO("Iface could not be suspended: ");
55385538

subsys/pm/device.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static int _pm_devices(uint32_t state)
8484

8585
int pm_suspend_devices(void)
8686
{
87-
return _pm_devices(PM_DEVICE_STATE_SUSPEND);
87+
return _pm_devices(PM_DEVICE_STATE_SUSPENDED);
8888
}
8989

9090
int pm_low_power_devices(void)
@@ -117,8 +117,8 @@ const char *pm_device_state_str(enum pm_device_state state)
117117
return "active";
118118
case PM_DEVICE_STATE_LOW_POWER:
119119
return "low power";
120-
case PM_DEVICE_STATE_SUSPEND:
121-
return "suspend";
120+
case PM_DEVICE_STATE_SUSPENDED:
121+
return "suspended";
122122
case PM_DEVICE_STATE_FORCE_SUSPEND:
123123
return "force suspend";
124124
case PM_DEVICE_STATE_OFF:
@@ -138,8 +138,8 @@ int pm_device_state_set(const struct device *dev,
138138
}
139139

140140
switch (state) {
141-
case PM_DEVICE_STATE_SUSPEND:
142-
if ((dev->pm->state == PM_DEVICE_STATE_SUSPEND) ||
141+
case PM_DEVICE_STATE_SUSPENDED:
142+
if ((dev->pm->state == PM_DEVICE_STATE_SUSPENDED) ||
143143
(dev->pm->state == PM_DEVICE_STATE_SUSPENDING)) {
144144
return -EALREADY;
145145
}

subsys/pm/device_runtime.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ static void pm_device_runtime_state_set(struct pm_device *pm)
2727
switch (dev->pm->state) {
2828
case PM_DEVICE_STATE_ACTIVE:
2929
if ((dev->pm->usage == 0) && dev->pm->enable) {
30-
ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPEND);
30+
ret = pm_device_state_set(dev, PM_DEVICE_STATE_SUSPENDED);
3131
if (ret == 0) {
32-
dev->pm->state = PM_DEVICE_STATE_SUSPEND;
32+
dev->pm->state = PM_DEVICE_STATE_SUSPENDED;
3333
}
3434
}
3535
break;
36-
case PM_DEVICE_STATE_SUSPEND:
36+
case PM_DEVICE_STATE_SUSPENDED:
3737
if ((dev->pm->usage > 0) || !dev->pm->enable) {
3838
ret = pm_device_state_set(dev, PM_DEVICE_STATE_ACTIVE);
3939
if (ret == 0) {
@@ -77,7 +77,7 @@ static int pm_device_request(const struct device *dev,
7777
SYS_PORT_TRACING_FUNC_ENTER(pm, device_request, dev, target_state);
7878

7979
__ASSERT((target_state == PM_DEVICE_STATE_ACTIVE) ||
80-
(target_state == PM_DEVICE_STATE_SUSPEND),
80+
(target_state == PM_DEVICE_STATE_SUSPENDED),
8181
"Invalid device PM state requested");
8282

8383
if (k_is_pre_kernel()) {
@@ -101,7 +101,7 @@ static int pm_device_request(const struct device *dev,
101101
if (dev->pm->usage == 1) {
102102
(void)pm_device_state_set(dev, PM_DEVICE_STATE_ACTIVE);
103103
} else if (dev->pm->usage == 0) {
104-
(void)pm_device_state_set(dev, PM_DEVICE_STATE_SUSPEND);
104+
(void)pm_device_state_set(dev, PM_DEVICE_STATE_SUSPENDED);
105105
}
106106
goto out;
107107
}
@@ -164,12 +164,12 @@ int pm_device_get_async(const struct device *dev)
164164

165165
int pm_device_put(const struct device *dev)
166166
{
167-
return pm_device_request(dev, PM_DEVICE_STATE_SUSPEND, 0);
167+
return pm_device_request(dev, PM_DEVICE_STATE_SUSPENDED, 0);
168168
}
169169

170170
int pm_device_put_async(const struct device *dev)
171171
{
172-
return pm_device_request(dev, PM_DEVICE_STATE_SUSPEND, PM_DEVICE_ASYNC);
172+
return pm_device_request(dev, PM_DEVICE_STATE_SUSPENDED, PM_DEVICE_ASYNC);
173173
}
174174

175175
void pm_device_enable(const struct device *dev)
@@ -179,7 +179,7 @@ void pm_device_enable(const struct device *dev)
179179
dev->pm->dev = dev;
180180
if (dev->pm_control != NULL) {
181181
dev->pm->enable = true;
182-
dev->pm->state = PM_DEVICE_STATE_SUSPEND;
182+
dev->pm->state = PM_DEVICE_STATE_SUSPENDED;
183183
k_work_init_delayable(&dev->pm->work, pm_work_handler);
184184
}
185185
goto out;
@@ -199,7 +199,7 @@ void pm_device_enable(const struct device *dev)
199199
*/
200200
if (!dev->pm->dev) {
201201
dev->pm->dev = dev;
202-
dev->pm->state = PM_DEVICE_STATE_SUSPEND;
202+
dev->pm->state = PM_DEVICE_STATE_SUSPENDED;
203203
k_work_init_delayable(&dev->pm->work, pm_work_handler);
204204
} else {
205205
k_work_schedule(&dev->pm->work, K_NO_WAIT);

0 commit comments

Comments
 (0)