Skip to contentSkip to conversation

Fix deferred probing in the USB host/gadget drivers

PATCH Superseded Sergey Shtylyov 2 participants 14 messages Dec 8, 2021 – Dec 9, 2021

Subsystems (9)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fix deferred probing in the USB host/gadget drivers

Here are 10 patches against the 'usb-linus' branch of Greg KH's 'usb.git' repo. The affected host/gadget drivers call platform_get_irq() but override its result in case of error which prevents the deferred probing from working. These patches now logically depend on the previously posted patch:

https://marc.info/?l=linux-kernel&m=163623041902285

Sergey Shtylyov (10):
usb: gadget: udc: bcm63xx: fix deferred probing
usb: gadget: udc: gr: fix deferred probing
usb: gadget: udc: pxa25x: fix deferred probing
usb: host: ehci-atmel: fix deferred probing
usb: host: ehci-orion: fix deferred probing
usb: host: ehci-sh: fix deferred probing
usb: host: ohci-da8xx: fix deferred probing
usb: host: ohci-nxp: fix deferred probing
usb: host: ohci-omap: fix deferred probing
usb: musb: core: fix deferred probing

 drivers/usb/gadget/udc/bcm63xx_udc.c | 8 ++++++--
 drivers/usb/gadget/udc/gr_udc.c      | 8 ++++----
 drivers/usb/gadget/udc/pxa25x_udc.c  | 2 +-
 drivers/usb/host/ehci-atmel.c        | 4 ++--
 drivers/usb/host/ehci-orion.c        | 4 ++--
 drivers/usb/host/ehci-sh.c           | 4 ++--
 drivers/usb/host/ohci-da8xx.c        | 2 +-
 drivers/usb/host/ohci-nxp.c          | 2 +-
 drivers/usb/host/ohci-omap.c         | 2 +-
 drivers/usb/musb/musb_core.c         | 4 ++--
 10 files changed, 22 insertions(+), 18 deletions(-)
Signature · 1 line
2.26.3
#1 lore raw

PATCH v2 1/10 usb: gadget: udc: bcm63xx: fix deferred probing

The driver overrides the error codes returned by platform_get_irq() to -ENXIO for some strange reason, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream.

Fixes 613065e53cb1 ("usb: gadget: bcm63xx UDC driver")
---
 drivers/usb/gadget/udc/bcm63xx_udc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/bcm63xx_udc.c +6 -2
index a9f07c59fc37..2cdb07905bde 100644
@@ -2321,8 +2321,10 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
 
 	/* IRQ resource #0: control interrupt (VBUS, speed, etc.) */
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		rc = irq;
 		goto out_uninit;
+	}
 	if (devm_request_irq(dev, irq, &bcm63xx_udc_ctrl_isr, 0,
 			     dev_name(dev), udc) < 0)
 		goto report_request_failure;
@@ -2330,8 +2332,10 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
 	/* IRQ resources #1-6: data interrupts for IUDMA channels 0-5 */
 	for (i = 0; i < BCM63XX_NUM_IUDMA; i++) {
 		irq = platform_get_irq(pdev, i + 1);
-		if (irq < 0)
+		if (irq < 0) {
+			rc = irq;
 			goto out_uninit;
+		}
 		if (devm_request_irq(dev, irq, &bcm63xx_udc_data_isr, 0,
 				     dev_name(dev), &udc->iudma[i]) < 0)
 			goto report_request_failure;
Signature · 1 line
2.26.3
#2 lore raw

PATCH v2 2/10 usb: gadget: udc: gr: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes and IRQ0 returned by platform_get_irq() to -ENODEV, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream. IRQ0 is no longer returned by platform_get_irq(), so we now can safely ignore it...

Fixes 196800da39a1 ("usb: gadget: gr_udc: Use platform_get_irq instead of irq_of_parse_and_map")

---
Changes in version 2:
- updated the patch description on treating IRQ0.

 drivers/usb/gadget/udc/gr_udc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/udc/gr_udc.c +4 -4
index 4b35739d3695..4aa5246a77e5 100644
@@ -2136,15 +2136,15 @@ static int gr_probe(struct platform_device *pdev)
 		return PTR_ERR(regs);
 
 	dev->irq = platform_get_irq(pdev, 0);
-	if (dev->irq <= 0)
-		return -ENODEV;
+	if (dev->irq < 0)
+		return dev->irq;
 
 	/* Some core configurations has separate irqs for IN and OUT events */
 	dev->irqi = platform_get_irq(pdev, 1);
 	if (dev->irqi > 0) {
 		dev->irqo = platform_get_irq(pdev, 2);
-		if (dev->irqo <= 0)
-			return -ENODEV;
+		if (dev->irqo < 0)
+			return dev->irqo;
 	} else {
 		dev->irqi = 0;
 	}
Signature · 1 line
2.26.3
#3 lore raw

PATCH v2 3/10 usb: gadget: udc: pxa25x: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes returned by platform_get_irq() to -ENODEV for some strange reason, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream.

Fixes 34ebcd28235d ("pxa2xx_udc: cleanups, use platform_get_irq")
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/pxa25x_udc.c +1 -1
index 52cdfd8212d6..b38747fd3bb0 100644
@@ -2364,7 +2364,7 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return -ENODEV;
+		return irq;
 
 	dev->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dev->regs))
