linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers
@ 2021-07-04 14:32 Sergey Shtylyov
  2021-07-04 14:35 ` [PATCH v2 1/5] i2c: hix5hd2: fix IRQ check Sergey Shtylyov
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Sergey Shtylyov @ 2021-07-04 14:32 UTC (permalink / raw)
  To: linux-i2c
  Cc: Qii Wang, Matthias Brugger, linux-arm-kernel, linux-mediatek,
	linux-samsung-soc, George Cherian

Here are 5 patches against the 'i2c/for-current' branch of Wolfram's 'linux.git' repo.
The affected drivers call platform_get_irq() but mis-interprete its result -- they consider
IRQ0 as error and (sometimes) the real error codes as valid IRQs... :-/

[1/5] i2c: hix5hd2: fix IRQ check
[2/5] i2c: mt65xx: fix IRQ check
[3/5] i2c: pmcmsp: fix IRQ check
[4/5] i2c: s3c2410: fix IRQ check
[5/5] i2c: xlp9xx: fix main IRQ check

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

* [PATCH v2 1/5] i2c: hix5hd2: fix IRQ check
  2021-07-04 14:32 [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
@ 2021-07-04 14:35 ` Sergey Shtylyov
  2021-08-17 20:10   ` Wolfram Sang
  2021-07-04 14:38 ` [PATCH v2 2/5] i2c: mt65xx: " Sergey Shtylyov
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: Sergey Shtylyov @ 2021-07-04 14:35 UTC (permalink / raw)
  To: linux-i2c

