Re: [PATCH v1] clocksource/drivers/arm_global_timer: Simplify prescaler register access

From: Daniel Lezcano
Date: Thu Feb 22 2024 - 17:34:34 EST


On 22/02/2024 22:57, Martin Blumenstingl wrote:
Hi Daniel,

On Thu, Feb 22, 2024 at 11:02 AM Daniel Lezcano
<daniel.lezcano@xxxxxxxxxx> wrote:
[ ... ]

/* prescaler within legal range? */
- if (psv < 0 || psv > GT_CONTROL_PRESCALER_MAX)
+ if (psv < 0 || psv > FIELD_GET(GT_CONTROL_PRESCALER_MASK, ~0))

FIELD_MAX() ?
Oh, I was not aware of FIELD_MAX() - thank you!
While researching that I found that there's also FIELD_FIT() which I
think is perfect here. What do you think?

Ah yes, even better :)

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog