Re: [PATCH v3 1/8] PCI/IOV: Return unsigned int from pci_sriov_get_totalvfs()
From: Alexandre Courbot
Date: Wed Jul 08 2026 - 09:56:20 EST
On Wed Jul 1, 2026 at 3:26 PM JST, Zhi Wang wrote:
> pci_sriov_get_totalvfs() reports a VF count, not an errno-style
> status. It returns 0 when SR-IOV is unavailable or the device is not a
> PF, and otherwise returns the PF's driver_max_VFs value.
>
> driver_max_VFs is stored as a u16 in struct pci_sriov. It is derived
> from the SR-IOV TotalVFs field or from a driver-provided limit, so the
> implementation cannot return a negative value.
>
> Change the declaration, CONFIG_PCI_IOV stub, and implementation to
> return unsigned int.
>
> Suggested-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Cc: David Laight <david.laight.linux@xxxxxxxxx>
> Cc: Gary Guo <gary@xxxxxxxxxxx>
> Cc: linux-pci@xxxxxxxxxxxxxxx
> Link: https://lore.kernel.org/all/DJHPRE4TGGT8.BUTMYOF5YE05@xxxxxxxxxx/
> Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx>
FWIW,
Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>