linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH0/2] Fix deferred probing in the I2C bus drivers
@ 2021-04-17 20:57 Sergey Shtylyov
  2021-04-17 20:58 ` [PATCH 1/2] i2c: iop3xx: fix deferred probing Sergey Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sergey Shtylyov @ 2021-04-17 20:57 UTC (permalink / raw)
  To: linux-i2c, Ard Biesheuvel

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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] i2c: iop3xx: fix deferred probing
  2021-04-17 20:57 [PATCH0/2] Fix deferred probing in the I2C bus drivers Sergey Shtylyov
@ 2021-04-17 20:58 ` Sergey Shtylyov
  2021-04-17 20:59 ` [PATCH 2/2] i2c: synquacer: " Sergey Shtylyov
  2021-05-28 20:57 ` [PATCH0/2] Fix deferred probing in the I2C bus drivers Sergey Shtylyov
  2 siblings, 0 replies; 6+ messages in thread
From: Sergey Shtylyov @ 2021-04-17 20:58 UTC (permalink / raw)
  To: linux-i2c

When adding the code to handle platform_get_irq*() errors in 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*()")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

---
 drivers/i2c/busses/i2c-iop3xx.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: linux/drivers/i2c/busses/i2c-iop3xx.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-iop3xx.c
+++ 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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] i2c: synquacer: fix deferred probing
  2021-04-17 20:57 [PATCH0/2] Fix deferred probing in the I2C bus drivers Sergey Shtylyov
  2021-04-17 20:58 ` [PATCH 1/2] i2c: iop3xx: fix deferred probing Sergey Shtylyov
@ 2021-04-17 20:59 ` Sergey Shtylyov
  2021-05-28 20:57 ` [PATCH0/2] Fix deferred probing in the I2C bus drivers Sergey Shtylyov
  2 siblings, 0 replies; 6+ messages in thread
From: Sergey Shtylyov @ 2021-04-17 20:59 UTC (permalink / raw)
  To: linux-i2c, Ard Biesheuvel

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")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

---
 drivers/i2c/busses/i2c-synquacer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/i2c/busses/i2c-synquacer.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-synquacer.c
+++ 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);


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH0/2] Fix deferred probing in the I2C bus drivers
  2021-04-17 20:57 [PATCH0/2] Fix deferred probing in the I2C bus drivers Sergey Shtylyov
  2021-04-17 20:58 ` [PATCH 1/2] i2c: iop3xx: fix deferred probing Sergey Shtylyov
  2021-04-17 20:59 ` [PATCH 2/2] i2c: synquacer: " Sergey Shtylyov
@ 2021-05-28 20:57 ` Sergey Shtylyov
  2021-05-30 15:53   ` Sergey Shtylyov
  2 siblings, 1 reply; 6+ messages in thread
From: Sergey Shtylyov @ 2021-05-28 20:57 UTC (permalink / raw)
  To: Sergey Shtylyov, linux-i2c, Ard Biesheuvel

Hello~

On 4/17/21 11:57 PM, Sergey Shtylyov wrote:

> 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.
> 
> [1/2] i2c: iop3xx: fix deferred probing
> [2/2] i2c: synquacer: fix deferred probing

   Please hold on with this series; I'm gonna add another patch...

MBR, Sergey

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH0/2] Fix deferred probing in the I2C bus drivers
  2021-05-28 20:57 ` [PATCH0/2] Fix deferred probing in the I2C bus drivers Sergey Shtylyov
@ 2021-05-30 15:53   ` Sergey Shtylyov
  2021-05-30 16:01     ` Sergey Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: Sergey Shtylyov @ 2021-05-30 15:53 UTC (permalink / raw)
  To: Sergey Shtylyov, linux-i2c, Ard Biesheuvel

On 5/28/21 11:57 PM, Sergey Shtylyov wrote:

[...]
>> 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.
>>
>> [1/2] i2c: iop3xx: fix deferred probing
>> [2/2] i2c: synquacer: fix deferred probing
> 
>    Please hold on with this series; I'm gonna add another patch...

   Actually, I'm unsure about drivers/i2c/busses/i2c-pca-platform.c: normally it
uses polling iff the (considered optional) IRQ can't be set up (irq < 0 returned
from platform_get_irq_optional()) then polling mode is used. I have a patch to
propaate -EPROBE_DEFER upstream but I'm not sure what is better : sefer the probe
(and potentially falling permanently iff the kernel wouldn't able to finally set
up the IRQ or to start the I2C driver in the polling mode right away. Does these
doubts even make sense? :-)

MBR, Sergey

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH0/2] Fix deferred probing in the I2C bus drivers
  2021-05-30 15:53   ` Sergey Shtylyov
@ 2021-05-30 16:01     ` Sergey Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergey Shtylyov @ 2021-05-30 16:01 UTC (permalink / raw)
  To: Sergey Shtylyov, linux-i2c, Ard Biesheuvel

On 5/30/21 6:53 PM, Sergey Shtylyov wrote:

[...]
>>> 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.
>>>
>>> [1/2] i2c: iop3xx: fix deferred probing
>>> [2/2] i2c: synquacer: fix deferred probing
>>
>>    Please hold on with this series; I'm gonna add another patch...
> 
>    Actually, I'm unsure about drivers/i2c/busses/i2c-pca-platform.c: normally it
> uses polling iff the (considered optional) IRQ can't be set up (irq < 0 returned
> from platform_get_irq_optional()) then polling mode is used.

   I started to be tautologcial, should really re-read the msgs before seding... :-)

> I have a patch to
> propaate -EPROBE_DEFER upstream but I'm not sure what is better : sefer the probe

   Propagate, of/c. :-)

> (and potentially falling permanently iff the kernel wouldn't able to finally set

   Wasn't. :-)

> up the IRQ or to start the I2C driver in the polling mode right away. Does these
> doubts even make sense? :-)

MBR, Sergey

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-30 16:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-17 20:57 [PATCH0/2] Fix deferred probing in the I2C bus drivers Sergey Shtylyov
2021-04-17 20:58 ` [PATCH 1/2] i2c: iop3xx: fix deferred probing Sergey Shtylyov
2021-04-17 20:59 ` [PATCH 2/2] i2c: synquacer: " Sergey Shtylyov
2021-05-28 20:57 ` [PATCH0/2] Fix deferred probing in the I2C bus drivers Sergey Shtylyov
2021-05-30 15:53   ` Sergey Shtylyov
2021-05-30 16:01     ` Sergey Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).