Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: pci: inline several tiny functions

Several previous commits added Vendor and Class functionality. As part
of that, the new functions were inlined where appropriate. But that left
this file with inconsistent use of inlining. Fix that by inlining the
remaining items that should be.

Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Elle Rhumsaa <elle@weathered-steel.dev>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Link: https://lore.kernel.org/r/20250829223632.144030-7-jhubbard@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

John Hubbard and committed by
Danilo Krummrich
7bb02685 1b8ac376

+5
+5
rust/kernel/pci.rs
··· 134 134 /// Equivalent to C's `PCI_DEVICE` macro. 135 135 /// 136 136 /// Create a new `pci::DeviceId` from a vendor and device ID. 137 + #[inline] 137 138 pub const fn from_id(vendor: Vendor, device: u32) -> Self { 138 139 Self(bindings::pci_device_id { 139 140 vendor: vendor.as_raw() as u32, ··· 151 150 /// Equivalent to C's `PCI_DEVICE_CLASS` macro. 152 151 /// 153 152 /// Create a new `pci::DeviceId` from a class number and mask. 153 + #[inline] 154 154 pub const fn from_class(class: u32, class_mask: u32) -> Self { 155 155 Self(bindings::pci_device_id { 156 156 vendor: DeviceId::PCI_ANY_ID, ··· 389 387 } 390 388 391 389 impl Bar { 390 + #[inline] 392 391 fn index_is_valid(index: u32) -> bool { 393 392 // A `struct pci_dev` owns an array of resources with at most `PCI_NUM_RESOURCES` entries. 394 393 index < bindings::PCI_NUM_RESOURCES ··· 412 409 } 413 410 414 411 impl<Ctx: device::DeviceContext> Device<Ctx> { 412 + #[inline] 415 413 fn as_raw(&self) -> *mut bindings::pci_dev { 416 414 self.0.get() 417 415 } ··· 586 582 } 587 583 588 584 /// Enable bus-mastering for this device. 585 + #[inline] 589 586 pub fn set_master(&self) { 590 587 // SAFETY: `self.as_raw` is guaranteed to be a pointer to a valid `struct pci_dev`. 591 588 unsafe { bindings::pci_set_master(self.as_raw()) };