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

From: Marc Zyngier
Date: Mon May 29 2023 - 05:56:18 EST


On Mon, 29 May 2023 10:39:50 +0100,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
>
> Hi Marc Zyngier,
>
> Thanks for the feedback.
>
> > Subject: Re: [PATCH] usb: gadget: udc: renesas_usb3: Fix RZ/V2M
> > {modprobe,bind} error
> >
> > On Mon, 29 May 2023 09:42:34 +0100,
> > Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> > >
> > > Hi Laurent,
> > >
> > > Thanks for the feedback.
> > >
> > > > Subject: Re: [PATCH] usb: gadget: udc: renesas_usb3: Fix RZ/V2M
> > > > {modprobe,bind} error
> > > >
> > > > Hi Biju,
> > > >
> > > > Thank you for the patch.
> > > >
> > > > On Fri, May 26, 2023 at 03:36:15PM +0100, Biju Das wrote:
> > > > > Currently {modprobe, bind} after {rmmod, unbind} results in probe
> > > > failure.
> > > > >
> > > > > genirq: Flags mismatch irq 22. 00000004 (85070400.usb3drd) vs.
> > > > > 00000004 (85070400.usb3drd)
> > > > > renesas_usb3: probe of 85070000.usb3peri failed with error -16
> > > > >
> > > > > Fix this issue by replacing "parent dev"->"dev" as the irq
> > > > > resource is managed by this driver.
> > > >
> > > > If the dev pointer passed to devm_request_irq() is not the correct
> > > > one, how does it work the first time the driver is loaded ?
> > >
> > > + Marc/ Kernel.org to give some feedback on this issue
> > >
> > > I believe there may be a bug in the genirq (kernel/irq) driver.
> > > first time it works ok. Maybe this driver is caching on unload with
> > > null value and comparing with actual one (irq 22) during reload??
> > >
> > > Maybe genirq expert can comment what went wrong here??
> >
> > You get shouted at because you are registering an interrupt handler for
> > the same IRQ twice,
>
> This not true. It is registering only one IRQ, but with parent device handle.

And you're doing that *TWICE*. Once per load of this driver.

>
> and the interrupt is not configured with the SHARED
> > flag.
>
> I haven't added SHARED flag as there is only one IRQ registration.
>
> If, as I understand it, you only have a single device using this
> > interrupt, then it means your driver is not freeing its interrupt on
> > unload.
>
> You mean devm_request_irq(ddata->dev..) doesn't free the resource as
> we have unloaded only child device rather than parent.
>
> But while parent is active, why genirq is giving error during reload?
> It should show same behaviour like initial probe.

Do you understand the meaning of the "dev" parameter you pass to
devm_request_irq()?

M.

--
Without deviation from the norm, progress is not possible.