serial: core: Fix runtime PM handling for pending tx
PATCH 1/1 serial: core: Fix runtime PM handling for pending tx
Richard reported that a serial port may end up sometimes with tx data pending in the buffer for long periods of time.
Turns out we bail out early on any errors from pm_runtime_get(), including -EINPROGRESS. To fix the issue, we need to ignore -EINPROGRESS as we only care about the runtime PM usage count at this point. We check for an active runtime PM state later on for tx.
--- drivers/tty/serial/serial_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/serial_core.c +1 -1
@@ -146,7 +146,7 @@ static void __uart_start(struct uart_state *state)/* Increment the runtime PM usage count for the active check below */ err =pm_runtime_get (&port_dev->dev); -if (err <0 ) { +if (err <0 && err != -EINPROGRESS ) {pm_runtime_put_noidle (&port_dev->dev);return ; }
Signature · 1 line
2.42.0
Quoted 10 lines · Tony Lindgren
Richard reported that a serial port may end up sometimes with tx data pending in the buffer for long periods of time.
Turns out we bail out early on any errors from
pm_runtime_get(), including-EINPROGRESS. To fix the issue, we need to ignore-EINPROGRESSas we only care about the runtime PM usage count at this point. We check for an active runtime PM state later on for tx.Fixes 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")Reported-by Richard Purdie <[email protected]>
Thanks, I can confirm that since we added this into our builds/tests we've not seen the serial data go missing.
Cheers,
Richard
Quoted 21 lines
Cc Bruce Ashfield <[email protected]>Cc Mikko Rapeli <[email protected]>Cc Paul Gortmaker <[email protected]>Cc Randy MacLeod <[email protected]>Signed-off-by Tony Lindgren <[email protected]>--- drivers/tty/serial/serial_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/serial/serial_core.c +1
-1@@ -146,7 +146,7 @@ static void __uart_start(struct uart_state *state)/* Increment the runtime PM usage count for the active check below */ err =pm_runtime_get (&port_dev->dev); -if (err <0 ) { +if (err <0 && err != -EINPROGRESS ) {pm_runtime_put_noidle (&port_dev->dev);return ; }