Re: [PATCH 2/7] serial: 8250: add serial_in_poll_timeout helper

From: Andy Shevchenko
Date: Wed Mar 18 2020 - 11:09:45 EST


On Wed, Mar 18, 2020 at 03:26:35PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@xxxxxxxxxxxxxxxxxxxxx>
>
> In cases where a serial register needs to be polled until a specific
> state, this should have a timeout as noted in the thread bringing em485
> support to 8250_dw.
>
> To not re-implement timeout handling in each case, add a helper modelled
> after readx_poll_timeout / regmap_read_poll_timeout to facilitate this.

> +#define serial_in_poll_timeout(port, offs, val, cond, timeout_us) \

This can (re-)use readx_poll_timeout().

Example:

https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/commit/?h=testing&id=b0415c224926c6d94c778d72f3d44c83862eb214

--
With Best Regards,
Andy Shevchenko