Re: [PATCH v4 5/7] rust: io: add `register!` macro

From: Danilo Krummrich

Date: Thu Jan 29 2026 - 16:11:34 EST


On Thu Jan 29, 2026 at 3:10 PM CET, Gary Guo wrote:
> The issue with `Deref` bound here is that now you *require* a level of
> indirection. If something implements `Io` directly, you cannot use it with the
> method. While `&Bar` is accepted, `&Mmio` is not because `Mmio` is a direct
> implementor of `Io` and not deref to it.
>
> A `Deref` bound also does not help if, say, a type is `Arc<Bar>` which needs two
> level of dereffing before it is Io. For consistency I think it's best to avoid
> `Deref` call all together

I agree with that and we will probably run into this once we start implementing
the I/O traits for things like DMA memory.

We could use AsRef or a custom trait instead, but I'd rather leave this for a
subsequent series, as it requires more changes. They should also be transparent
to users.