Re: [PATCH v8 1/1] rust: pci: add extended capability and SR-IOV support

From: Zhi Wang

Date: Wed Aug 26 2026 - 07:34:12 EST


On Wed, 26 Aug 2026 20:24:52 +0900
"Alexandre Courbot" <acourbot@xxxxxxxxxx> wrote:

snip

> > +impl ExtCapId {
> > + /// Single Root I/O Virtualization.
> > + // CAST: PCI extended capability IDs are 16-bit values defined
> > by the PCIe specification.
> > + pub const SRIOV: Self = Self(bindings::PCI_EXT_CAP_ID_SRIOV as
> > u16);
>
> Coming back to comment on the conclusion: we have settled on a
> solution [1] to handle this nicely, but it is likely that your series
> will land before it. So meanwhile, please use the turbofish solution
> that I initially proposed:
>
> pub const SRIOV: Self = Self(casts::u32_into_u16::<{
> bindings::PCI_EXT_CAP_ID_SRIOV }>());
>
> While it's a mouthful, [1] does remove `u32_into_u16`, which means we
> won't miss it and will need to update the code to use `const_as!` when
> applying.
>

Thanks, I will address all the comments and re-spin it today.

> [1]
> https://lore.kernel.org/all/20260825-const_as-v1-1-1ce712225fe2@xxxxxxxxxx/
>