On 5/26/2020 3:01 PM, Andrew Lunn wrote: >>> +/* When high resolution timers aren't built-in: we can't use >>> usleep_range() as >>> + * we would sleep way too long. Use udelay() instead. >>> + */ >>> +#define mscc_readl_poll_timeout(addr, val, cond, delay_us, timeout_us) >>> \ >>> +({ \ >>> + if (!IS_ENABLED(CONFIG_HIGH_RES_TIMERS)) \ >>> + readl_poll_timeout_atomic(addr, val, cond, delay_us, \ >>> + timeout_us); \ >>> + readl_poll_timeout(addr, val, cond, delay_us, timeout_us); \ >>> +}) >>> + >> >> I would make this a regular function which would not harm the compiler's >> ability to optimize it, but would give you type checking. With that fixed: > > Hi Florian > > cond makes that difficult, since it is not a parameter in the usual > sense, but an expression to evaluate if the polling should terminate. > > readl_poll_timeout() and readl_poll_timeout_atomic() themselves are > #define's, and there are more levels of macros under them. Oh that's right, thanks for reminding me of this. -- Florian
- [PATCH net-next 0/4] net: phy: mscc-miim: reduce waiting... Antoine Tenart
- [PATCH net-next 1/4] net: phy: mscc-miim: use more ... Antoine Tenart
- Re: [PATCH net-next 1/4] net: phy: mscc-miim: u... Alexandre Belloni
- Re: [PATCH net-next 1/4] net: phy: mscc-miim: u... Florian Fainelli
- [PATCH net-next 4/4] net: phy: mscc-miim: read poll... Antoine Tenart
- Re: [PATCH net-next 4/4] net: phy: mscc-miim: r... Florian Fainelli
- Re: [PATCH net-next 4/4] net: phy: mscc-mii... Andrew Lunn
- Re: [PATCH net-next 4/4] net: phy: mscc... Florian Fainelli
- [PATCH net-next 2/4] net: phy: mscc-miim: remove re... Antoine Tenart
- Re: [PATCH net-next 2/4] net: phy: mscc-miim: r... Alexandre Belloni
- Re: [PATCH net-next 2/4] net: phy: mscc-miim: r... Florian Fainelli
- [PATCH net-next 3/4] net: phy: mscc-miim: improve w... Antoine Tenart
- Re: [PATCH net-next 3/4] net: phy: mscc-miim: i... Alexandre Belloni
- Re: [PATCH net-next 3/4] net: phy: mscc-miim: i... Florian Fainelli
- Re: [PATCH net-next 0/4] net: phy: mscc-miim: reduc... Andrew Lunn
- Re: [PATCH net-next 0/4] net: phy: mscc-miim: r... Antoine Tenart
- Re: [PATCH net-next 0/4] net: phy: mscc-miim: reduc... David Miller