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

Zhi Wang <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <20260826143333.5c911b55@inno-dell>
On Wed, 26 Aug 2026 20:24:52 +0900
"Alexandre Courbot" <[email protected]> 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/[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.