]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
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 11ce500e9b76f55de6164d5a32061b744473a45c..8ff8aedf251a86cc9d351d0b5a780e348e3cbcf0 100644 (file)
@@ -59,6 +59,7 @@ struct Inner<T> {
 /// # Examples
 ///
 /// ```no_run
+/// # #![cfg(CONFIG_HAS_IOMEM)]
 /// use kernel::{
 ///     bindings,
 ///     device::{
index d30bb5c6d4fcf94be06a86e1b4944031f6acfd5f..d4063ee4120002977c8af769038ae2bdc868c956 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,