Skip to contentSkip to conversation

Fix deferred probing in the I2C bus drivers

PATCH Superseded Sergey Shtylyov 3 participants 7 messages Aug 12, 2021 – Aug 17, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix deferred probing in the I2C bus drivers

Here are 2 patches against the 'i2c/for-current' branch of Wolfram's 'linux.git' repo. The affected drivers call platform_get_irq() but override its result in case of error which prevents the deferred probing from working.

I've dropped the patch fixing the i2c-pca-platform driver as I considered a fallback to polling better than (not guaranteed to work) deferred probing...

[1/2] i2c: iop3xx: fix deferred probing
[2/2] i2c: synquacer: fix deferred probing

#2 lore raw

PATCH v3 1/2 i2c: iop3xx: fix deferred probing

In reply to Sergey Shtylyov

When adding the code to handle platform_get_irq*() errors in the commit 489447380a29 ("[PATCH] handle errors returned by platform_get_irq*()"), the actual error code was enforced to be -ENXIO in the driver for some strange reason. This didn't matter much until the deferred probing was introduced -- which requires an actual error code to be propagated upstream from the failure site.

While fixing this, also stop overriding the errors from request_irq() to -EIO (done since the pre-git era).

Fixes 489447380a29 ("[PATCH] handle errors returned by platform_get_irq*()")

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

Changed in version 2:
- added an article and a space to the patch description;
- updated domain in the OMP email addresses.

 drivers/i2c/busses/i2c-iop3xx.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-iop3xx.c +2 -4
Index: linux/drivers/i2c/busses/i2c-iop3xx.c
===================================================================
@@ -467,16 +467,14 @@ iop3xx_i2c_probe(struct platform_device
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		ret = -ENXIO;
+		ret = irq;
 		goto unmap;
 	}
 	ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
 				pdev->name, adapter_data);
 
-	if (ret) {
-		ret = -EIO;
+	if (ret)
 		goto unmap;
-	}
 
 	memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
 	new_adapter->owner = THIS_MODULE;
Applied
#3 lore raw

Re: [PATCH v3 1/2] i2c: iop3xx: fix deferred probing

Quoted 7 lines · Sergey Shtylyov

When adding the code to handle platform_get_irq*() errors in the commit 489447380a29 ("[PATCH] handle errors returned by platform_get_irq*()"), the actual error code was enforced to be -ENXIO in the driver for some strange reason. This didn't matter much until the deferred probing was introduced -- which requires an actual error code to be propagated upstream from the failure site.

Quoted 6 lines

While fixing this, also stop overriding the errors from request_irq() to -EIO (done since the pre-git era).

Fixes 489447380a29 ("[PATCH] handle errors returned by platform_get_irq*()")

Applied to for-next, thanks!

#4 lore raw

PATCH v2 2/2 i2c: synquacer: 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...

Fixes 0d676a6c4390 ("i2c: add support for Socionext SynQuacer I2C controller")
---
 drivers/i2c/busses/i2c-synquacer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-synquacer.c +1 -1
Index: linux/drivers/i2c/busses/i2c-synquacer.c
===================================================================
@@ -578,7 +578,7 @@ static int synquacer_i2c_probe(struct pl
 
 	i2c->irq = platform_get_irq(pdev, 0);
 	if (i2c->irq < 0)
-		return -ENODEV;
+		return i2c->irq;
 
 	ret = devm_request_irq(&pdev->dev, i2c->irq, synquacer_i2c_isr,
 			       0, dev_name(&pdev->dev), i2c);
maintainer Acked-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] i2c: synquacer: fix deferred probing

Quoted 8 lines · 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...

Fixes 0d676a6c4390 ("i2c: add support for Socionext SynQuacer I2C controller")
Quoted 18 lines
---
 drivers/i2c/busses/i2c-synquacer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/i2c/busses/i2c-synquacer.c
===================================================================

drivers/i2c/busses/i2c-synquacer.c +1 -1
@@ -578,7 +578,7 @@ static int synquacer_i2c_probe(struct pl
 
        i2c->irq = platform_get_irq(pdev, 0);
        if (i2c->irq < 0)
-               return -ENODEV;
+               return i2c->irq;
 
        ret = devm_request_irq(&pdev->dev, i2c->irq, synquacer_i2c_isr,
                               0, dev_name(&pdev->dev), i2c);
Applied
#6 lore raw

Re: [PATCH v2 2/2] i2c: synquacer: fix deferred probing

In reply to Sergey Shtylyov
Quoted 8 lines · 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...

Fixes 0d676a6c4390 ("i2c: add support for Socionext SynQuacer I2C controller")

Applied to for-next, thanks!