Skip to content

Commit f2a399d

Browse files
author
Danilo Krummrich
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Danilo Krummrich <[email protected]>
1 parent f933b74 commit f2a399d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

rust/kernel/pci.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ impl Device {
390390
// - by its type invariant `self.as_raw` is always a valid pointer to a `struct pci_dev`.
391391
Ok(unsafe { bindings::pci_resource_len(self.as_raw(), bar.try_into()?) })
392392
}
393+
}
393394

395+
impl Device<device::Bound> {
394396
/// Mapps an entire PCI-BAR after performing a region-request on it. I/O operation bound checks
395397
/// can be performed on compile time for offsets (plus the requested type size) < SIZE.
396398
pub fn iomap_region_sized<const SIZE: usize>(

0 commit comments

Comments
 (0)