diff options
author | Daniel Almeida <daniel.almeida@collabora.com> | 2025-07-17 12:55:24 -0300 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-07-20 19:43:14 +0200 |
commit | bc4f9045a59963abb142f6a648195ccd73ec39dd (patch) | |
tree | 9738ef743455b4f0933d53b17b71fbc69e617855 /rust/kernel/io | |
parent | 1d0d4b28513b5e0e9e87e09c8da289e1b8d88f84 (diff) |
rust: platform: add resource accessors
The previous patches have added the abstractions for Resources and the
ability to map them and therefore read and write the underlying memory .
The only thing missing to make this accessible for platform devices is
to provide accessors that return instances of IoRequest<'a>. These
ensure that the resource are valid only for the lifetime of the platform
device, and that the platform device is in the Bound state.
Therefore, add these accessors. Also make it possible to retrieve
resources from platform devices in Rust using either a name or an index.
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://lore.kernel.org/r/20250717-topics-tyr-platform_iomem-v15-3-beca780b77e3@collabora.com
[ Remove #[expect(dead_code)] from IoRequest::new() and move SAFETY
comments right on top of unsafe blocks to avoid clippy warnings for
some (older) clippy versions. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/io')
-rw-r--r-- | rust/kernel/io/mem.rs | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/rust/kernel/io/mem.rs b/rust/kernel/io/mem.rs index 8e4dfd79079e..50d4ec3eb623 100644 --- a/rust/kernel/io/mem.rs +++ b/rust/kernel/io/mem.rs @@ -28,7 +28,6 @@ impl<'a> IoRequest<'a> { /// /// Callers must ensure that `resource` is valid for `device` during the /// lifetime `'a`. - #[expect(dead_code)] pub(crate) unsafe fn new(device: &'a Device<Bound>, resource: &'a Resource) -> Self { IoRequest { device, resource } } |