-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the bug
When trying to TX on a suspended UART device, instead of getting an error, the thread hangs, waiting for the transmission to finish or a timeout to end (which in case of for example the async uart modem iface, is forever).
For what it's worth, the nRF driver handles this, by checking the state: (https://github.com/zephyrproject-rtos/zephyr/blob/16f4d6c23e401eaa0664c3f3b606f988b6b9dada/drivers/serial/uart_nrfx_uarte.c#L843C1-L852C1)
#if defined(CONFIG_PM_DEVICE) && !defined(CONFIG_PM_DEVICE_RUNTIME)
enum pm_device_state state;
(void)pm_device_state_get(dev, &state);
if (state != PM_DEVICE_STATE_ACTIVE) {
return;
}
#endif
But the STM32 driver isn't aware of the device PM state at all.
I wouldn't mind making a PR for fixing this if handling this is something we want to do (as opposed to just calling it "undefined behavior" or incorrect usage of the API), but not sure what a correct error code to return would be here (-EIO?).
Regression
- This is a regression.
Steps to reproduce
- Enable device runtime PM
- Suspend a UART device with async API enabled
- Try to send some data using the device, with a long or infinite timeout
Relevant log output
Impact
Annoyance – Minor irritation; no significant impact on usability or functionality.
Environment
No response
Additional Context
No response