rust: io: gate ioremap doctests on CONFIG_HAS_IOMEM
authorDanilo Krummrich <dakr@kernel.org>
Wed, 5 Aug 2026 21:28:36 +0000 (23:28 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Thu, 6 Aug 2026 14:05:50 +0000 (16:05 +0200)
The doc examples in io.rs and devres.rs directly call
bindings::ioremap() and bindings::iounmap(), which do not exist when
CONFIG_HAS_IOMEM is not set. This causes build failures with
CONFIG_RUST_KERNEL_DOCTESTS=y on such configurations (e.g. s390
allnoconfig).

Gate the affected doctests with `#![cfg(CONFIG_HAS_IOMEM)]` so they are
skipped when IOMEM is unavailable.

Fixes: 3f70ebe63858 ("s390: Enable Rust support")
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260805212920.1996937-2-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/devres.rs
rust/kernel/io.rs

index 11ce500..8ff8aed 100644 (file)
@@ -59,6 +59,7 @@ struct Inner<T> {
 /// # Examples
 ///
 /// ```no_run
+/// # #![cfg(CONFIG_HAS_IOMEM)]
 /// use kernel::{
 ///     bindings,
 ///     device::{
index d30bb5c..d4063ee 100644 (file)
@@ -81,6 +81,7 @@ impl<const SIZE: usize> MmioRaw<SIZE> {
 /// # Examples
 ///
 /// ```no_run
+/// # #![cfg(CONFIG_HAS_IOMEM)]
 /// use kernel::{
 ///     bindings,
 ///     ffi::c_void,