aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/io.c
diff options
context:
space:
mode:
authorDaniel Almeida <[email protected]>2025-07-17 15:55:23 +0000
committerDanilo Krummrich <[email protected]>2025-07-20 17:43:14 +0000
commit1d0d4b28513b5e0e9e87e09c8da289e1b8d88f84 (patch)
tree094daa6aa30773bc3e3b0a99f9740e4053a3acfa /rust/helpers/io.c
parentrust: io: add resource abstraction (diff)
downloadkernel-1d0d4b28513b5e0e9e87e09c8da289e1b8d88f84.tar.gz
kernel-1d0d4b28513b5e0e9e87e09c8da289e1b8d88f84.zip
rust: io: mem: add a generic iomem abstraction
Add a generic iomem abstraction to safely read and write ioremapped regions. This abstraction requires a previously acquired IoRequest instance. This makes it so that both the resource and the device match, or, in other words, that the resource is indeed a valid resource for a given bound device. A subsequent patch will add the ability to retrieve IoRequest instances from platform devices. The reads and writes are done through IoRaw, and are thus checked either at compile-time, if the size of the region is known at that point, or at runtime otherwise. Non-exclusive access to the underlying memory region is made possible to cater to cases where overlapped regions are unavoidable. Acked-by: Miguel Ojeda <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Daniel Almeida <[email protected]> Link: https://lore.kernel.org/r/20250717-topics-tyr-platform_iomem-v15-2-beca780b77e3@collabora.com [ Add #[expect(dead_code)] to avoid a temporary warning, remove unnecessary OF_ID_TABLE constants in doc-tests and ignore doc-tests for now to avoid a temporary build failure. - Danilo ] Signed-off-by: Danilo Krummrich <[email protected]>
Diffstat (limited to 'rust/helpers/io.c')
-rw-r--r--rust/helpers/io.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/helpers/io.c b/rust/helpers/io.c
index 404776cf6717..c475913c69e6 100644
--- a/rust/helpers/io.c
+++ b/rust/helpers/io.c
@@ -8,6 +8,11 @@ void __iomem *rust_helper_ioremap(phys_addr_t offset, size_t size)
return ioremap(offset, size);
}
+void __iomem *rust_helper_ioremap_np(phys_addr_t offset, size_t size)
+{
+ return ioremap_np(offset, size);
+}
+
void rust_helper_iounmap(void __iomem *addr)
{
iounmap(addr);