From: Alice Ryhl <aliceryhl@google.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: daniel.almeida@collabora.com, bhelgaas@google.com,
kwilczynski@kernel.org, ojeda@kernel.org, boqun.feng@gmail.com,
gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org,
a.hindborg@kernel.org, tmgross@umich.edu, zhiw@nvidia.com,
acourbot@nvidia.com, driver-core@lists.linux.dev,
rust-for-linux@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Subject: Re: [PATCH] rust: io: macro_export io_define_read!() and io_define_write!()
Date: Mon, 16 Feb 2026 13:22:30 +0000 [thread overview]
Message-ID: <aZMaFhvZWiknu8UK@google.com> (raw)
In-Reply-To: <20260216131534.65008-1-dakr@kernel.org>
On Mon, Feb 16, 2026 at 02:14:33PM +0100, 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@gmail.com>
> Closes: https://lore.kernel.org/driver-core/CANiq72khOYkt6t5zwMvSiyZvWWHMZuNCMERXu=7K=_5tT-8Pgg@mail.gmail.com/ [1]
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> -pub(crate) use define_read;
> -pub(crate) use define_write;
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.
Alice
next prev parent reply other threads:[~2026-02-16 13:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 13:14 [PATCH] rust: io: macro_export io_define_read!() and io_define_write!() Danilo Krummrich
2026-02-16 13:22 ` Daniel Almeida
2026-02-16 13:22 ` Alice Ryhl [this message]
2026-02-16 13:31 ` Danilo Krummrich
2026-02-23 21:27 ` Alice Ryhl
2026-02-16 13:39 ` Alexandre Courbot
2026-02-16 13:47 ` Danilo Krummrich
2026-02-23 22:09 ` Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZMaFhvZWiknu8UK@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=zhiw@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.