[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251222034415.1384223-1-buaajxlj@163.com>
Date: Mon, 22 Dec 2025 11:44:15 +0800
From: Liang Jie <buaajxlj@....com>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>,
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>,
Danilo Krummrich <dakr@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Joel Fernandes <joelagnelf@...dia.com>,
linux-pci@...r.kernel.org (open list:PCI SUBSYSTEM),
linux-kernel@...r.kernel.org (open list),
rust-for-linux@...r.kernel.org (open list:RUST:Keyword:\b(?i:rust)\b),
llvm@...ts.linux.dev (open list:CLANG/LLVM BUILD SUPPORT:Keyword:\b(?i:clang|llvm)\b)
Cc: liangjie@...iang.com,
kernel test robot <lkp@...el.com>
Subject: [PATCH] pci: provide pci_free_irq_vectors() stub when CONFIG_PCI is disabled
From: Liang Jie <liangjie@...iang.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@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512220740.4Kexm4dW-lkp@intel.com/
Signed-off-by: Liang Jie <liangjie@...iang.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
Powered by blists - more mailing lists