diff mbox series

[5.10.y-cip] usb: gadget: udc: renesas_usb3: Fix RZ/V2M {modprobe,bind} error

Message ID 20230703132113.353419-1-biju.das.jz@bp.renesas.com (mailing list archive)
State Accepted
Delegated to: Nobuhiro Iwamatsu
Headers show
Series [5.10.y-cip] usb: gadget: udc: renesas_usb3: Fix RZ/V2M {modprobe,bind} error | expand

Commit Message

Biju Das July 3, 2023, 1:21 p.m. UTC
commit 3e6ac852fbc71a234de24b5455086f6b98d3d958 upstream.

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

The reason is, it is trying to register an interrupt handler for the same
IRQ twice. The devm_request_irq() was called with the parent device.
So the interrupt handler won't be unregistered when the usb3-peri device
is unbound.

Fix this issue by replacing "parent dev"->"dev" as the irq resource
is managed by this driver.

Fixes: 9cad72dfc556 ("usb: gadget: Add support for RZ/V2M USB3DRD driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Message-ID: <20230530161720.179927-1-biju.das.jz@bp.renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/usb/gadget/udc/renesas_usb3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nobuhiro Iwamatsu July 4, 2023, 4:34 a.m. UTC | #1
Hi Biju,

> -----Original Message-----
> From: Biju Das <biju.das.jz@bp.renesas.com>
> Sent: Monday, July 3, 2023 10:21 PM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 ○DITC□
> DIT○OST) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> <fabrizio.castro.jz@renesas.com>
> Subject: [PATCH 5.10.y-cip] usb: gadget: udc: renesas_usb3: Fix RZ/V2M
> {modprobe,bind} error
> 
> commit 3e6ac852fbc71a234de24b5455086f6b98d3d958 upstream.
> 
> 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
> 
> The reason is, it is trying to register an interrupt handler for the same IRQ twice.
> The devm_request_irq() was called with the parent device.
> So the interrupt handler won't be unregistered when the usb3-peri device is
> unbound.
> 
> Fix this issue by replacing "parent dev"->"dev" as the irq resource is managed
> by this driver.
> 
> Fixes: 9cad72dfc556 ("usb: gadget: Add support for RZ/V2M USB3DRD driver")
> Cc: stable <stable@kernel.org>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Message-ID: <20230530161720.179927-1-biju.das.jz@bp.renesas.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/usb/gadget/udc/renesas_usb3.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/renesas_usb3.c
> b/drivers/usb/gadget/udc/renesas_usb3.c
> index a1e8669536d8..bcbdb6b2a8d4 100644
> --- a/drivers/usb/gadget/udc/renesas_usb3.c
> +++ b/drivers/usb/gadget/udc/renesas_usb3.c
> @@ -2898,9 +2898,9 @@ static int renesas_usb3_probe(struct
> platform_device *pdev)
>  		struct rzv2m_usb3drd *ddata =
> dev_get_drvdata(pdev->dev.parent);
> 
>  		usb3->drd_reg = ddata->reg;
> -		ret = devm_request_irq(ddata->dev, ddata->drd_irq,
> +		ret = devm_request_irq(&pdev->dev, ddata->drd_irq,
>  				       renesas_usb3_otg_irq, 0,
> -				       dev_name(ddata->dev), usb3);
> +				       dev_name(&pdev->dev), usb3);
>  		if (ret < 0)
>  			return ret;
>  	}
> --
> 2.25.1

I reviewed this series. Looks fine to me.
I can apply, if there are no comments and issues.

Test: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/919946031
Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

Best regards,
  Nobuhiro
Nobuhiro Iwamatsu July 6, 2023, 12:19 a.m. UTC | #2
Hi all,

