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

Martin Blumenstingl martin.blumenstingl at googlemail.com
Thu Feb 22 13:57:02 PST 2024


Hi Daniel,

On Thu, Feb 22, 2024 at 11:02 AM Daniel Lezcano
<daniel.lezcano at linaro.org> 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?


Best regards,
Martin



More information about the linux-arm-kernel mailing list