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

From: Alice Ryhl

Date: Mon Feb 23 2026 - 16:27:56 EST


On Mon, Feb 16, 2026 at 2:31 PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> On Mon Feb 16, 2026 at 2:22 PM CET, Alice Ryhl wrote:
> > You should keep these re-exports (as full `pub`) so that they can be
> > accessed from kernel::io. Exposing all macros from crate root via
> > #[macro_export] is legacy approach.
>
> Good catch!
>
> diff --git a/rust/kernel/io.rs b/rust/kernel/io.rs
> index 58f464cf5efd..e5fba6bf6db0 100644
> --- a/rust/kernel/io.rs
> +++ b/rust/kernel/io.rs
> @@ -249,6 +249,7 @@ macro_rules! io_define_read {
> }
> };
> }
> +pub use io_define_read;
>
> /// Generates an accessor method for writing to an I/O backend.
> ///
> @@ -305,6 +306,7 @@ macro_rules! io_define_write {
> }
> };
> }
> +pub use io_define_write;
>
> /// Checks whether an access of type `U` at the given `offset`
> /// is valid within this region.
> diff --git a/rust/kernel/pci/io.rs b/rust/kernel/pci/io.rs
> index 2c8d7d00e54d..fb6edab2aea7 100644
> --- a/rust/kernel/pci/io.rs
> +++ b/rust/kernel/pci/io.rs
> @@ -8,14 +8,14 @@
> device,
> devres::Devres,
> io::{
> + io_define_read,
> + io_define_write,
> Io,
> IoCapable,
> IoKnownSize,
> Mmio,
> MmioRaw, //
> },
> - io_define_read,
> - io_define_write,
> prelude::*,
> sync::aref::ARef, //
> };
>
>
> (I'd still keep the `io_` prefix though.)

With the above change: RB