serial: uart_nrfx_uarte: update state when enabled

Update the drivers power state knowledge immediately after calling
`nrf_uarte_enable`. This ensures that the state is correct regardless of
which path the function exits by.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2021-02-04 21:21:22 +10:00 committed by Anas Nashif
commit 5979b0085f

View file

@ -1538,6 +1538,9 @@ static void uarte_nrfx_set_power_state(const struct device *dev,
if (new_state == DEVICE_PM_ACTIVE_STATE) {
uarte_nrfx_pins_enable(dev, true);
nrf_uarte_enable(uarte);
data->pm_state = new_state;
#ifdef CONFIG_UART_ASYNC_API
if (hw_rx_counting_enabled(get_dev_data(dev))) {
nrfx_timer_enable(&get_dev_config(dev)->timer);
@ -1559,8 +1562,6 @@ static void uarte_nrfx_set_power_state(const struct device *dev,
}
#endif
}
data->pm_state = new_state;
} else {
__ASSERT_NO_MSG(new_state == DEVICE_PM_LOW_POWER_STATE ||
new_state == DEVICE_PM_SUSPEND_STATE ||