Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [PATCH] pci: provide pci_free_irq_vectors() stub when CONFIG_PCI is disabled
@ 2025-12-22  3:44 Liang Jie
  2025-12-22  7:02 ` Dirk Behme
  0 siblings, 1 reply; 3+ messages in thread
From: Liang Jie @ 2025-12-22  3:44 UTC (permalink / raw)
  To: Bjorn Helgaas, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Joel Fernandes,
	open list:PCI SUBSYSTEM, open list,
	open list:RUST:Keyword:b(?i:rust)b,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
  Cc: liangjie, kernel test robot

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pci: provide pci_free_irq_vectors() stub when CONFIG_PCI is disabled
  2025-12-22  3:44 [PATCH] pci: provide pci_free_irq_vectors() stub when CONFIG_PCI is disabled Liang Jie
@ 2025-12-22  7:02 ` Dirk Behme
  2025-12-22  9:15   ` Liang Jie
  0 siblings, 1 reply; 3+ messages in thread
From: Dirk Behme @ 2025-12-22  7:02 UTC (permalink / raw)
  To: Liang Jie, Bjorn Helgaas, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Joel Fernandes,
	open list:PCI SUBSYSTEM, open list,
	open list:RUST:Keyword:b(?i:rust)b,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
  Cc: liangjie, kernel test robot

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pci: provide pci_free_irq_vectors() stub when CONFIG_PCI is disabled
  2025-12-22  7:02 ` Dirk Behme
@ 2025-12-22  9:15   ` Liang Jie
  0 siblings, 0 replies; 3+ messages in thread
From: Liang Jie @ 2025-12-22  9:15 UTC (permalink / raw)
  To: dirk.behme
  Cc: a.hindborg, aliceryhl, bhelgaas, bjorn3_gh, boqun.feng, buaajxlj,
	dakr, gary, joelagnelf, justinstitt, liangjie, linux-kernel,
	linux-pci, lkp, llvm, lossin, morbo, nathan,
	nick.desaulniers+lkml, ojeda, rust-for-linux, tmgross

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-22  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22  3:44 [PATCH] pci: provide pci_free_irq_vectors() stub when CONFIG_PCI is disabled Liang Jie
2025-12-22  7:02 ` Dirk Behme
2025-12-22  9:15   ` Liang Jie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox