include/linux/pci.h | 4 ++++ 1 file changed, 4 insertions(+)
From: Liang Jie <liangjie@lixiang.com>
When building with CONFIG_PCI=n, clang reports:
In file included from rust/helpers/helpers.c:40:
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]
pci_free_irq_vectors(dev);
^
rust/helpers/pci.c:36:2: note: did you mean 'pci_alloc_irq_vectors'?
include/linux/pci.h:2161:1: note: 'pci_alloc_irq_vectors' declared here
pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
^
1 error generated.
The root cause is that include/linux/pci.h provides inline stubs for
pci_alloc_irq_vectors() in the CONFIG_PCI=n fallback, but does not provide
any declaration for pci_free_irq_vectors(). As a result, callers that invoke
pci_free_irq_vectors() under CONFIG_PCI=n (e.g. Rust PCI helpers) hit an
implicit function declaration error with clang.
Fix this by adding a no-op pci_free_irq_vectors() stub to the CONFIG_PCI=n
fallback section of include/linux/pci.h, keeping the alloc/free API pair
consistent and avoiding implicit declaration build failures.
Fixes: 473b9f331718 ("rust: pci: fix build failure when CONFIG_PCI_MSI is disabled")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512220740.4Kexm4dW-lkp@intel.com/
Signed-off-by: Liang Jie <liangjie@lixiang.com>
---
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.25.1
On 22.12.25 04:44, Liang Jie wrote:
> From: Liang Jie <liangjie@lixiang.com>
>
> When building with CONFIG_PCI=n, clang reports:
>
> In file included from rust/helpers/helpers.c:40:
> 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]
> pci_free_irq_vectors(dev);
> ^
> rust/helpers/pci.c:36:2: note: did you mean 'pci_alloc_irq_vectors'?
> include/linux/pci.h:2161:1: note: 'pci_alloc_irq_vectors' declared here
> pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> ^
> 1 error generated.
>
> The root cause is that include/linux/pci.h provides inline stubs for
> pci_alloc_irq_vectors() in the CONFIG_PCI=n fallback, but does not provide
> any declaration for pci_free_irq_vectors(). As a result, callers that invoke
> pci_free_irq_vectors() under CONFIG_PCI=n (e.g. Rust PCI helpers) hit an
> implicit function declaration error with clang.
>
> Fix this by adding a no-op pci_free_irq_vectors() stub to the CONFIG_PCI=n
> fallback section of include/linux/pci.h, keeping the alloc/free API pair
> consistent and avoiding implicit declaration build failures.
>
> Fixes: 473b9f331718 ("rust: pci: fix build failure when CONFIG_PCI_MSI is disabled")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202512220740.4Kexm4dW-lkp@intel.com/
> Signed-off-by: Liang Jie <liangjie@lixiang.com>
> ---
> 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 */
We have this from Boqun already
https://lore.kernel.org/rust-for-linux/20251215025444.65544-1-boqun.feng@gmail.com/
?
Dirk
On 22 Dec 2025 08:02:44 +0100, Dirk Behme wrote: > On 22.12.25 04:44, Liang Jie wrote: > > From: Liang Jie <liangjie@lixiang.com> > > > > When building with CONFIG_PCI=n, clang reports: > > > > .... > > > > /* Include architecture-dependent settings and functions */ > > We have this from Boqun already > > https://lore.kernel.org/rust-for-linux/20251215025444.65544-1-boqun.feng@gmail.com/ > > ? > > Dirk Hi Dirk, Sorry, I missed Boqun's earlier patch: https://lore.kernel.org/rust-for-linux/20251215025444.65544-1-boqun.feng@gmail.com/ It addresses the same issue. Please ignore my patch. Thanks, Liang
© 2016 - 2026 Red Hat, Inc.