* [PATCH] PCI/IOV: fix building without CONFIG_PCI_IOV
@ 2026-09-28 16:16 Arnd Bergmann
2026-09-28 22:26 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-09-28 16:16 UTC (permalink / raw)
To: Bjorn Helgaas, Logan Odell
Cc: Arnd Bergmann, Dan Williams, Ilpo Järvinen,
Jonathan Cameron, Manivannan Sadhasivam, David Matlack,
Håkon Bugge, Terry Bowman, Heiner Kallweit, linux-pci,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The newly added code dealing with virtual functions causes
a harmless build warning:
drivers/pci/probe.c: In function 'pci_class':
drivers/pci/probe.c:1902:12: error: unused variable 'rev' [-Werror=unused-variable]
Move the unused variable into the #ifdef block that uses it.
Fixes: 8a2a9fa37b81 ("PCI/IOV: Read VF config values that need not match PF")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/pci/probe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 833ce364f880..1ff07c592857 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1899,9 +1899,9 @@ int pci_cfg_space_size(struct pci_dev *dev)
static u32 pci_class(struct pci_dev *dev)
{
u32 class;
+#ifdef CONFIG_PCI_IOV
u8 rev;
-#ifdef CONFIG_PCI_IOV
if (dev->is_virtfn) {
if (pci_read_config_byte(dev, PCI_REVISION_ID, &rev))
rev = 0;
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI/IOV: fix building without CONFIG_PCI_IOV
2026-09-28 16:16 [PATCH] PCI/IOV: fix building without CONFIG_PCI_IOV Arnd Bergmann
@ 2026-09-28 22:26 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2026-09-28 22:26 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bjorn Helgaas, Logan Odell, Arnd Bergmann, Dan Williams,
Ilpo Järvinen, Jonathan Cameron, Manivannan Sadhasivam,
David Matlack, Håkon Bugge, Terry Bowman, Heiner Kallweit,
linux-pci, linux-kernel
On Mon, Sep 28, 2026 at 06:16:39PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly added code dealing with virtual functions causes
> a harmless build warning:
>
> drivers/pci/probe.c: In function 'pci_class':
> drivers/pci/probe.c:1902:12: error: unused variable 'rev' [-Werror=unused-variable]
>
> Move the unused variable into the #ifdef block that uses it.
>
> Fixes: 8a2a9fa37b81 ("PCI/IOV: Read VF config values that need not match PF")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks, I fixed this similarly:
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=virtualization
#ifdef CONFIG_PCI_IOV
- if (dev->is_virtfn)
- return dev->physfn->sriov->class;
+ if (dev->is_virtfn) {
+ u8 rev;
+
+ if (pci_read_config_byte(dev, PCI_REVISION_ID, &rev))
+ rev = 0;
+ return (dev->physfn->class << 8) | rev;
+ }
#endif
> ---
> drivers/pci/probe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 833ce364f880..1ff07c592857 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1899,9 +1899,9 @@ int pci_cfg_space_size(struct pci_dev *dev)
> static u32 pci_class(struct pci_dev *dev)
> {
> u32 class;
> +#ifdef CONFIG_PCI_IOV
> u8 rev;
>
> -#ifdef CONFIG_PCI_IOV
> if (dev->is_virtfn) {
> if (pci_read_config_byte(dev, PCI_REVISION_ID, &rev))
> rev = 0;
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-28 22:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 16:16 [PATCH] PCI/IOV: fix building without CONFIG_PCI_IOV Arnd Bergmann
2026-09-28 22:26 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®