Re: [PATCH 02/17] rust: pci: expose the whole interrupt vector allocation

"Danilo Krummrich" <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Sat Aug 8, 2026 at 5:11 AM CEST, John Hubbard wrote:
> +/// An allocation of PCI interrupt vectors for a device.
> +///
> +/// [`Device::alloc_irq_vectors`] allocates the vectors and returns this handle. The vectors are
> +/// numbered `0..count`, and [`Self::vector`] resolves one of those indices to the Linux IRQ
> +/// number that delivers it.
> +///
> +/// # Invariants
> +///
> +/// `dev` has an allocation of `count` interrupt vectors.
> +#[derive(Clone, Copy)]
> +pub struct IrqAllocation<'a> {
> +    dev: &'a Device<Bound>,
> +    count: NonZero<u32>,
>  }

[...]

> @@ -128,13 +156,13 @@ impl IrqVectorRegistration {
>      /// Allocate and register IRQ vectors for the given PCI device.
>      ///
>      /// Allocates IRQ vectors and registers them with devres for automatic cleanup.
> -    /// Returns a range of valid IRQ vectors.
> +    /// Returns a handle to the allocated IRQ vectors.
>      fn register<'a>(
>          dev: &'a Device<Bound>,
>          min_vecs: u32,
>          max_vecs: u32,
>          irq_types: IrqTypes,
> -    ) -> Result<RangeInclusive<IrqVector<'a>>> {
> +    ) -> Result<IrqAllocation<'a>> {

Please see the second part in [1].

[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.