Signature · 7 lines
2.26.3


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw

PATCH v2 4/10 usb: host: ehci-atmel: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes and IRQ0 returned by platform_get_irq() to -ENODEV, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream. IRQ0 is no longer returned by platform_get_irq(), so we now can safely ignore it...

Fixes 501c9c0802d9 ("USB: at91: Add USB EHCI driver for at91sam9g45 series")

---
Changes in version 2:
- removed the check for IRQ0, updated the patch description accordingly.

 drivers/usb/host/ehci-atmel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-atmel.c +2 -2
index 05d41fd65f25..bc3fdb588e6b 100644
@@ -104,8 +104,8 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
 	pr_debug("Initializing Atmel-SoC USB Host Controller\n");
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0) {
-		retval = -ENODEV;
+	if (irq < 0) {
+		retval = irq;
 		goto fail_create_hcd;
 	}
 
Signature · 1 line
2.26.3
#5 lore raw

PATCH v2 5/10 usb: host: ehci-orion: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes and IRQ0 returned by platform_get_irq() to -ENODEV, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream. IRQ0 is no longer returned by platform_get_irq(), so we now can safely ignore it...

Fixes e96ffe2f9deb ("USB: add Marvell Orion USB host support")

---
Changes in version 2:
- removed the check for IRQ0, updated the patch description accordingly.

 drivers/usb/host/ehci-orion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-orion.c +2 -2
index 3626758b3e2a..36ea4febe29b 100644
@@ -222,8 +222,8 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
 	pr_debug("Initializing Orion-SoC USB Host Controller\n");
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0) {
-		err = -ENODEV;
+	if (irq < 0) {
+		err = irq;
 		goto err;
 	}
 
Signature · 1 line
2.26.3
#6 lore raw

PATCH v2 6/10 usb: host: ehci-sh: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes and IRQ0 returned by platform_get_irq() to -ENODEV, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream. IRQ0 is no longer returned by platform_get_irq(), so we now can safely ignore it...

Fixes 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq")

---
Changes in version 2:
- removed the check for IRQ0, updated the patch description accordingly.

 drivers/usb/host/ehci-sh.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-sh.c +2 -2
index c25c51d26f26..882231b5c382 100644
@@ -82,8 +82,8 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0) {
-		ret = -ENODEV;
+	if (irq < 0) {
+		ret = irq;
 		goto fail_create_hcd;
 	}
 
Signature · 1 line
2.26.3
#7 lore raw

PATCH v2 7/10 usb: host: ohci-da8xx: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes returned by platform_get_irq() to -ENODEV for some strange reason, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream.

Fixes efe7daf2231a ("USB: OHCI: DA8xx/OMAP-L1x glue layer")
---
 drivers/usb/host/ohci-da8xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ohci-da8xx.c +1 -1
index 1371b0c249ec..d1326c6ccade 100644
@@ -446,7 +446,7 @@ static int ohci_da8xx_probe(struct platform_device *pdev)
 
 	hcd_irq = platform_get_irq(pdev, 0);
 	if (hcd_irq < 0) {
-		error = -ENODEV;
+		error = hcd_irq;
 		goto err;
 	}
 
Signature · 1 line
2.26.3
#8 lore raw

PATCH v2 8/10 usb: host: ohci-nxp: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes returned by platform_get_irq() to -ENXIO for some strange reason, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream.

Fixes 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")

---
Changes in version 2:
- refreshed the patch;
- removed the eliipsis in the patch description.

 drivers/usb/host/ohci-nxp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ohci-nxp.c +1 -1
index 85878e8ad331..a84c5e714372 100644
@@ -212,7 +212,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		ret = -ENXIO;
+		ret = irq;
 		goto fail_resource;
 	}
 