Iff platform_get_irq() returns 0, the driver's probe() method will return 0
early (as if the method's call was successful).  Let's consider IRQ0 valid
for simplicity -- devm_request_irq() can always override that decision...

Fixes: 15ef27756b23 ("i2c: hix5hd2: add i2c controller driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

Index: linux/drivers/i2c/busses/i2c-hix5hd2.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-hix5hd2.c
+++ linux/drivers/i2c/busses/i2c-hix5hd2.c
@@ -413,7 +413,7 @@ static int hix5hd2_i2c_probe(struct plat
 		return PTR_ERR(priv->regs);
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0)
+	if (irq < 0)
 		return irq;
 
 	priv->clk = devm_clk_get(&pdev->dev, NULL);

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

* [PATCH v2 2/5] i2c: mt65xx: fix IRQ check
  2021-07-04 14:32 [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
  2021-07-04 14:35 ` [PATCH v2 1/5] i2c: hix5hd2: fix IRQ check Sergey Shtylyov
@ 2021-07-04 14:38 ` Sergey Shtylyov
  2021-08-17 20:09   ` Wolfram Sang
  2021-08-25 21:00   ` Wolfram Sang
  2021-07-04 14:41 ` [PATCH v2 3/5] i2c: pmcmsp: " Sergey Shtylyov
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 17+ messages in thread
From: Sergey Shtylyov @ 2021-07-04 14:38 UTC (permalink / raw)
  To: linux-i2c; +Cc: Qii Wang, Matthias Brugger, linux-arm-kernel, linux-mediatek

Iff platform_get_irq() returns 0, the driver's probe() method will return 0
early (as if the method's call was successful).  Let's consider IRQ0 valid
for simplicity -- devm_request_irq() can always override that decision...

Fixes: ce38815d39ea ("I2C: mediatek: Add driver for MediaTek I2C controller")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

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

Index: linux/drivers/i2c/busses/i2c-mt65xx.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-mt65xx.c
+++ linux/drivers/i2c/busses/i2c-mt65xx.c
@@ -1211,7 +1211,7 @@ static int mtk_i2c_probe(struct platform
 		return PTR_ERR(i2c->pdmabase);
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0)
+	if (irq < 0)
 		return irq;
 
 	init_completion(&i2c->msg_complete);

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

* [PATCH v2 3/5] i2c: pmcmsp: fix IRQ check
  2021-07-04 14:32 [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
  2021-07-04 14:35 ` [PATCH v2 1/5] i2c: hix5hd2: fix IRQ check Sergey Shtylyov
  2021-07-04 14:38 ` [PATCH v2 2/5] i2c: mt65xx: " Sergey Shtylyov
@ 2021-07-04 14:41 ` Sergey Shtylyov
  2021-08-17 20:08   ` Wolfram Sang
  2021-07-04 14:45 ` [PATCH v2 4/5] i2c: s3c2410: " Sergey Shtylyov
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: Sergey Shtylyov @ 2021-07-04 14:41 UTC (permalink / raw)
  To: linux-i2c

The driver's probe() method is written as if platform_get_irq() returns 0
on error, while actually it returns a negative error code (with all the
other values considered valid IRQs).  Rewrite the driver's IRQ checking
code to pass the positive IRQ #s to request_irq() and use polling mode
when platform_get_irq() returns negative error code (or IRQ0)...

Fixes: 1b144df1d7d6 ("i2c: New PMC MSP71xx TWI bus driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
Changes in version 2:
- fixed the IRQ validity check, assigning the result of platform_get_irq() call
  to the 'rc' variable first;
- merging the code enforcing the polling mode on bad IRQ in one place (after
  calling request_irq() and handling its result);
- removed explicit check for the deferred probe, fixed up the patch description
  accordingly;
- removed the dashes in the patch subject;
- refreshed the patch.

drivers/i2c/busses/i2c-pmcmsp.c |    8 +++++---
 drivers/i2c/busses/i2c-pmcmsp.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Index: linux/drivers/i2c/busses/i2c-pmcmsp.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-pmcmsp.c
+++ linux/drivers/i2c/busses/i2c-pmcmsp.c
@@ -291,8 +291,9 @@ static int pmcmsptwi_probe(struct platfo
 	}
 
 	/* request the irq */
-	pmcmsptwi_data.irq = platform_get_irq(pldev, 0);
-	if (pmcmsptwi_data.irq) {
+	rc = platform_get_irq(pldev, 0);
+	pmcmsptwi_data.irq = rc;
+	if (rc > 0) {
 		rc = request_irq(pmcmsptwi_data.irq, &pmcmsptwi_interrupt,
 				 IRQF_SHARED, pldev->name, &pmcmsptwi_data);
 		if (rc == 0) {
@@ -312,9 +313,14 @@ static int pmcmsptwi_probe(struct platfo
 				"Could not assign TWI IRQ handler "
 				"to irq %d (continuing with poll)\n",
 				pmcmsptwi_data.irq);
-			pmcmsptwi_data.irq = 0;
 		}
 	}
+	/*
+	 * We only get here with a negative rc if either platform_get_irq() or
+	 * request_irq() call has failed; we have to enforce the polling mode...
+	 */
+	if (rc < 0)
+		pmcmsptwi_data.irq = 0;
 
 	init_completion(&pmcmsptwi_data.wait);
 	mutex_init(&pmcmsptwi_data.lock);

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

* [PATCH v2 4/5] i2c: s3c2410: fix IRQ check
  2021-07-04 14:32 [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
                   ` (2 preceding siblings ...)
  2021-07-04 14:41 ` [PATCH v2 3/5] i2c: pmcmsp: " Sergey Shtylyov
@ 2021-07-04 14:45 ` Sergey Shtylyov
  2021-07-05  7:46   ` Krzysztof Kozlowski
  2021-08-17 20:08   ` Wolfram Sang
  2021-07-04 14:47 ` [PATCH v2 5/5] i2c: xlp9xx: fix main " Sergey Shtylyov
  2021-08-11 20:12 ` [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
  5 siblings, 2 replies; 17+ messages in thread
From: Sergey Shtylyov @ 2021-07-04 14:45 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-samsung-soc, Krzysztof Kozlowski, linux-arm-kernel

Iff platform_get_irq() returns 0, the driver's probe() method will return 0
early (as if the method's call was successful).  Let's consider IRQ0 valid
for simplicity -- devm_request_irq() can always override that decision...

Fixes: 2bbd681ba2b ("i2c-s3c2410: Change IRQ to be plain integer.")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

Index: linux/drivers/i2c/busses/i2c-s3c2410.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-s3c2410.c
+++ linux/drivers/i2c/busses/i2c-s3c2410.c
@@ -1137,7 +1137,7 @@ static int s3c24xx_i2c_probe(struct plat
 	 */
 	if (!(i2c->quirks & QUIRK_POLL)) {
 		i2c->irq = ret = platform_get_irq(pdev, 0);
-		if (ret <= 0) {
+		if (ret < 0) {
 			dev_err(&pdev->dev, "cannot find IRQ\n");
 			clk_unprepare(i2c->clk);
 			return ret;



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

* [PATCH v2 5/5] i2c: xlp9xx: fix main IRQ check
  2021-07-04 14:32 [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
                   ` (3 preceding siblings ...)
  2021-07-04 14:45 ` [PATCH v2 4/5] i2c: s3c2410: " Sergey Shtylyov
@ 2021-07-04 14:47 ` Sergey Shtylyov
  2021-08-17 20:13   ` Wolfram Sang
  2021-08-25 21:05   ` Wolfram Sang
  2021-08-11 20:12 ` [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
  5 siblings, 2 replies; 17+ messages in thread
From: Sergey Shtylyov @ 2021-07-04 14:47 UTC (permalink / raw)
  To: linux-i2c; +Cc: George Cherian

Iff platform_get_irq() returns 0 for the main IRQ, the driver's probe()
method will return 0 early (as if the method's call was successful).
Let's consider IRQ0 valid for simplicity -- devm_request_irq() can always
override that decision...

Fixes: 2bbd681ba2b ("i2c: xlp9xx: Driver for Netlogic XLP9XX/5XX I2C controller")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

Index: linux/drivers/i2c/busses/i2c-xlp9xx.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-xlp9xx.c
+++ linux/drivers/i2c/busses/i2c-xlp9xx.c
@@ -517,7 +517,7 @@ static int xlp9xx_i2c_probe(struct platf
 		return PTR_ERR(priv->base);
 
 	priv->irq = platform_get_irq(pdev, 0);
-	if (priv->irq <= 0)
+	if (priv->irq < 0)
 		return priv->irq;
 	/* SMBAlert irq */
 	priv->alert_data.irq = platform_get_irq(pdev, 1);

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

* Re: [PATCH v2 4/5] i2c: s3c2410: fix IRQ check
  2021-07-04 14:45 ` [PATCH v2 4/5] i2c: s3c2410: " Sergey Shtylyov
@ 2021-07-05  7:46   ` Krzysztof Kozlowski
  2021-08-17 20:08   ` Wolfram Sang
  1 sibling, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-05  7:46 UTC (permalink / raw)
  To: Sergey Shtylyov, linux-i2c; +Cc: linux-samsung-soc, linux-arm-kernel

On 04/07/2021 16:45, Sergey Shtylyov wrote:
> Iff platform_get_irq() returns 0, the driver's probe() method will return 0
> early (as if the method's call was successful).  Let's consider IRQ0 valid
> for simplicity -- devm_request_irq() can always override that decision...
> 
> Fixes: 2bbd681ba2b ("i2c-s3c2410: Change IRQ to be plain integer.")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
>  drivers/i2c/busses/i2c-s3c2410.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof

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

* Re: [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers
  2021-07-04 14:32 [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
                   ` (4 preceding siblings ...)
  2021-07-04 14:47 ` [PATCH v2 5/5] i2c: xlp9xx: fix main " Sergey Shtylyov
@ 2021-08-11 20:12 ` Sergey Shtylyov
  2021-08-11 20:14   ` Sergey Shtylyov
  5 siblings, 1 reply; 17+ messages in thread
From: Sergey Shtylyov @ 2021-08-11 20:12 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang
  Cc: Qii Wang, Matthias Brugger, linux-arm-kernel, linux-mediatek,
	linux-samsung-soc, George Cherian

On 7/4/21 5:32 PM, Sergey Shtylyov wrote:

> Here are 5 patches against the 'i2c/for-current' branch of Wolfram's 'linux.git' repo.
> The affected drivers call platform_get_irq() but mis-interprete its result -- they consider
> IRQ0 as error and (sometimes) the real error codes as valid IRQs... :-/
> 
> [1/5] i2c: hix5hd2: fix IRQ check
> [2/5] i2c: mt65xx: fix IRQ check
> [3/5] i2c: pmcmsp: fix IRQ check
> [4/5] i2c: s3c2410: fix IRQ check
> [5/5] i2c: xlp9xx: fix main IRQ check

   Wolfram, hat's up with this series (its status in the patchwork is still "new")? 

MBR, Sergey

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

* Re: [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers
  2021-08-11 20:12 ` [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
@ 2021-08-11 20:14   ` Sergey Shtylyov
  0 siblings, 0 replies; 17+ messages in thread
From: Sergey Shtylyov @ 2021-08-11 20:14 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang
  Cc: Qii Wang, Matthias Brugger, linux-arm-kernel, linux-mediatek,
	linux-samsung-soc, George Cherian

On 8/11/21 11:12 PM, Sergey Shtylyov wrote:

>> Here are 5 patches against the 'i2c/for-current' branch of Wolfram's 'linux.git' repo.
>> The affected drivers call platform_get_irq() but mis-interprete its result -- they consider
>> IRQ0 as error and (sometimes) the real error codes as valid IRQs... :-/
>>
>> [1/5] i2c: hix5hd2: fix IRQ check
>> [2/5] i2c: mt65xx: fix IRQ check
>> [3/5] i2c: pmcmsp: fix IRQ check
>> [4/5] i2c: s3c2410: fix IRQ check
>> [5/5] i2c: xlp9xx: fix main IRQ check
> 
>    Wolfram, hat's up with this series (its status in the patchwork is still "new")? 

   What's, of/c. :-)

MBR, Sergey


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

* Re: [PATCH v2 3/5] i2c: pmcmsp: fix IRQ check
  2021-07-04 14:41 ` [PATCH v2 3/5] i2c: pmcmsp: " Sergey Shtylyov
@ 2021-08-17 20:08   ` Wolfram Sang
  0 siblings, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2021-08-17 20:08 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-i2c

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]

On Sun, Jul 04, 2021 at 05:41:50PM +0300, Sergey Shtylyov wrote:
> The driver's probe() method is written as if platform_get_irq() returns 0
> on error, while actually it returns a negative error code (with all the
> other values considered valid IRQs).  Rewrite the driver's IRQ checking
> code to pass the positive IRQ #s to request_irq() and use polling mode
> when platform_get_irq() returns negative error code (or IRQ0)...
> 
> Fixes: 1b144df1d7d6 ("i2c: New PMC MSP71xx TWI bus driver")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

The driver has been removed meanwhile.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 4/5] i2c: s3c2410: fix IRQ check
  2021-07-04 14:45 ` [PATCH v2 4/5] i2c: s3c2410: " Sergey Shtylyov
  2021-07-05  7:46   ` Krzysztof Kozlowski
@ 2021-08-17 20:08   ` Wolfram Sang
  1 sibling, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2021-08-17 20:08 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: linux-i2c, linux-samsung-soc, Krzysztof Kozlowski, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Sun, Jul 04, 2021 at 05:45:25PM +0300, Sergey Shtylyov wrote:
> Iff platform_get_irq() returns 0, the driver's probe() method will return 0
> early (as if the method's call was successful).  Let's consider IRQ0 valid
> for simplicity -- devm_request_irq() can always override that decision...
> 
> Fixes: 2bbd681ba2b ("i2c-s3c2410: Change IRQ to be plain integer.")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 2/5] i2c: mt65xx: fix IRQ check
  2021-07-04 14:38 ` [PATCH v2 2/5] i2c: mt65xx: " Sergey Shtylyov
@ 2021-08-17 20:09   ` Wolfram Sang
  2021-08-20  1:46     ` Qii Wang
  2021-08-25 21:00   ` Wolfram Sang
  1 sibling, 1 reply; 17+ messages in thread
From: Wolfram Sang @ 2021-08-17 20:09 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: linux-i2c, Qii Wang, Matthias Brugger, linux-arm-kernel, linux-mediatek

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

On Sun, Jul 04, 2021 at 05:38:45PM +0300, Sergey Shtylyov wrote:
> Iff platform_get_irq() returns 0, the driver's probe() method will return 0
> early (as if the method's call was successful).  Let's consider IRQ0 valid
> for simplicity -- devm_request_irq() can always override that decision...
> 
> Fixes: ce38815d39ea ("I2C: mediatek: Add driver for MediaTek I2C controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

Qii Wang, do you like this patch?

> 
> ---
>  drivers/i2c/busses/i2c-mt65xx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux/drivers/i2c/busses/i2c-mt65xx.c
> ===================================================================
> --- linux.orig/drivers/i2c/busses/i2c-mt65xx.c
> +++ linux/drivers/i2c/busses/i2c-mt65xx.c
> @@ -1211,7 +1211,7 @@ static int mtk_i2c_probe(struct platform
>  		return PTR_ERR(i2c->pdmabase);
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (irq <= 0)
> +	if (irq < 0)
>  		return irq;
>  
>  	init_completion(&i2c->msg_complete);

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 1/5] i2c: hix5hd2: fix IRQ check
  2021-07-04 14:35 ` [PATCH v2 1/5] i2c: hix5hd2: fix IRQ check Sergey Shtylyov
@ 2021-08-17 20:10   ` Wolfram Sang
  0 siblings, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2021-08-17 20:10 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-i2c

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]

On Sun, Jul 04, 2021 at 05:35:54PM +0300, Sergey Shtylyov wrote:
> Iff platform_get_irq() returns 0, the driver's probe() method will return 0
> early (as if the method's call was successful).  Let's consider IRQ0 valid
> for simplicity -- devm_request_irq() can always override that decision...
> 
> Fixes: 15ef27756b23 ("i2c: hix5hd2: add i2c controller driver")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 5/5] i2c: xlp9xx: fix main IRQ check
  2021-07-04 14:47 ` [PATCH v2 5/5] i2c: xlp9xx: fix main " Sergey Shtylyov
@ 2021-08-17 20:13   ` Wolfram Sang
  2021-08-25 21:05   ` Wolfram Sang
  1 sibling, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2021-08-17 20:13 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-i2c, George Cherian

[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]

On Sun, Jul 04, 2021 at 05:47:54PM +0300, Sergey Shtylyov wrote:
> Iff platform_get_irq() returns 0 for the main IRQ, the driver's probe()
> method will return 0 early (as if the method's call was successful).
> Let's consider IRQ0 valid for simplicity -- devm_request_irq() can always
> override that decision...
> 
> Fixes: 2bbd681ba2b ("i2c: xlp9xx: Driver for Netlogic XLP9XX/5XX I2C controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 

George, do you like this patch?

> ---
>  drivers/i2c/busses/i2c-xlp9xx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux/drivers/i2c/busses/i2c-xlp9xx.c
> ===================================================================
> --- linux.orig/drivers/i2c/busses/i2c-xlp9xx.c
> +++ linux/drivers/i2c/busses/i2c-xlp9xx.c
> @@ -517,7 +517,7 @@ static int xlp9xx_i2c_probe(struct platf
>  		return PTR_ERR(priv->base);
>  
>  	priv->irq = platform_get_irq(pdev, 0);
> -	if (priv->irq <= 0)
> +	if (priv->irq < 0)
>  		return priv->irq;
>  	/* SMBAlert irq */
>  	priv->alert_data.irq = platform_get_irq(pdev, 1);

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 2/5] i2c: mt65xx: fix IRQ check
  2021-08-17 20:09   ` Wolfram Sang
@ 2021-08-20  1:46     ` Qii Wang
  0 siblings, 0 replies; 17+ messages in thread
From: Qii Wang @ 2021-08-20  1:46 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Sergey Shtylyov, linux-i2c, Matthias Brugger, linux-arm-kernel,
	linux-mediatek

On Tue, 2021-08-17 at 22:09 +0200, Wolfram Sang wrote:
> On Sun, Jul 04, 2021 at 05:38:45PM +0300, Sergey Shtylyov wrote:
> > Iff platform_get_irq() returns 0, the driver's probe() method will return 0
> > early (as if the method's call was successful).  Let's consider IRQ0 valid
> > for simplicity -- devm_request_irq() can always override that decision...
> > 
> > Fixes: ce38815d39ea ("I2C: mediatek: Add driver for MediaTek I2C controller")
> > Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
> 
> Qii Wang, do you like this patch?
> 

It is ok.
Reviewed-by: Qii Wang <qii.wang@mediatek.com>

Thanks

> > 
> > ---
> >  drivers/i2c/busses/i2c-mt65xx.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Index: linux/drivers/i2c/busses/i2c-mt65xx.c
> > ===================================================================
> > --- linux.orig/drivers/i2c/busses/i2c-mt65xx.c
> > +++ linux/drivers/i2c/busses/i2c-mt65xx.c
> > @@ -1211,7 +1211,7 @@ static int mtk_i2c_probe(struct platform
> >  		return PTR_ERR(i2c->pdmabase);
> >  
> >  	irq = platform_get_irq(pdev, 0);
> > -	if (irq <= 0)
> > +	if (irq < 0)
> >  		return irq;
> >  
> >  	init_completion(&i2c->msg_complete);


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

* Re: [PATCH v2 2/5] i2c: mt65xx: fix IRQ check
  2021-07-04 14:38 ` [PATCH v2 2/5] i2c: mt65xx: " Sergey Shtylyov
  2021-08-17 20:09   ` Wolfram Sang
@ 2021-08-25 21:00   ` Wolfram Sang
  1 sibling, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2021-08-25 21:00 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: linux-i2c, Qii Wang, Matthias Brugger, linux-arm-kernel, linux-mediatek

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

On Sun, Jul 04, 2021 at 05:38:45PM +0300, Sergey Shtylyov wrote:
> Iff platform_get_irq() returns 0, the driver's probe() method will return 0
> early (as if the method's call was successful).  Let's consider IRQ0 valid
> for simplicity -- devm_request_irq() can always override that decision...
> 
> Fixes: ce38815d39ea ("I2C: mediatek: Add driver for MediaTek I2C controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
> 

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 5/5] i2c: xlp9xx: fix main IRQ check
  2021-07-04 14:47 ` [PATCH v2 5/5] i2c: xlp9xx: fix main " Sergey Shtylyov
  2021-08-17 20:13   ` Wolfram Sang
@ 2021-08-25 21:05   ` Wolfram Sang
  1 sibling, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2021-08-25 21:05 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-i2c, George Cherian

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

On Sun, Jul 04, 2021 at 05:47:54PM +0300, Sergey Shtylyov wrote:
> Iff platform_get_irq() returns 0 for the main IRQ, the driver's probe()
> method will return 0 early (as if the method's call was successful).
> Let's consider IRQ0 valid for simplicity -- devm_request_irq() can always
> override that decision...
> 
> Fixes: 2bbd681ba2b ("i2c: xlp9xx: Driver for Netlogic XLP9XX/5XX I2C controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-08-25 21:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-04 14:32 [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
2021-07-04 14:35 ` [PATCH v2 1/5] i2c: hix5hd2: fix IRQ check Sergey Shtylyov
2021-08-17 20:10   ` Wolfram Sang
2021-07-04 14:38 ` [PATCH v2 2/5] i2c: mt65xx: " Sergey Shtylyov
2021-08-17 20:09   ` Wolfram Sang
2021-08-20  1:46     ` Qii Wang
2021-08-25 21:00   ` Wolfram Sang
2021-07-04 14:41 ` [PATCH v2 3/5] i2c: pmcmsp: " Sergey Shtylyov
2021-08-17 20:08   ` Wolfram Sang
2021-07-04 14:45 ` [PATCH v2 4/5] i2c: s3c2410: " Sergey Shtylyov
2021-07-05  7:46   ` Krzysztof Kozlowski
2021-08-17 20:08   ` Wolfram Sang
2021-07-04 14:47 ` [PATCH v2 5/5] i2c: xlp9xx: fix main " Sergey Shtylyov
2021-08-17 20:13   ` Wolfram Sang
2021-08-25 21:05   ` Wolfram Sang
2021-08-11 20:12 ` [PATCH v2 0/5] Correctly handle plaform_get_irq()'s result in the i2C drivers Sergey Shtylyov
2021-08-11 20:14   ` 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).