summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
Diffstat (limited to 'rust')
-rw-r--r--rust/helpers/io.c2
-rw-r--r--rust/kernel/devres.rs1
-rw-r--r--rust/kernel/io.rs2
-rw-r--r--rust/kernel/platform.rs9
4 files changed, 10 insertions, 4 deletions
diff --git a/rust/helpers/io.c b/rust/helpers/io.c
index 397810864a24..1edbc274951c 100644
--- a/rust/helpers/io.c
+++ b/rust/helpers/io.c
@@ -3,6 +3,7 @@
#include <linux/io.h>
#include <linux/ioport.h>
+#ifdef CONFIG_HAS_IOMEM
__rust_helper void __iomem *rust_helper_ioremap(phys_addr_t offset, size_t size)
{
return ioremap(offset, size);
@@ -18,6 +19,7 @@ __rust_helper void rust_helper_iounmap(void __iomem *addr)
{
iounmap(addr);
}
+#endif /* CONFIG_HAS_IOMEM */
__rust_helper u8 rust_helper_readb(const void __iomem *addr)
{
diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs
index 11ce500e9b76..8ff8aedf251a 100644
--- a/rust/kernel/devres.rs
+++ b/rust/kernel/devres.rs
@@ -59,6 +59,7 @@ struct Inner<T> {
/// # Examples
///
/// ```no_run
+/// # #![cfg(CONFIG_HAS_IOMEM)]
/// use kernel::{
/// bindings,
/// device::{
diff --git a/rust/kernel/io.rs b/rust/kernel/io.rs
index fcc7678fd9e3..d4063ee41200 100644
--- a/rust/kernel/io.rs
+++ b/rust/kernel/io.rs
@@ -9,6 +9,7 @@ use crate::{
prelude::*, //
};
+#[cfg(CONFIG_HAS_IOMEM)]
pub mod mem;
pub mod poll;
pub mod register;
@@ -80,6 +81,7 @@ impl<const SIZE: usize> MmioRaw<SIZE> {
/// # Examples
///
/// ```no_run
+/// # #![cfg(CONFIG_HAS_IOMEM)]
/// use kernel::{
/// bindings,
/// ffi::c_void,
diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs
index 9b362e0495d3..d41555a4b31d 100644
--- a/rust/kernel/platform.rs
+++ b/rust/kernel/platform.rs
@@ -17,10 +17,7 @@ use crate::{
from_result,
to_result, //
},
- io::{
- mem::IoRequest,
- Resource, //
- },
+ io::Resource,
irq::{
self,
IrqRequest, //
@@ -31,6 +28,9 @@ use crate::{
ThisModule, //
};
+#[cfg(CONFIG_HAS_IOMEM)]
+use crate::io::mem::IoRequest;
+
use core::{
marker::PhantomData,
mem::offset_of,
@@ -307,6 +307,7 @@ impl<Ctx: device::DeviceContext> Device<Ctx> {
}
}
+#[cfg(CONFIG_HAS_IOMEM)]
impl Device<Bound> {
/// Returns an `IoRequest` for the resource at `index`, if any.
pub fn io_request_by_index(&self, index: u32) -> Option<IoRequest<'_>> {