summaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
authorDanilo Krummrich <dakr@kernel.org>2025-04-13 19:37:02 +0200
committerDanilo Krummrich <dakr@kernel.org>2025-04-17 15:21:50 +0200
commitf2a399d7b67c4a6fc0f8e59d1a9eb484efc71b5c (patch)
tree313b8ede3f9d06d670b7e4ad8bc25fab157432e5 /rust/kernel
parentf933b7489ffca25c9a33b65441679ee3d2943024 (diff)
rust: pci: move iomap_region() to impl Device<Bound>
Require the Bound device context to be able to call iomap_region() and iomap_region_sized(). Creating I/O mapping requires the device to be bound. Reviewed-by: Benno Lossin <benno.lossin@proton.me> Link: https://lore.kernel.org/r/20250413173758.12068-8-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r--rust/kernel/pci.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
index 1234b0c4a403..3664d35b8e79 100644
--- a/rust/kernel/pci.rs
+++ b/rust/kernel/pci.rs
@@ -390,7 +390,9 @@ impl Device {
// - by its type invariant `self.as_raw` is always a valid pointer to a `struct pci_dev`.
Ok(unsafe { bindings::pci_resource_len(self.as_raw(), bar.try_into()?) })
}
+}
+impl Device<device::Bound> {
/// Mapps an entire PCI-BAR after performing a region-request on it. I/O operation bound checks
/// can be performed on compile time for offsets (plus the requested type size) < SIZE.
pub fn iomap_region_sized<const SIZE: usize>(