Re: [PATCH v7 3/3] drm/tyr: add Job IRQ handling
From: Danilo Krummrich
Date: Thu Nov 26 2026 - 06:45:45 EST
On Mon Nov 23, 2026 at 3:58 PM CET, Laura Nao wrote:
> +/// Requests a threaded IRQ registration for the Job IRQ.
> +///
> +/// # Safety
> +///
> +/// Callers must not `mem::forget()` the resulting registration or otherwise prevent its
> +/// [`Drop`] implementation from running.
> +pub(crate) unsafe fn job_irq_init<'a>(
> + pdev: &'a platform::Device<Bound>,
> + hw: Arc<HwGate<'a>>,
> + events: Arc<JobIrqEvents>,
> +) -> Result<Pin<KBox<TyrIrqRegistration<'a, JobIrq>>>> {
> + let job_irq = JobIrq { events };
> + // Ensure interrupt sources are disabled until the handler is registered.
> + job_irq.clear_mask(hw.access().iomem());
> +
> + // SAFETY: The caller guarantees the resulting registration will not be leaked.
> + unsafe { TyrIrqRegistration::request(pdev, c"job", job_irq, hw) }
> +}
You could implement a constructor in an impl TyrIrqRegistration<'a, JobIrq>
block instead, which is think is cleaner than a free standing function.