Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] rust: pci: missing #[inline] on DeviceEnableGuard::drop() --
commit 74e19693f9a2d2ce6a2ed986dc5fdc9a88535014 Author: Maurice Hieronymus <[email protected]> rust: pci: rework device enabling API This commit replaces Device::enable_device_mem() with Device::enable_device(), returning a DeviceEnableGuard<'a> that calls pci_disable_device() on drop to keep the PCI device enable count balanced. It also updates the nova-core driver to store the guard in NovaCore. Link: https://lore.kernel.org/rust-for-linux/[email protected] > diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs > index 769d01d234296..75efd5c5ee97f 100644 > --- a/rust/kernel/pci.rs > +++ b/rust/kernel/pci.rs > @@ -469,6 +469,25 @@ pub fn pci_class(&self) -> Class { > } > } > > +/// A guard that keeps the device's I/O and memory resources enabled. > +/// > +/// # Invariants > +/// > +/// The device's enable count was incremented once for this guard; dropping > the guard decrements > +/// it again. > +#[must_use = "if unused, the device will be immediately disabled"] > +pub struct DeviceEnableGuard<'a> { > + dev: &'a Device<device::Bound>, > +} > + > +impl Drop for DeviceEnableGuard<'_> { > + fn drop(&mut self) { > + // SAFETY: `self.dev.as_raw()` is a valid pointer to a `struct > pci_dev`, and by the type > + // invariant this guard holds one increment of the device's enable > count. > + unsafe { bindings::pci_disable_device(self.dev.as_raw()) }; > + } > +} [Severity: Low] This isn't a bug, but since DeviceEnableGuard::drop() in rust/kernel/pci.rs is a small non-generic abstraction method in the kernel crate that forwards directly to bindings::pci_disable_device() when a DeviceEnableGuard is dropped on driver unbind or probe error unwind, should it be marked with #[inline] to allow cross-crate inlining into drivers (matching Device::enable_device() below and IrqVectorRegistration::drop() in rust/kernel/pci/irq.rs)? -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=2
