Re: [PATCH v2 4/5] rust: io: add `register!` macro
From: Miguel Ojeda
Date: Wed Jan 21 2026 - 11:29:21 EST
On Wed, Jan 21, 2026 at 3:58 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>
> Another top-level question I have is whether we should define multiple registers
> (perhaps all) in one macro invocation. That's the strategy of `tock-registers`
> crate which is widely used in embedded Rust.
Yeah, I suggested a multi-register one for something similar in 2021
and even tackling extra automatic codegen there, like e.g. adjusting
the value as needed to get to the proper unit from a sensor.
Not sure how useful the multi-register part in practice it would be,
but it would allow to relate several registers together if needed (is
that even common nowadays?). Or perhaps things like the
interleaving/striding example in the patch could be done "at once".
https://lore.kernel.org/all/CANiq72mAYE6Wh8AikfuuNm8Asr4+c90_bYbj8XdBGJ1Pb4kzvQ@xxxxxxxxxxxxxx/
Cheers,
Miguel