Re: [PATCH RFC 2/3] rust: Add bindings for device properties

From: Rob Herring
Date: Tue Oct 29 2024 - 15:35:55 EST


On Tue, Oct 29, 2024 at 1:57 PM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> On Tue, Oct 29, 2024 at 7:48 PM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> >
> > One option is to define a trait for integers:

Yeah, but that doesn't feel like something I should do here. I imagine
other things might need the same thing. Perhaps the bindings for
readb/readw/readl for example. And essentially the crate:num already
has the trait I need. Shouldn't the kernel mirror that? I recall
seeing some topic of including crates in the kernel?

> +1, one more thing to consider is whether it makes sense to define a
> DT-only trait that holds all the types that can be a device property
> (like `bool` too, not just the `Integer`s).
>
> Then we can avoid e.g. `property_read_bool` and simply do it in `property_read`.

Is there no way to say must have traitA or traitB?

Rob