Re: [PATCH v2 1/3] serial: core: Store fifo timeout again

From: Ilpo Järvinen
Date: Wed Apr 17 2024 - 04:18:49 EST


On Tue, 16 Apr 2024, Michael Pratt wrote:
> On Tuesday, April 16th, 2024 at 14:58, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> > > + if (port->fifosize > 1)
> > > + port->timeout = uart_fifo_timeout(port);
> >
> >
> > else
> > port->timeout = port->frame_time;
> >
>
>
> Consistent with what I said in the other reply, the only reason that
> I have an if statement here, is to avoid doing extra math for devices
> without a fifo, as a specifically calculated timeout value would be useless
> in those cases.

Please benchmark to show this actually matters if want to make this claim.
Otherwise just do the math always.

> However, if you don't like the 10 ms default timeout, perhaps port->frame_time
> could actually be a more reasonable default value? That is, provided
> that we have a process
> for calculating the proper value already in place...

While it would be a step toward the correct direction, you'd still need to
add the safety there which is already done by uart_fifo_timeout(). So no,
I don't think there's advantage of using port->frame_time over just
calling uart_fifo_timeout() and ensuring uart_fifo_timeout() is always
using at least 1 as the FIFO size when it does the calculations.

--
i.