> -----Original Message-----
> From: cip-dev@lists.cip-project.org <cip-dev@lists.cip-project.org> On
> Behalf Of Nobuhiro Iwamatsu
> Sent: Tuesday, July 4, 2023 1:35 PM
> To: biju.das.jz@bp.renesas.com; cip-dev@lists.cip-project.org; pavel@denx.de
> Cc: fabrizio.castro.jz@renesas.com
> Subject: Re: [cip-dev] [PATCH 5.10.y-cip] usb: gadget: udc: renesas_usb3: Fix
> RZ/V2M {modprobe,bind} error
> 
> Hi Biju,
> 
> > -----Original Message-----
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> > Sent: Monday, July 3, 2023 10:21 PM
> > To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 ○DITC□
> > DIT○OST) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> > <pavel@denx.de>
> > Cc: Biju Das <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > <fabrizio.castro.jz@renesas.com>
> > Subject: [PATCH 5.10.y-cip] usb: gadget: udc: renesas_usb3: Fix RZ/V2M
> > {modprobe,bind} error
> >
> > commit 3e6ac852fbc71a234de24b5455086f6b98d3d958 upstream.
> >
> > 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
> >
> > The reason is, it is trying to register an interrupt handler for the same IRQ
> twice.
> > The devm_request_irq() was called with the parent device.
> > So the interrupt handler won't be unregistered when the usb3-peri
> > device is unbound.
> >
> > Fix this issue by replacing "parent dev"->"dev" as the irq resource is
> > managed by this driver.
> >
> > Fixes: 9cad72dfc556 ("usb: gadget: Add support for RZ/V2M USB3DRD
> > driver")
> > Cc: stable <stable@kernel.org>
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Message-ID: <20230530161720.179927-1-biju.das.jz@bp.renesas.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  drivers/usb/gadget/udc/renesas_usb3.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/udc/renesas_usb3.c
> > b/drivers/usb/gadget/udc/renesas_usb3.c
> > index a1e8669536d8..bcbdb6b2a8d4 100644
> > --- a/drivers/usb/gadget/udc/renesas_usb3.c
> > +++ b/drivers/usb/gadget/udc/renesas_usb3.c
> > @@ -2898,9 +2898,9 @@ static int renesas_usb3_probe(struct
> > platform_device *pdev)
> >  		struct rzv2m_usb3drd *ddata =
> > dev_get_drvdata(pdev->dev.parent);
> >
> >  		usb3->drd_reg = ddata->reg;
> > -		ret = devm_request_irq(ddata->dev, ddata->drd_irq,
> > +		ret = devm_request_irq(&pdev->dev, ddata->drd_irq,
> >  				       renesas_usb3_otg_irq, 0,
> > -				       dev_name(ddata->dev), usb3);
> > +				       dev_name(&pdev->dev), usb3);
> >  		if (ret < 0)
> >  			return ret;
> >  	}
> > --
> > 2.25.1
> 
> I reviewed this series. Looks fine to me.
> I can apply, if there are no comments and issues.
> 
> Test:
> https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/919946031
> Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
> 
Applied, thanks.

Best regards,
  Nobuhiro
Pavel Machek July 7, 2023, 3:35 p.m. UTC | #3
Hi!

> > > 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
> > >
> > > The reason is, it is trying to register an interrupt handler for the same IRQ
> > twice.
> > > The devm_request_irq() was called with the parent device.
> > > So the interrupt handler won't be unregistered when the usb3-peri
> > > device is unbound.
> > >
> > > Fix this issue by replacing "parent dev"->"dev" as the irq resource is
> > > managed by this driver.

> > I reviewed this series. Looks fine to me.
> > I can apply, if there are no comments and issues.
> > 
> > Test:
> > https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/919946031
> > Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
> > 
> Applied, thanks.

Looks ok to me, too.

Thanks and best regards,
								Pavel
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index a1e8669536d8..bcbdb6b2a8d4 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2898,9 +2898,9 @@  static int renesas_usb3_probe(struct platform_device *pdev)
 		struct rzv2m_usb3drd *ddata = dev_get_drvdata(pdev->dev.parent);
 
 		usb3->drd_reg = ddata->reg;
-		ret = devm_request_irq(ddata->dev, ddata->drd_irq,
+		ret = devm_request_irq(&pdev->dev, ddata->drd_irq,
 				       renesas_usb3_otg_irq, 0,
-				       dev_name(ddata->dev), usb3);
+				       dev_name(&pdev->dev), usb3);
 		if (ret < 0)
 			return ret;
 	}