linux/rust/kernel
Danilo Krummrich bfcaf4e8ae rust: io: macro_export io_define_read!() and io_define_write!()
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: 121d87b28e ("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]
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://patch.msgid.link/20260216131534.65008-1-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-02-23 00:54:02 +01:00
..
alloc
block
debugfs
device
drm
fs
io
iommu
irq Rust fixes for v7.0-rc1 2026-02-22 08:43:31 -08:00
list Rust fixes for v7.0-rc1 2026-02-22 08:43:31 -08:00
mm
net
num
pci rust: io: macro_export io_define_read!() and io_define_write!() 2026-02-23 00:54:02 +01:00
str
sync Char/Misc/IIO driver changes for 7.0-rc1 2026-02-17 09:11:04 -08:00
time
.gitignore
acpi.rs
alloc.rs
auxiliary.rs
bitmap.rs
bits.rs
block.rs
bug.rs
build_assert.rs
clk.rs
configfs.rs
cpu.rs
cpufreq.rs
cpumask.rs
cred.rs
debugfs.rs
device.rs
device_id.rs
devres.rs
dma.rs
driver.rs
error.rs
faux.rs
firmware.rs
fmt.rs
fs.rs
generated_arch_reachable_asm.rs.S
generated_arch_static_branch_asm.rs.S
generated_arch_warn_asm.rs.S
i2c.rs
id_pool.rs
impl_flags.rs
init.rs
io.rs rust: io: macro_export io_define_read!() and io_define_write!() 2026-02-23 00:54:02 +01:00
ioctl.rs
iov.rs
irq.rs
jump_label.rs
kunit.rs
lib.rs
list.rs
maple_tree.rs
miscdevice.rs
mm.rs
module_param.rs
net.rs
num.rs
of.rs
opp.rs
page.rs
pci.rs
pid_namespace.rs
platform.rs
prelude.rs
print.rs
processor.rs
ptr.rs
pwm.rs
rbtree.rs
regulator.rs
revocable.rs
safety.rs
scatterlist.rs
security.rs
seq_file.rs
sizes.rs
slice.rs
soc.rs
static_assert.rs
std_vendor.rs
str.rs
sync.rs
task.rs
time.rs
tracepoint.rs
transmute.rs
types.rs
uaccess.rs
usb.rs USB / Thunderbolt changes for 7.0-rc1 2026-02-17 09:36:43 -08:00
workqueue.rs
xarray.rs