Skip to contentSkip to conversation

PCI: Provide pci_free_irq_vectors() for CONFIG_PCI=n

PATCH Applied Boqun Feng 4 participants 5 messages Dec 26, 2025 – Jan 12

Subsystems (2)
lore
Share & tools
lore

Boqun Feng

author
#0 lore raw

PATCH v2 1/1 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.

---
v1 --> v2:

* Add Reported-by from FUJITA Tomonori, kernel test robot and Liang Jie.
* Add Reviewed-by tags.

Thanks!

Liang Jie, I added you as Reported-by because of [1], if you prefer not to have that tag, feel free to let me know, thanks!

[1]: https://lore.kernel.org/rust-for-linux/[email protected]/

 include/linux/pci.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/pci.h +4 -0
index 864775651c6f..b5cc0c2b9906 100644
@@ -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 */
Signature · 1 line
2.51.0
author
#1 lore raw
Quoted 12 lines · Boqun Feng

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.

Ping ;-) Bjorn, would it be possible to take via pci tree? Thanks!

Regards,
Boqun

Quoted 46 lines

---
v1 --> v2:

* Add Reported-by from FUJITA Tomonori, kernel test robot and Liang Jie.
* Add Reviewed-by tags.

Thanks!

Liang Jie, I added you as Reported-by because of [1], if you prefer not to have that tag, feel free to let me know, thanks!

[1]: https://lore.kernel.org/rust-for-linux/[email protected]/

 include/linux/pci.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/pci.h +4 -0
index 864775651c6f..b5cc0c2b9906 100644
@@ -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 */
Signature · 1 line
2.51.0
#2 lore raw
In reply to Boqun Feng
Quoted 12 lines · Boqun Feng

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.

Quoted 12 lines

Bjorn, I just received another bug report due to this issue. Can you please pick this up for the next -rc?

If you don't have anything else to send, I can pick it up as well. :)

Thanks,
Danilo

#3 lore raw
Quoted 5 lines · Danilo Krummrich

Bjorn, I just received another bug report due to this issue. Can you please pick this up for the next -rc?

If you don't have anything else to send, I can pick it up as well. :)

Ditto!

Cheers,
Miguel

#4 lore raw
In reply to Boqun Feng
Quoted 12 lines · Boqun Feng

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.

Quoted 12 lines

Applied to pci/for-linus for v6.19, thanks!

I updated the commit log like this:

PCI: Provide pci_free_irq_vectors() stub

473b9f331718 ("rust: pci: fix build failure when CONFIG_PCI_MSI is disabled") fixed a build error by providing Rust helpers when CONFIG_PCI_MSI is not set. However the Rust helpers rely on pci_free_irq_vectors(), which is only available when CONFIG_PCI=y.

When CONFIG_PCI is not set, there is already a stub for pci_alloc_irq_vectors(). Add a similar stub for pci_free_irq_vectors().

Quoted 34 lines

---
v1 --> v2:

* Add Reported-by from FUJITA Tomonori, kernel test robot and Liang Jie.
* Add Reviewed-by tags.

Thanks!

Liang Jie, I added you as Reported-by because of [1], if you prefer not to have that tag, feel free to let me know, thanks!

[1]: https://lore.kernel.org/rust-for-linux/[email protected]/

 include/linux/pci.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/pci.h +4 -0
index 864775651c6f..b5cc0c2b9906 100644
@@ -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 */
Signature · 1 line
2.51.0