serial: mvebu: Apply old baudrate to termios
PATCH 1/1 serial: mvebu: Apply old baudrate to termios
A fallback baud rate was derived from old termios but got never applied to (new/current) termios. Old termios is dropped once ->set_termios() call chain completes, only termios persists the values. Encode also the old baud rate into termios.
--- drivers/tty/serial/mvebu-uart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/mvebu-uart.c +2 -3
@@ -592,10 +592,9 @@ static void mvebu_uart_set_termios(struct uart_port *port,if (old) baud =uart_get_baud_rate (port, old,NULL , min_baud, max_baud); - }else { -tty_termios_encode_baud_rate (termios, baud, baud); -uart_update_timeout (port, termios->c_cflag, baud); } +tty_termios_encode_baud_rate (termios, baud, baud); +uart_update_timeout (port, termios->c_cflag, baud);/* Only the following flag changes are supported */ if (old) {
Signature · 1 line
tg: (f287f971e256..) fix/mvebu-apply-old-baud (depends on: tty-next)
Pali Rohár
maintainerQuoted 7 lines · On Tuesday 28 June 2022 12:41:55 Ilpo Järvinen wrote:
A fallback baud rate was derived from old termios but got never applied to (new/current) termios. Old termios is dropped once ->set_termios() call chain completes, only termios persists the values. Encode also the old baud rate into termios.
Fixes 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate")Signed-off-by Ilpo Järvinen <[email protected]>
Hello! Could you explain a bit more what is this patch fixing? I have not caught it yet. Do you have a test scenario which can demonstrate this issue? Because I have tested this driver more deeply (on Mox and Espressobin) and I have not seen any remaining issue with reporting incorrect baudrate.
Quoted 24 lines
--- drivers/tty/serial/mvebu-uart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/tty/serial/mvebu-uart.c +2
-3@@ -592,10 +592,9 @@ static void mvebu_uart_set_termios(struct uart_port *port,if (old) baud =uart_get_baud_rate (port, old,NULL , min_baud, max_baud); - }else { -tty_termios_encode_baud_rate (termios, baud, baud); -uart_update_timeout (port, termios->c_cflag, baud); } +tty_termios_encode_baud_rate (termios, baud, baud); +uart_update_timeout (port, termios->c_cflag, baud);/* Only the following flag changes are supported */ if (old) {Signature · 2 lines
-- tg: (f287f971e256..) fix/mvebu-apply-old-baud (depends on: tty-next)
Pali Rohár
maintainerQuoted 6 lines · On Tuesday 28 June 2022 11:51:36 Pali Rohár wrote:
Quoted 5 lines · On Tuesday 28 June 2022 12:41:55 Ilpo Järvinen wrote:
A fallback baud rate was derived from old termios but got never applied to (new/current) termios. Old termios is dropped once ->set_termios() call chain completes, only termios persists the values. Encode also the old baud rate into termios.
Quoted 8 lines
Quoted 2 lines
Fixes 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate")Signed-off-by Ilpo Järvinen <[email protected]>Hello! Could you explain a bit more what is this patch fixing? I have not caught it yet. Do you have a test scenario which can demonstrate this issue? Because I have tested this driver more deeply (on Mox and Espressobin) and I have not seen any remaining issue with reporting incorrect baudrate.
Ou, now I see where is the issue. Patch which I tested and which fixes reporting baudrate is not in kernel tree yet and it looks like I totally forgot to sent it to ML. I will send it. Sorry for confusion.
Quoted 24 lines
Quoted 24 lines
--- drivers/tty/serial/mvebu-uart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/tty/serial/mvebu-uart.c +2
-3@@ -592,10 +592,9 @@ static void mvebu_uart_set_termios(struct uart_port *port,if (old) baud =uart_get_baud_rate (port, old,NULL , min_baud, max_baud); - }else { -tty_termios_encode_baud_rate (termios, baud, baud); -uart_update_timeout (port, termios->c_cflag, baud); } +tty_termios_encode_baud_rate (termios, baud, baud); +uart_update_timeout (port, termios->c_cflag, baud);/* Only the following flag changes are supported */ if (old) {Signature · 2 lines
-- tg: (f287f971e256..) fix/mvebu-apply-old-baud (depends on: tty-next)
Quoted 17 lines · Pali Rohár
Quoted 7 lines · On Tuesday 28 June 2022 11:51:36 Pali Rohár wrote:
Quoted 5 lines · On Tuesday 28 June 2022 12:41:55 Ilpo Järvinen wrote:
A fallback baud rate was derived from old termios but got never applied to (new/current) termios. Old termios is dropped once ->set_termios() call chain completes, only termios persists the values. Encode also the old baud rate into termios.
Quoted 8 lines
Quoted 2 lines
Fixes 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate")Signed-off-by Ilpo Järvinen <[email protected]>Hello! Could you explain a bit more what is this patch fixing? I have not caught it yet. Do you have a test scenario which can demonstrate this issue? Because I have tested this driver more deeply (on Mox and Espressobin) and I have not seen any remaining issue with reporting incorrect baudrate.
Quoted 3 lines
Ou, now I see where is the issue. Patch which I tested and which fixes reporting baudrate is not in kernel tree yet and it looks like I totally forgot to sent it to ML. I will send it. Sorry for confusion.
Shouldn't the Ilpo's applied anyway to fix the current code base?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Pali Rohár
On Tuesday 28 June 2022 11:51:36 Pali Rohár wrote:
...
Quoted 5 lines
Quoted 3 lines
Ou, now I see where is the issue. Patch which I tested and which fixes reporting baudrate is not in kernel tree yet and it looks like I totally forgot to sent it to ML. I will send it. Sorry for confusion.
Shouldn't the Ilpo's applied anyway to fix the current code base?
Ah, now I understand that your patch is a fix. Sorry for the noise.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Pali Rohár
maintainerQuoted 7 lines · On Tuesday 28 June 2022 13:40:28 Andy Shevchenko wrote:
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Pali Rohár
On Tuesday 28 June 2022 11:51:36 Pali Rohár wrote:
...
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Ou, now I see where is the issue. Patch which I tested and which fixes reporting baudrate is not in kernel tree yet and it looks like I totally forgot to sent it to ML. I will send it. Sorry for confusion.
Shouldn't the Ilpo's applied anyway to fix the current code base?
Ah, now I understand that your patch is a fix. Sorry for the noise.
Yes, my patch fixes the issue which Ilpo described and handles also errors:
https://lore.kernel.org/linux-serial/[email protected]/