Linux-Serial Archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: max310x: change confusing comment about Tx FIFO
@ 2023-11-22 17:59 Hugo Villeneuve
  2023-12-01 16:04 ` Jan Kundrát
  0 siblings, 1 reply; 3+ messages in thread
From: Hugo Villeneuve @ 2023-11-22 17:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: hugo, Hugo Villeneuve, linux-kernel, linux-serial

From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

The comment wording can be confusing, as txlen will return the number of
bytes available in the FIFO, which can be less than the maximum theoretical
Tx FIFO size.

Change the comment so that it is unambiguous.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
 drivers/tty/serial/max310x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 97e4965b73d4..f3a99daebdaa 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -780,7 +780,7 @@ static void max310x_handle_tx(struct uart_port *port)
 	to_send = uart_circ_chars_pending(xmit);
 	until_end = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
 	if (likely(to_send)) {
-		/* Limit to size of TX FIFO */
+		/* Limit to space available in TX FIFO */
 		txlen = max310x_port_read(port, MAX310X_TXFIFOLVL_REG);
 		txlen = port->fifosize - txlen;
 		to_send = (to_send > txlen) ? txlen : to_send;

base-commit: 98b1cc82c4affc16f5598d4fa14b1858671b2263
-- 
2.39.2


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

* Re: [PATCH] serial: max310x: change confusing comment about Tx FIFO
  2023-11-22 17:59 [PATCH] serial: max310x: change confusing comment about Tx FIFO Hugo Villeneuve
@ 2023-12-01 16:04 ` Jan Kundrát
  2023-12-01 16:43   ` Hugo Villeneuve
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kundrát @ 2023-12-01 16:04 UTC (permalink / raw)
  To: Hugo Villeneuve
  Cc: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve, linux-kernel,
	linux-serial

On středa 22. listopadu 2023 18:59:56 CET, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
>
> The comment wording can be confusing, as txlen will return the number of
> bytes available in the FIFO, which can be less than the maximum theoretical
> Tx FIFO size.

This (commit) message is confusing, too, IMHO, because `txlen` is the 
number of bytes that are currently waiting in the TX FIFO. So that number 
is "available" for the HW UART to pick up and send, but it's not a number 
of bytes that's "available" in the FIFO for host to push more bytes to. I 
guess you might want to tweak that description here.

Cheers,
Jan

>
> Change the comment so that it is unambiguous.
>
> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> ---
>  drivers/tty/serial/max310x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> index 97e4965b73d4..f3a99daebdaa 100644
> --- a/drivers/tty/serial/max310x.c
> +++ b/drivers/tty/serial/max310x.c
> @@ -780,7 +780,7 @@ static void max310x_handle_tx(struct uart_port *port)
>  	to_send = uart_circ_chars_pending(xmit);
>  	until_end = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
>  	if (likely(to_send)) {
> -		/* Limit to size of TX FIFO */
> +		/* Limit to space available in TX FIFO */
>  		txlen = max310x_port_read(port, MAX310X_TXFIFOLVL_REG);
>  		txlen = port->fifosize - txlen;
>  		to_send = (to_send > txlen) ? txlen : to_send;
>
> base-commit: 98b1cc82c4affc16f5598d4fa14b1858671b2263


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

* Re: [PATCH] serial: max310x: change confusing comment about Tx FIFO
  2023-12-01 16:04 ` Jan Kundrát
@ 2023-12-01 16:43   ` Hugo Villeneuve
  0 siblings, 0 replies; 3+ messages in thread
From: Hugo Villeneuve @ 2023-12-01 16:43 UTC (permalink / raw)
  To: Jan Kundrát
  Cc: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve, linux-kernel,
	linux-serial

On Fri, 01 Dec 2023 17:04:15 +0100
Jan Kundrát <jan.kundrat@cesnet.cz> wrote:

> On středa 22. listopadu 2023 18:59:56 CET, Hugo Villeneuve wrote:
> > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> >
> > The comment wording can be confusing, as txlen will return the number of
> > bytes available in the FIFO, which can be less than the maximum theoretical
> > Tx FIFO size.
> 
> This (commit) message is confusing, too, IMHO, because `txlen` is the 
> number of bytes that are currently waiting in the TX FIFO. So that number 
> is "available" for the HW UART to pick up and send, but it's not a number 
> of bytes that's "available" in the FIFO for host to push more bytes to. I 
> guess you might want to tweak that description here.

Hi Jan,
you are right, the commit message is confusing. I copied it from the
commit message of a similar patch for the sc16is7xx driver, and I
should have modified it for the max310x:

SC16IS7XX TXLVL: spaces available in TX FIFO
MAX310X TXFIFOLVL: current fill level in TX FIFO

The patch has already been applied to Greg's tty-next tree (my
understanding is that it cannot be rebased?), but at least
the comment in the code is still valid.

Thank you for the precision.

Hugo V.


> >
> > Change the comment so that it is unambiguous.
> >
> > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > ---
> >  drivers/tty/serial/max310x.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> > index 97e4965b73d4..f3a99daebdaa 100644
> > --- a/drivers/tty/serial/max310x.c
> > +++ b/drivers/tty/serial/max310x.c
> > @@ -780,7 +780,7 @@ static void max310x_handle_tx(struct uart_port *port)
> >  	to_send = uart_circ_chars_pending(xmit);
> >  	until_end = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
> >  	if (likely(to_send)) {
> > -		/* Limit to size of TX FIFO */
> > +		/* Limit to space available in TX FIFO */
> >  		txlen = max310x_port_read(port, MAX310X_TXFIFOLVL_REG);
> >  		txlen = port->fifosize - txlen;
> >  		to_send = (to_send > txlen) ? txlen : to_send;
> >
> > base-commit: 98b1cc82c4affc16f5598d4fa14b1858671b2263
> 
> 

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

end of thread, other threads:[~2023-12-01 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 17:59 [PATCH] serial: max310x: change confusing comment about Tx FIFO Hugo Villeneuve
2023-12-01 16:04 ` Jan Kundrát
2023-12-01 16:43   ` Hugo Villeneuve

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).