Re: [PATCH 02/17] rust: pci: expose the whole interrupt vector allocation
From: Danilo Krummrich
Date: Sun Aug 09 2026 - 09:27:54 EST
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/DKKG2QM3YJYB.Z2H2B2UXJ75N@xxxxxxxxxx/