pm: use actions for device PM control
Instead of passing target states, use actions for device PM control. Actions represent better the meaning of the callback argument. Furthermore, they are more future proof as they can be suitable for other PM actions that have no direct mapping to a state. If we compare with Linux, we could have a multi-stage suspend/resume. Such scenario would not have a good mapping when using target states. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
8be0472ba8
commit
7ccc1a41bc
40 changed files with 176 additions and 145 deletions
|
@ -1423,13 +1423,13 @@ static int uart_stm32_init(const struct device *dev)
|
|||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static int uart_stm32_pm_control(const struct device *dev,
|
||||
enum pm_device_state state)
|
||||
enum pm_device_action action)
|
||||
{
|
||||
USART_TypeDef *UartInstance = UART_STRUCT(dev);
|
||||
|
||||
/* setting a low power mode */
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_SUSPENDED:
|
||||
switch (action) {
|
||||
case PM_DEVICE_ACTION_SUSPEND:
|
||||
#ifdef USART_ISR_BUSY
|
||||
/* Make sure that no USART transfer is on-going */
|
||||
while (LL_USART_IsActiveFlag_BUSY(UartInstance) == 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue