diff mbox series

[v4,2/5] serial/8250: Use the cache value of the FCR register

Message ID 20220316143646.13301-3-wander@redhat.com
State New
Headers show
Series tty/8250: Use fifo in 8250 console driver | expand

Commit Message

Wander Lairson Costa March 16, 2022, 2:36 p.m. UTC
commit 5021d709b31b ("tty: serial: Use fifo in 8250 console driver")
erroneous tries to read the FCR register content, but this register is
write-only.

This patch fixes that by reading the content from the port struct fcr
field.

Thanks to Jon Hunter and Jiri Slaby.

Suggested-by: Jiri Slaby <jirislaby@kernel.org>
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
---
 drivers/tty/serial/8250/8250_port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ilpo Järvinen March 17, 2022, 8:29 a.m. UTC | #1
On Wed, 16 Mar 2022, Wander Lairson Costa wrote:

> commit 5021d709b31b ("tty: serial: Use fifo in 8250 console driver")
> erroneous tries to read the FCR register content, but this register is
> write-only.
> 
> This patch fixes that by reading the content from the port struct fcr
> field.
> 
> Thanks to Jon Hunter and Jiri Slaby.
> 
> Suggested-by: Jiri Slaby <jirislaby@kernel.org>
> Reported-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: Wander Lairson Costa <wander@redhat.com>
> ---
>  drivers/tty/serial/8250/8250_port.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 2abb3de11a48..9f3fa9fe2a4e 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -3410,7 +3410,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
>  
>  	use_fifo = (up->capabilities & UART_CAP_FIFO) &&
>  		port->fifosize > 1 &&
> -		(serial_port_in(port, UART_FCR) & UART_FCR_ENABLE_FIFO) &&
> +		(up->fcr & UART_FCR_ENABLE_FIFO) &&

Didn't you just add this line in 1/5? Please merge this kind of fixes that 
are due to development history of a change to the main patch itself.
Wander Costa March 17, 2022, 12:03 p.m. UTC | #2
On Thu, Mar 17, 2022 at 5:31 AM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> On Wed, 16 Mar 2022, Wander Lairson Costa wrote:
>
> > commit 5021d709b31b ("tty: serial: Use fifo in 8250 console driver")
> > erroneous tries to read the FCR register content, but this register is
> > write-only.
> >
> > This patch fixes that by reading the content from the port struct fcr
> > field.
> >
> > Thanks to Jon Hunter and Jiri Slaby.
> >
> > Suggested-by: Jiri Slaby <jirislaby@kernel.org>
> > Reported-by: Jon Hunter <jonathanh@nvidia.com>
> > Signed-off-by: Wander Lairson Costa <wander@redhat.com>
> > ---
> >  drivers/tty/serial/8250/8250_port.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> > index 2abb3de11a48..9f3fa9fe2a4e 100644
> > --- a/drivers/tty/serial/8250/8250_port.c
> > +++ b/drivers/tty/serial/8250/8250_port.c
> > @@ -3410,7 +3410,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
> >
> >       use_fifo = (up->capabilities & UART_CAP_FIFO) &&
> >               port->fifosize > 1 &&
> > -             (serial_port_in(port, UART_FCR) & UART_FCR_ENABLE_FIFO) &&
> > +             (up->fcr & UART_FCR_ENABLE_FIFO) &&
>
> Didn't you just add this line in 1/5? Please merge this kind of fixes that
> are due to development history of a change to the main patch itself.
>

The reason is that 1/5 has been applied in 5.17 and then reverted, so
I thought it would make it easier for reviewers if I sent the new
fixes in different commits. If that's not the case, I can send a
squashed version with the changelog described in 0/5.
diff mbox series

Patch

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 2abb3de11a48..9f3fa9fe2a4e 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -3410,7 +3410,7 @@  void serial8250_console_write(struct uart_8250_port *up, const char *s,
 
 	use_fifo = (up->capabilities & UART_CAP_FIFO) &&
 		port->fifosize > 1 &&
-		(serial_port_in(port, UART_FCR) & UART_FCR_ENABLE_FIFO) &&
+		(up->fcr & UART_FCR_ENABLE_FIFO) &&
 		/*
 		 * After we put a data in the fifo, the controller will send
 		 * it regardless of the CTS state. Therefore, only use fifo