Re: [PATCH v3 1/8] PCI/IOV: Return unsigned int from pci_sriov_get_totalvfs()

"Alexandre Courbot" <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <[email protected]>
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 <[email protected]>
> Cc: Bjorn Helgaas <[email protected]>
> Cc: David Laight <[email protected]>
> Cc: Gary Guo <[email protected]>
> Cc: [email protected]
> Link: https://lore.kernel.org/all/[email protected]/
> Signed-off-by: Zhi Wang <[email protected]>

FWIW,

Reviewed-by: Alexandre Courbot <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.