RE: [PATCH] usb: gadget: udc: renesas_usb3: Fix RZ/V2M {modprobe,bind} error

From: Biju Das
Date: Mon May 29 2023 - 09:20:30 EST


Hi Marc,

> Subject: Re: [PATCH] usb: gadget: udc: renesas_usb3: Fix RZ/V2M
> {modprobe,bind} error
>
> On Mon, 29 May 2023 11:03:27 +0100,
> Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> >
> > > Do you understand the meaning of the "dev" parameter you pass to
> > > devm_request_irq()?
> >
> > Yes, the resource is managed with particular device.
>
> So what does it tell you about the life cycle of the interrupt you
> request with the *wrong* device?

It is not *wrong* device, it just parent device, which is telling
its child to manage it.

I agree, using parent device is wrong here.

>
> > I should not use devm_request_irq here. rather should use request_irq
> > and free_irq during unload with parent device handle.
>
> No, that's just papering over the real issue. You should just get the
> driver that handles the interrupt to request it. Anything else is a
> design bug.

Got it, but I guess, by using devm_request_irq() with child device is not a design bug

In a real life situation, for eg: A parent owns a property,

Parent is thinking it is efficient to handle the property by its child
rather than him. So it can tell its child to manage the property.
The parent share the property details and child manages it efficiently.

Cheers,
Biju