Rust for Linux List
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@gmail.com>
To: "Liang Jie" <buaajxlj@163.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	"Joel Fernandes" <joelagnelf@nvidia.com>,
	"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	"open list:RUST:Keyword:b(?i:rust)b"
	<rust-for-linux@vger.kernel.org>,
	"open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b"
	<llvm@lists.linux.dev>
Cc: liangjie@lixiang.com, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] pci: provide pci_free_irq_vectors() stub when CONFIG_PCI is disabled
Date: Mon, 22 Dec 2025 08:02:44 +0100	[thread overview]
Message-ID: <5521e98b-e12d-4af1-adcd-2dc56863f90b@gmail.com> (raw)
In-Reply-To: <20251222034415.1384223-1-buaajxlj@163.com>

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

  reply	other threads:[~2025-12-22  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-12-22  9:15   ` Liang Jie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5521e98b-e12d-4af1-adcd-2dc56863f90b@gmail.com \
    --to=dirk.behme@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=buaajxlj@163.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=joelagnelf@nvidia.com \
    --cc=justinstitt@google.com \
    --cc=liangjie@lixiang.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=lossin@kernel.org \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox