Re: [PATCH 4/4] serial: 8250_dw: Rework ->serial_out() LCR write retry logic
From: Andy Shevchenko
Date: Wed Jun 29 2022 - 05:52:04 EST
On Wed, Jun 29, 2022 at 11:40 AM Ilpo Järvinen
<ilpo.jarvinen@xxxxxxxxxxxxxxx> wrote:
> On Wed, 29 Jun 2022, Andy Shevchenko wrote:
> > On Wed, Jun 29, 2022 at 10:47 AM Ilpo Järvinen
> > <ilpo.jarvinen@xxxxxxxxxxxxxxx> wrote:
> > > On Tue, 28 Jun 2022, Andy Shevchenko wrote:
...
> > > Eh, are you suggesting I should do write as a side-effect inside one of
> > > the iopoll.h macros? Because those available seem to only read?
> > >
> > > Or should I create another macro there which writes too?
> >
> > It seems to me that it would be a macro on top of iopoll's one which
> > will take an op read and op write arguments depending on the case.
>
> The thing is those iopoll macros don't return until the timeout is
> exhausted
It returns when the condition is true (in your case verify_lcr is OK).
> so I don't think I can reuse them easily for this task ("on top
> of iopoll's one")? That is, w/o some major side-effect hack (which is
> IMHO a no-go).
Basically what we need is a write-read type of polling.
With your current approach I don't like that retries assignment is
duplicated several times and decrement happens in the callee. What I'm
trying to suggest is to research alternatives.
--
With Best Regards,
Andy Shevchenko