Signature · 1 line
2.26.3
#9 lore raw

PATCH v2 9/10 usb: host: ohci-omap: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes returned by platform_get_irq() to -ENXIO for some strange reason, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream.

Fixes 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")

---
Changes in version 2:
- refreshed the patch.

 drivers/usb/host/ohci-omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ohci-omap.c +1 -1
index ded9738392e4..45dcf8292072 100644
@@ -306,7 +306,7 @@ static int ohci_hcd_omap_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		retval = -ENXIO;
+		retval = irq;
 		goto err3;
 	}
 	retval = usb_add_hcd(hcd, irq, 0);
Signature · 1 line
2.26.3
#10 lore raw

Re: [PATCH v2 09/10] usb: host: ohci-omap: fix deferred probing

Quoted 6 lines · Sergey Shtylyov

The driver overrides the error codes returned by platform_get_irq() to -ENXIO for some strange reason, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream.

Fixes 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")

I don't see how this Fixes commit is related to OHCI OMAP?

A.

Quoted 24 lines

---
Changes in version 2:
- refreshed the patch.

 drivers/usb/host/ohci-omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ohci-omap.c +1 -1
index ded9738392e4..45dcf8292072 100644
@@ -306,7 +306,7 @@ static int ohci_hcd_omap_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		retval = -ENXIO;
+		retval = irq;
 		goto err3;
 	}
 	retval = usb_add_hcd(hcd, irq, 0);
Signature · 1 line
2.26.3
#11 lore raw

Re: [PATCH v2 09/10] usb: host: ohci-omap: fix deferred probing

Hello!

Quoted 8 lines · Aaro Koskinen
Quoted 6 lines

The driver overrides the error codes returned by platform_get_irq() to -ENXIO for some strange reason, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream.

Fixes 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")

I don't see how this Fixes commit is related to OHCI OMAP?

Argh, I missed this! :-(
The whole series should be discarded, as the patch #8 also doesn't have the valid
Fixes: tag, and I missed to add Alan's ACKs to patches #4..#9 too... :-/

Quoted 3 lines

A.

Quoted 1 line

[...]

MBR, Sergey

#12 lore raw

PATCH v2 10/10 usb: musb: core: fix deferred probing

In reply to Sergey Shtylyov

The driver overrides the error codes returned by platform_get_irq() to -ENODEV, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream. IRQ0 is no longer returned by platform_get_irq(), so we now can safely ignore it...

Fixes 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq")

---
Changes in version 2:
- updated the patch description on treating IRQ0.

 drivers/usb/musb/musb_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb/musb_core.c +2 -2
index f7b1d5993f8c..e57abc54d12b 100644
@@ -2618,8 +2618,8 @@ static int musb_probe(struct platform_device *pdev)
 	int		irq = platform_get_irq_byname(pdev, "mc");
 	void __iomem	*base;
 
-	if (irq <= 0)
-		return -ENODEV;
+	if (irq < 0)
+		return irq;
 
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base))
Signature · 1 line
2.26.3
#13 lore raw
In reply to Sergey Shtylyov
Quoted 7 lines · Sergey Shtylyov

Here are 10 patches against the 'usb-linus' branch of Greg KH's 'usb.git' repo. The affected host/gadget drivers call platform_get_irq() but override its result in case of error which prevents the deferred probing from working. These patches now logically depend on the previously posted patch:

https://marc.info/?l=linux-kernel&m=163623041902285

Quoted 11 lines

Sergey Shtylyov (10):
usb: gadget: udc: bcm63xx: fix deferred probing
usb: gadget: udc: gr: fix deferred probing
usb: gadget: udc: pxa25x: fix deferred probing
usb: host: ehci-atmel: fix deferred probing
usb: host: ehci-orion: fix deferred probing
usb: host: ehci-sh: fix deferred probing
usb: host: ohci-da8xx: fix deferred probing
usb: host: ohci-nxp: fix deferred probing
usb: host: ohci-omap: fix deferred probing
usb: musb: core: fix deferred probing

Ignore this -- I totally forgot I had a feedback to v1. :-/

[...]

MBR, Sergey