Re: [PATCH v1 1/2] regmap: redefined regmap_read_poll_timeout to simplify code

From: Dejin Zheng
Date: Mon Apr 20 2020 - 09:30:29 EST


On Sun, Apr 19, 2020 at 07:09:14PM +0200, Markus Elfring wrote:
> > use read_poll_timeout macro to redefined regmap_read_poll_timeout
> > and also remove the duplicate code.
>
> How do you think about a wording variant like the following?
>
> Subject:
> [PATCH 1/2] regmap: Simplify implementation of the regmap_read_poll_timeout() macro
>
> Change description:
> Simplify the implementation of the macro âregmap_read_poll_timeoutâ
> by using the macro âread_poll_timeoutâ.
>
Good, I will send the patch v2.
>
> â
> > +++ b/include/linux/regmap.h
> â
> > @@ -122,26 +123,10 @@ struct reg_sequence {
> > */
> > #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
> > ({ \
> â
> > + int __ret, __tmp; \
> > + __tmp = read_poll_timeout(regmap_read, __ret, __ret || (cond), \
> > + sleep_us, timeout_us, false, (map), (addr), &(val)); \
> > + __ret ?: __tmp; \
> > })
>
> * Can this macro work also with variable names which do not contain
> double underscores?
>
Yes, this is to avoid using the same variable with its caller.

> * Can the tag âFixesâ be relevant for such an adjustment?
>
I think It is not relevant and we don't need add it.

BR,
Dejin

> Regards,
> Markus