Re: [PATCH v2] drm/tyr: add Job IRQ handling

Laura Nao <[email protected]> Wed, 29 Jul 2026 15:25:22 +0200
Newsgroups org.kernel.vger.rust-for-linux,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Ewan,

On 7/29/26 14:12, Ewan Chorynski wrote:
> On Wed, Jul 29, 2026 at 11:58:29AM +0200, Laura Nao wrote:
>> [...]
>> +
>> +impl<T: TyrIrqTrait> TyrIrq<T> {
>> +    pub(crate) fn request<'a>(
>> +        pdev: &'a platform::Device<Bound>,
>> +        name: &'static CStr,
>> +        irq: T,
>> +    ) -> Result<impl PinInit<ThreadedRegistration<'a, Self>, Error> + 'a>
>> +    where
>> +        T: 'a,
>> +    {
>> +        let handler = try_pin_init!(Self {
>> +            irq,
>> +            _pin: PhantomPinned,
>> +        });
>> +
>> +        // SAFETY: The resulting `PinInit` is not leaked, it is consumed by the caller to
>> +        // initialize a pinned `ThreadedRegistration`.
>> +        Ok(unsafe { pdev.request_threaded_irq_by_name(Flags::SHARED, name, name, handler) })
>
> I think your `request` function should be unsafe with the same
> requirements as `request_threaded_irq_by_name`, otherwise how do you
> guarantee that this safety justification holds ?
>

Oh right, I somehow forgot to propagate the safety requirement up the
call chain. That means job_irq_init() also needs to become unsafe, as
it's just a wrapper around request().

I'll address this in the next revision.

Thanks for the heads up!

Best,

Laura

>> +    }
>> +}
>> [...]