[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251215025444.65544-1-boqun.feng@gmail.com>
Date: Mon, 15 Dec 2025 11:54:44 +0900
From: Boqun Feng <boqun.feng@...il.com>
To: Danilo Krummrich <dakr@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>
Cc: Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Joel Fernandes <joelagnelf@...dia.com>,
linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: [PATCH] PCI: Provide pci_free_irq_vectors() for CONFIG_PCI=n
Commit 473b9f331718 ("rust: pci: fix build failure when CONFIG_PCI_MSI
is disabled") fixed a build error by providing rust helpers when
CONFIG_PCI_MSI=n. However the rust helpers rely on the
pci_alloc_irq_vectors() function is defined, which is not true when
CONFIG_PCI=n. There are multiple ways to fix this, e.g. a possible fix
could be just remove the calling of pci_alloc_irq_vectors() since it's
empty when CONFIG_PCI_MSI=n anyway. However, since PCI irq APIs, such as
pci_alloc_irq_vectors(), are already defined even when CONFIG_PCI=n, the
more reasonable fix is to define pci_alloc_irq_vectors() when
CONFIG_PCI=n and this aligns with the situations of other primitives as
well.
Fixes: 473b9f331718 ("rust: pci: fix build failure when CONFIG_PCI_MSI is disabled")
Signed-off-by: Boqun Feng <boqun.feng@...il.com>
---
I hit a build error without this:
../rust/helpers/pci.c:36:2: error: call to undeclared function 'pci_free_irq_vectors'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
36 | pci_free_irq_vectors(dev);
| ^
../rust/helpers/pci.c:36:2: note: did you mean 'pci_alloc_irq_vectors'?
../include/linux/pci.h:2208:1: note: 'pci_alloc_irq_vectors' declared here
2208 | pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
| ^
1 error generated.
when ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --arch arm64 --kconfig_add CONFIG_RUST=y rust_doctests_kernel
include/linux/pci.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 864775651c6f..b5cc0c2b9906 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2210,6 +2210,10 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
{
return -ENOSPC;
}
+
+static inline void pci_free_irq_vectors(struct pci_dev *dev)
+{
+}
#endif /* CONFIG_PCI */
/* Include architecture-dependent settings and functions */
--
2.51.0
Powered by blists - more mailing lists