Skip to content

Commit 473b9f3

Browse files
author
Danilo Krummrich
committed
rust: pci: fix build failure when CONFIG_PCI_MSI is disabled
When CONFIG_PCI_MSI is disabled pci_alloc_irq_vectors() and pci_free_irq_vectors() are defined as inline functions and hence require a Rust helper. error[E0425]: cannot find function `pci_alloc_irq_vectors` in crate `bindings` --> rust/kernel/pci/irq.rs:144:23 | 144 | ...s::pci_alloc_irq_vectors(dev.as_raw(), min_vecs, max_vecs, irq_types.as_raw()) | ^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `pci_irq_vector` | ::: .../rust/bindings/bindings_helpers_generated.rs:1197:5 | 1197 | pub fn pci_irq_vector(pdev: *mut pci_dev, nvec: ffi::c_uint) -> ffi::c_int; | --------------------------------------------------------------------------- similarly named function `pci_irq_vector` defined here error[E0425]: cannot find function `pci_free_irq_vectors` in crate `bindings` --> rust/kernel/pci/irq.rs:170:28 | 170 | unsafe { bindings::pci_free_irq_vectors(self.dev.as_raw()) }; | ^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `pci_irq_vector` | ::: .../rust/bindings/bindings_helpers_generated.rs:1197:5 | 1197 | pub fn pci_irq_vector(pdev: *mut pci_dev, nvec: ffi::c_uint) -> ffi::c_int; | --------------------------------------------------------------------------- similarly named function `pci_irq_vector` defined here error: aborting due to 2 previous errors Fix this by adding the corresponding helpers. Fixes: 340ccc9 ("rust: pci: Allocate and manage PCI interrupt vectors") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202512012238.YgVvRRUx-lkp@intel.com/ Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com> Link: https://patch.msgid.link/20251202210501.40998-1-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent d3666c1 commit 473b9f3

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

rust/helpers/pci.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,21 @@ bool rust_helper_dev_is_pci(const struct device *dev)
2323
}
2424

2525
#ifndef CONFIG_PCI_MSI
26+
int rust_helper_pci_alloc_irq_vectors(struct pci_dev *dev,
27+
unsigned int min_vecs,
28+
unsigned int max_vecs,
29+
unsigned int flags)
30+
{
31+
return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
32+
}
33+
34+
void rust_helper_pci_free_irq_vectors(struct pci_dev *dev)
35+
{
36+
pci_free_irq_vectors(dev);
37+
}
38+
2639
int rust_helper_pci_irq_vector(struct pci_dev *pdev, unsigned int nvec)
2740
{
2841
return pci_irq_vector(pdev, nvec);
2942
}
30-
3143
#endif

0 commit comments

Comments
 (0)