All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: mvebu: Apply old baudrate to termios
@ 2022-06-28  9:41 Ilpo Järvinen
  2022-06-28  9:51 ` Pali Rohár
  0 siblings, 1 reply; 6+ messages in thread
From: Ilpo Järvinen @ 2022-06-28  9:41 UTC (permalink / raw)
  To: Pali Rohár, Greg Kroah-Hartman, Jiri Slaby, Allen Yan,
	Miquel Raynal, Gregory CLEMENT, linux-serial, linux-kernel
  Cc: Ilpo Järvinen

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 <ilpo.jarvinen@linux.intel.com>

---
 drivers/tty/serial/mvebu-uart.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
index 0429c2a54290..12a79018697f 100644
--- a/drivers/tty/serial/mvebu-uart.c
+++ b/drivers/tty/serial/mvebu-uart.c
@@ -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) {

-- 
tg: (f287f971e256..) fix/mvebu-apply-old-baud (depends on: tty-next)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] serial: mvebu: Apply old baudrate to termios
  2022-06-28  9:41 [PATCH] serial: mvebu: Apply old baudrate to termios Ilpo Järvinen
@ 2022-06-28  9:51 ` Pali Rohár
  2022-06-28  9:59   ` Pali Rohár
  0 siblings, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2022-06-28  9:51 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Greg Kroah-Hartman, Jiri Slaby, Allen Yan, Miquel Raynal,
	Gregory CLEMENT, linux-serial, linux-kernel

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 <ilpo.jarvinen@linux.intel.com>

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.

> ---
>  drivers/tty/serial/mvebu-uart.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
> index 0429c2a54290..12a79018697f 100644
> --- a/drivers/tty/serial/mvebu-uart.c
> +++ b/drivers/tty/serial/mvebu-uart.c
> @@ -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) {
> 
> -- 
> tg: (f287f971e256..) fix/mvebu-apply-old-baud (depends on: tty-next)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] serial: mvebu: Apply old baudrate to termios
  2022-06-28  9:51 ` Pali Rohár
@ 2022-06-28  9:59   ` Pali Rohár
  2022-06-28 11:39     ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2022-06-28  9:59 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Greg Kroah-Hartman, Jiri Slaby, Allen Yan, Miquel Raynal,
	Gregory CLEMENT, linux-serial, linux-kernel

On Tuesday 28 June 2022 11:51:36 Pali Rohár wrote:
> 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 <ilpo.jarvinen@linux.intel.com>
> 
> 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.

> > ---
> >  drivers/tty/serial/mvebu-uart.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
> > index 0429c2a54290..12a79018697f 100644
> > --- a/drivers/tty/serial/mvebu-uart.c
> > +++ b/drivers/tty/serial/mvebu-uart.c
> > @@ -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) {
> > 
> > -- 
> > tg: (f287f971e256..) fix/mvebu-apply-old-baud (depends on: tty-next)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] serial: mvebu: Apply old baudrate to termios
  2022-06-28  9:59   ` Pali Rohár
@ 2022-06-28 11:39     ` Andy Shevchenko
  2022-06-28 11:40       ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2022-06-28 11:39 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Ilpo Järvinen, Greg Kroah-Hartman, Jiri Slaby, Allen Yan,
	Miquel Raynal, Gregory CLEMENT, open list:SERIAL DRIVERS,
	Linux Kernel Mailing List

On Tue, Jun 28, 2022 at 12:01 PM Pali Rohár <pali@kernel.org> wrote:
> On Tuesday 28 June 2022 11:51:36 Pali Rohár wrote:
> > 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 <ilpo.jarvinen@linux.intel.com>
> >
> > 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.

Shouldn't the Ilpo's applied anyway to fix the current code base?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] serial: mvebu: Apply old baudrate to termios
  2022-06-28 11:39     ` Andy Shevchenko
@ 2022-06-28 11:40       ` Andy Shevchenko
  2022-06-30  8:28         ` Pali Rohár
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2022-06-28 11:40 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Ilpo Järvinen, Greg Kroah-Hartman, Jiri Slaby, Allen Yan,
	Miquel Raynal, Gregory CLEMENT, open list:SERIAL DRIVERS,
	Linux Kernel Mailing List

On Tue, Jun 28, 2022 at 1:39 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Tue, Jun 28, 2022 at 12:01 PM Pali Rohár <pali@kernel.org> wrote:
> > On Tuesday 28 June 2022 11:51:36 Pali Rohár wrote:

...

> > 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.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] serial: mvebu: Apply old baudrate to termios
  2022-06-28 11:40       ` Andy Shevchenko
@ 2022-06-30  8:28         ` Pali Rohár
  0 siblings, 0 replies; 6+ messages in thread
From: Pali Rohár @ 2022-06-30  8:28 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Ilpo Järvinen, Greg Kroah-Hartman, Jiri Slaby, Allen Yan,
	Miquel Raynal, Gregory CLEMENT, open list:SERIAL DRIVERS,
	Linux Kernel Mailing List

On Tuesday 28 June 2022 13:40:28 Andy Shevchenko wrote:
> On Tue, Jun 28, 2022 at 1:39 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Tue, Jun 28, 2022 at 12:01 PM Pali Rohár <pali@kernel.org> wrote:
> > > On Tuesday 28 June 2022 11:51:36 Pali Rohár wrote:
> 
> ...
> 
> > > 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/20220628100922.10717-1-pali@kernel.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-30  8:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28  9:41 [PATCH] serial: mvebu: Apply old baudrate to termios Ilpo Järvinen
2022-06-28  9:51 ` Pali Rohár
2022-06-28  9:59   ` Pali Rohár
2022-06-28 11:39     ` Andy Shevchenko
2022-06-28 11:40       ` Andy Shevchenko
2022-06-30  8:28         ` Pali Rohár

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.