Re: [PATCH v5 2/6] rust: pci: add sriov_get_totalvfs() helper

From: Alexandre Courbot

Date: Thu Jul 23 2026 - 01:32:39 EST


On Wed Jul 22, 2026 at 4:39 PM JST, Zhi Wang wrote:
> Expose pci_sriov_get_totalvfs() to Rust PCI drivers so they can query
> how many SR-IOV VFs a device supports.
>
> Use a conditional C helper because the !CONFIG_PCI_IOV version of
> pci_sriov_get_totalvfs() is a static inline function and is therefore
> not emitted into the Rust bindings. Return Option<NonZero<u16>> so Rust
> callers must handle the zero value that represents unavailable SR-IOV.
>
> Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Cc: 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>

The series looks ready to me, but we need a Ack on this patch to take it
through drm-rust-next - Danilo, does this look ok to you?