On Thu Aug 6, 2026 at 1:35 AM JST, Gary Guo wrote: > Currently registers work for all untyped I/O regions, which is not ideal. > It allows registers defined for device A to work for another device B and > there is no safeguarding at all. > > All users of the `register!` macro know what type it will be operating on, > and that type is consistent across the driver. Therefore, add a `base` > parameter to `register!`. > > Currently this parameter is unused in the generated code; it will be used > when all users of `register!` is converted to gain the parameter. > > Signed-off-by: Gary Guo <[email protected]>
I did push back a bit on v1 about making this mandatory, but this makes a lot more sense once you consider that by the end of this series, the `register!` macro does not really define registers anymore: it defines the layout of an address space - that you can define register types with it is just a convenience shortcut. With that framing, it is much more defensible to have to specify the type (or at least the size) of the address space itself. I guess we ought to rename `register!` at some point in the near future (not necessarily with this series).
