Re: [PATCH V6 03/15] cpufreq: Rust implementation doesn't parse BIT() macro
From: Alice Ryhl
Date: Wed Jan 08 2025 - 04:01:49 EST
On Wed, Jan 8, 2025 at 7:53 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> On 07-01-25, 10:29, Daniel Almeida wrote:
> > Viresh, FYI, there’s already a patch for this floating around [0].
> >
> > I can send a new version today. From Alice’s last comments, it only
> > needs a minor fix anyways.
>
> Thanks for the pointer Daniel. I was expecting that I would be able to use the
> definition from bindings generated with bindgen somehow.
>
> The C header contains:
>
> #define BIT(nr) (1 << (nr))
> #define CPUFREQ_NEED_UPDATE_LIMITS BIT(0)
>
> Bindgen doesn't get me a definition to CPUFREQ_NEED_UPDATE_LIMITS now. Is there
> a way to make that work with nested macros ? I wanted to avoid defining them
> again in the Rust side.
Change the #define to an enum instead. See commit 3634783be125
("binder: use enum for binder ioctls") for an example of this
strategy.
Alice