Re: [PATCH] rust: io: macro_export io_define_read!() and io_define_write!()

From: Danilo Krummrich

Date: Mon Feb 23 2026 - 17:20:56 EST


On Mon Feb 16, 2026 at 2:14 PM CET, Danilo Krummrich wrote:
> Currently, the define_read!() and define_write!() I/O macros are crate
> public. The only user outside of the I/O module is PCI (for the
> configurations space I/O backend). Consequently, when CONFIG_PCI=n this
> causes a compile time warning [1].
>
> In order to fix this, rename the macros to io_define_read!() and
> io_define_write!() and use #[macro_export] to export them.
>
> This is better than making the crate public visibility conditional, as
> eventually subsystems will have their own crate.
>
> Also, I/O backends are valid to be implemented by drivers as well. For
> instance, there are devices (such as GPUs) that run firmware which
> allows to program other devices only accessible through the primary
> device through indirect I/O.
>
> Since the macros are now public, also add the corresponding
> documentation.
>
> Fixes: 121d87b28e1d ("rust: io: separate generic I/O helpers from MMIO implementation")
> Reported-by: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
> Closes: https://lore.kernel.org/driver-core/CANiq72khOYkt6t5zwMvSiyZvWWHMZuNCMERXu=7K=_5tT-8Pgg@xxxxxxxxxxxxxx/ [1]
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>

Applied to driver-core-linus, thanks!