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: Update PCI binding safety comments and add inline compiler hint

Update the safety comments to be consistent with other safety comments
in the PCI bindings. Also add an inline compiler hint.

Suggested-by: Danilo Krummrich <dakr@kernel.org>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Krzysztof Wilczyński <kwilczynski@kernel.org>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Alex Gaynor <alex.gaynor@gmail.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Gary Guo <gary@garyguo.net>
Cc: Björn Roy Baron <bjorn3_gh@protonmail.com>
Cc: Benno Lossin <lossin@kernel.org>
Cc: Andreas Hindborg <a.hindborg@kernel.org>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Trevor Gross <tmgross@umich.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Link: https://lore.kernel.org/r/20250730013417.640593-1-apopple@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Alistair Popple and committed by
Danilo Krummrich
cd58b0b1 b0d73ad1

+6 -2
+6 -2
rust/kernel/pci.rs
··· 388 388 389 389 impl Device { 390 390 /// Returns the PCI vendor ID. 391 + #[inline] 391 392 pub fn vendor_id(&self) -> u16 { 392 - // SAFETY: `self.as_raw` is a valid pointer to a `struct pci_dev`. 393 + // SAFETY: By its type invariant `self.as_raw` is always a valid pointer to a 394 + // `struct pci_dev`. 393 395 unsafe { (*self.as_raw()).vendor } 394 396 } 395 397 396 398 /// Returns the PCI device ID. 399 + #[inline] 397 400 pub fn device_id(&self) -> u16 { 398 - // SAFETY: `self.as_raw` is a valid pointer to a `struct pci_dev`. 401 + // SAFETY: By its type invariant `self.as_raw` is always a valid pointer to a 402 + // `struct pci_dev`. 399 403 unsafe { (*self.as_raw()).device } 400 404 } 401 405