Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] rust: pci: signature mismatch in rust_helper_pci_domain_nr() on ppc and s390 --
commit 40ebd2410b826b9813de5dae1bbe6075723a08bc Author: John Hubbard <[email protected]> rust: pci: add domain_nr() accessor This commit adds a domain_nr() accessor to pci::Device and a corresponding rust_helper_pci_domain_nr() C helper to retrieve the PCI domain number. > diff --git a/rust/helpers/pci.c b/rust/helpers/pci.c > index a8540f90b13ce..49f2c089d2369 100644 > --- a/rust/helpers/pci.c > +++ b/rust/helpers/pci.c > @@ -7,6 +7,11 @@ __rust_helper u16 rust_helper_pci_dev_id(struct pci_dev *dev) > return PCI_DEVID(dev->bus->number, dev->devfn); > } > > +__rust_helper int rust_helper_pci_domain_nr(struct pci_dev *dev) > +{ > + return pci_domain_nr(dev->bus); > +} > + > __rust_helper resource_size_t > rust_helper_pci_resource_start(struct pci_dev *pdev, int bar) > { > diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs > index 769d01d234296..57718e48208d5 100644 > --- a/rust/kernel/pci.rs > +++ b/rust/kernel/pci.rs > @@ -408,6 +408,20 @@ pub fn dev_id(&self) -> u16 { > unsafe { bindings::pci_dev_id(self.as_raw()) } > } > > + /// Returns the PCI domain number of the bus that this device is on. > + #[inline] > + pub fn domain_nr(&self) -> u32 { > + // SAFETY: By its type invariant `self.as_raw` is always a valid > pointer to a > + // `struct pci_dev`. > + let domain_nr = unsafe { bindings::pci_domain_nr(self.as_raw()) }; [Severity: Medium] Does bindings::pci_domain_nr(self.as_raw()) fail to compile on PowerPC and s390 due to a pointer type mismatch? In rust/bindings/lib.rs, bindings_generated.rs is included after pub use super::bindings_helper::*, so any non-inline C function emitted by bindgen shadows a rust_helper_* wrapper of the same stripped name. On PowerPC (arch/powerpc/include/asm/pci.h) and s390 (arch/s390/include/asm/pci.h), pci_domain_nr() is declared as a non-inline extern function taking struct pci_bus * rather than a static inline function: arch/powerpc/include/asm/pci.h: extern int pci_domain_nr(struct pci_bus *bus); On those architectures, bindings::pci_domain_nr resolves to the C declaration expecting *mut bindings::pci_bus instead of the helper's *mut bindings::pci_dev, breaking the build when CONFIG_RUST and CONFIG_PCI are enabled. Either rust_helper_pci_domain_nr() should take struct pci_bus *bus to match the C signature (with domain_nr() passing (*self.as_raw()).bus), or the helper should use a distinct name that does not collide with C pci_domain_nr(). -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
