mpc i2c driver, compare to NO_IRQ instead of zero
Subsystems (2)
PATCH 1/1 mpc i2c driver, compare to NO_IRQ instead of zero
Alter the mpc i2c driver to use the NO_IRQ symbol instead of the constant zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on powerpc so the checks against zero are not correct.
---
drivers/i2c/busses/i2c-mpc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-mpc.c +5 -5
@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {schedule ();
@@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) { result = -ENXIO ; goto fail_get_irq; }
@@ -344,7 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR
@@ -367,7 +367,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);
@@ -384,7 +384,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Ben, do you approve of this? How should error be checked for, is <NO_IRQ right? The current code in the kernel looks to be broken because of these checks, the ppc build is wrong and powerpc polled mode doesn't work.
Quoted 65 lines · Jon Smirl
Alter the mpc i2c driver to use the
NO_IRQsymbol instead of the constant zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on powerpc so the checks against zero are not correct.Signed-off-by Jon Smirl <[email protected]>---
drivers/i2c/busses/i2c-mpc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-mpc.c +5
-5@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {schedule ();@@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) { result = -ENXIO ; goto fail_get_irq; }@@ -344,7 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR@@ -367,7 +367,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);@@ -384,7 +384,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Signature · 2 lines
Jon Smirl [email protected]
Quoted 4 lines · Jon Smirl
Ben, do you approve of this? How should error be checked for, is <
NO_IRQright? The current code in the kernel looks to be broken because of these checks, the ppc build is wrong and powerpc polled mode doesn't work.
== 0 should work on powerpc since NO_IRQ is defined to be 0 there no ?
Anyway, using the symbolic constant is always nicer I suppose.
Ben.
Quoted 58 lines · Jon Smirl
Quoted 57 lines
Alter the mpc i2c driver to use the
NO_IRQsymbol instead of the constant zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on powerpc so the checks against zero are not correct.Signed-off-by Jon Smirl <[email protected]>---
drivers/i2c/busses/i2c-mpc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-mpc.c +5
-5@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {schedule ();@@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) { result = -ENXIO ; goto fail_get_irq; }@@ -344,7 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR@@ -367,7 +367,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);@@ -384,7 +384,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);
Quoted 10 lines
Quoted 8 lines
drivers/i2c/busses/i2c-mpc.c +0
-0iounmap (i2c->base);_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 4 lines · Jon Smirl
Ben, do you approve of this? How should error be checked for, is <
NO_IRQright? The current code in the kernel looks to be broken because of these checks, the ppc build is wrong and powerpc polled mode doesn't work.== 0 should work on powerpc since
NO_IRQis defined to be 0 there no ?
The driver being patched is used in both the powerpc and ppc builds.
Quoted 75 lines
Anyway, using the symbolic constant is always nicer I suppose.
Ben.
Quoted 68 lines · Jon Smirl
Quoted 65 lines
Alter the mpc i2c driver to use the
NO_IRQsymbol instead of the constant zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on powerpc so the checks against zero are not correct.Signed-off-by Jon Smirl <[email protected]>---
drivers/i2c/busses/i2c-mpc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-mpc.c +5
-5@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {schedule ();@@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) { result = -ENXIO ; goto fail_get_irq; }@@ -344,7 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR@@ -367,7 +367,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);@@ -384,7 +384,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Signature · 7 lines
Jon Smirl [email protected] _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
Any final objections to this patch? When these were changed to 0 instead of NO_IRQ it should have broken polling mode on ppc. ppc would treat polling mode, NO_IRQ=-1, as an error.
On powerpc this change is a NOP since NO_IRQ=0.
Quoted 65 lines · Jon Smirl
Alter the mpc i2c driver to use the
NO_IRQsymbol instead of the constant zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on powerpc so the checks against zero are not correct.Signed-off-by Jon Smirl <[email protected]>---
drivers/i2c/busses/i2c-mpc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-mpc.c +5
-5@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {schedule ();@@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) { result = -ENXIO ; goto fail_get_irq; }@@ -344,7 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR@@ -367,7 +367,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);@@ -384,7 +384,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Signature · 7 lines
Jon Smirl [email protected] _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
Hi Jon,
Quoted 4 lines · Jon Smirl
Alter the mpc i2c driver to use the
NO_IRQsymbol instead of the constant zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on powerpc so the checks against zero are not correct.
Using NO_IRQ sounds good, just one question:
Quoted 22 lines
Signed-off-by Jon Smirl <[email protected]>---
drivers/i2c/busses/i2c-mpc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-mpc.c +1
-1@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {schedule ();
drivers/i2c/busses/i2c-mpc.c static int fsl_i2c_probe(struct platform_device *pdev) · line 332
Quoted 5 lines
drivers/i2c/busses/i2c-mpc.c +1
-1@@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) {
I am skeptical about this one. Can platform_get_irq() really return NO_IRQ? I thought that the IRQ resource would be plain missing if the device has no IRQ, so I would expect:
i2c->irq = platform_get_irq(pdev, 0); if (i2c->irq < 0) i2c->irq = NO_IRQ; /* Use polling */
Testing against NO_IRQ suggests that devices with no IRQ would still have an IRQ resource defined and explicitly set to NO_IRQ. Sounds weird to me. Can you please clarify this point?
For what it's worth, no other kernel driver checks for irq < NO_IRQ. They all check for irq < 0 after calling platform_get_irq().
Quoted 22 lines
drivers/i2c/busses/i2c-mpc.c +2
-2result = -ENXIO ; goto fail_get_irq; }@@ -344,7 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR@@ -367,7 +367,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);
drivers/i2c/busses/i2c-mpc.c static int fsl_i2c_remove(struct platform_device *pdev) · line 390
Quoted 8 lines
drivers/i2c/busses/i2c-mpc.c +1
-1@@ -384,7 +384,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);
The rest looks good.
Signature · 6 lines
Jean Delvare _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
Hi Jon,
Quoted 76 lines · Jean Delvare
Quoted 4 lines · Jon Smirl
Alter the mpc i2c driver to use the
NO_IRQsymbol instead of the constant zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on powerpc so the checks against zero are not correct.Using
NO_IRQsounds good, just one question:Quoted 22 lines
Signed-off-by Jon Smirl <[email protected]>---
drivers/i2c/busses/i2c-mpc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-mpc.c +1
-1@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {schedule ();drivers/i2c/busses/i2c-mpc.c static int fsl_i2c_probe(struct platform_device *pdev) · line 332
Quoted 5 lines
drivers/i2c/busses/i2c-mpc.c +1
-1@@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) {I am skeptical about this one. Can
platform_get_irq()really returnNO_IRQ? I thought that the IRQ resource would be plain missing if the device has no IRQ, so I would expect:i2c->irq = platform_get_irq(pdev, 0); if (i2c->irq < 0) i2c->irq = NO_IRQ; /* Use polling */Testing against
NO_IRQsuggests that devices with no IRQ would still have an IRQ resource defined and explicitly set toNO_IRQ. Sounds weird to me. Can you please clarify this point?For what it's worth, no other kernel driver checks for irq <
NO_IRQ. They all check for irq < 0 after callingplatform_get_irq().Quoted 25 lines
drivers/i2c/busses/i2c-mpc.c +2
-2result = -ENXIO ; goto fail_get_irq; }@@ -344,7 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR@@ -367,7 +367,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);@@ -384,7 +384,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL );
Quoted 7 lines
drivers/i2c/busses/i2c-mpc.c static int fsl_i2c_remove(struct platform_device *pdev) · line 390
Quoted 5 lines
drivers/i2c/busses/i2c-mpc.c +1
-1-if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);The rest looks good.
Any news about this patch? I had a question above which is left unanswered. If you want this patch merged in 2.6.26 you'll have to be quick.
Signature · 1 line
Jean Delvare
Quoted 10 lines · Jean Delvare
drivers/i2c/busses/i2c-mpc.c static int fsl_i2c_probe(struct platform_device *pdev) · line 332
Quoted 3 lines
i2c->irq = platform_get_irq(pdev, 0);drivers/i2c/busses/i2c-mpc.c +1
-1-if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) {I am skeptical about this one. Can
platform_get_irq()really return
NO_IRQ? I thought that the IRQ resource would be plain missing if the device has no IRQ, so I would expect:
Quoted 8 lines
i2c->irq = platform_get_irq(pdev, 0); if (i2c->irq < 0) i2c->irq = NO_IRQ; /* Use polling */Testing against
NO_IRQsuggests that devices with no IRQ would still have an IRQ resource defined and explicitly set toNO_IRQ. Sounds weird to me. Can you please clarify this point?
Your fix is correct. I'm not sure polling worked in the original driver.
Quoted 42 lines
For what it's worth, no other kernel driver checks for irq <
NO_IRQ. They all check for irq < 0 after callingplatform_get_irq().Quoted 22 lines
result = -ENXIO; goto fail_get_irq; }drivers/i2c/busses/i2c-mpc.c +2
-2@@ -344,7 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR@@ -367,7 +367,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);drivers/i2c/busses/i2c-mpc.c static int fsl_i2c_remove(struct platform_device *pdev) · line 390
Quoted 8 lines
drivers/i2c/busses/i2c-mpc.c +1
-1@@ -384,7 +384,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);The rest looks good.
--
Jean Delvare
Signature · 2 lines
Jon Smirl [email protected]
Hi Jon,
Quoted 14 lines · Jon Smirl
Quoted 13 lines · Jean Delvare
drivers/i2c/busses/i2c-mpc.c static int fsl_i2c_probe(struct platform_device *pdev) · line 332
Quoted 3 lines
i2c->irq = platform_get_irq(pdev, 0);drivers/i2c/busses/i2c-mpc.c +1
-1-if (i2c->irq <0 ) { +if (i2c->irq <NO_IRQ ) {I am skeptical about this one. Can
platform_get_irq()really return
NO_IRQ? I thought that the IRQ resource would be plain missing if the device has no IRQ, so I would expect:i2c->irq = platform_get_irq(pdev, 0); if (i2c->irq < 0)
Quoted 7 lines
Quoted 5 lines
i2c->irq = NO_IRQ; /* Use polling */Testing against
NO_IRQsuggests that devices with no IRQ would still have an IRQ resource defined and explicitly set toNO_IRQ. Sounds weird to me. Can you please clarify this point?Your fix is correct. I'm not sure polling worked in the original driver.
OK, can you send an updated patch then?
Thanks.
Quoted 7 lines
Quoted 7 lines
For what it's worth, no other kernel driver checks for irq <
NO_IRQ. They all check for irq < 0 after callingplatform_get_irq().Quoted 3 lines
result = -ENXIO; goto fail_get_irq; }
Signature · 6 lines
Jean Delvare _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
New version with your fix.
drivers/i2c/busses/i2c-mpc.c +0 -0
@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned
timeout, int writing)
u32 x;
int result = 0;
- if (i2c->irq == 0)
+ if (i2c->irq == NO_IRQ)
{
while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
schedule();
@@ -329,10 +329,9 @@ static int fsl_i2c_probe(struct platform_device *pdev)
return -ENOMEM;
i2c->irq = platform_get_irq(pdev, 0);
- if (i2c->irq < 0) {
- result = -ENXIO;
- goto fail_get_irq;
- }
+ if (i2c->irq < 0)
+ i2c->irq = NO_IRQ; /* Use polling */
+
i2c->flags = pdata->device_flags;
init_waitqueue_head(&i2c->queue);
@@ -344,7 +343,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)
goto fail_map;
}
- if (i2c->irq != 0)
+ if (i2c->irq != NO_IRQ)
if ((result = request_irq(i2c->irq, mpc_i2c_isr,
IRQF_SHARED, "i2c-mpc", i2c)) < 0) {
printk(KERN_ERR
@@ -367,7 +366,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)
return result;
fail_add:
- if (i2c->irq != 0)
+ if (i2c->irq != NO_IRQ)
free_irq(i2c->irq, i2c);
fail_irq:
iounmap(i2c->base);
@@ -384,7 +383,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)
i2c_del_adapter(&i2c->adap);
platform_set_drvdata(pdev, NULL);
- if (i2c->irq != 0)
+ if (i2c->irq != NO_IRQ)
free_irq(i2c->irq, i2c);
iounmap(i2c->base);
Signature · 2 lines
Jon Smirl [email protected]
Hi Jon,
drivers/i2c/busses/i2c-mpc.c static int i2c_wait(struct mpc_i2c *i2c, unsigned · line 99
Quoted 8 lines · Jon Smirl
New version with your fix.
drivers/i2c/busses/i2c-mpc.c +0
-0@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
Long lines folded, patch doesn't apply...
Quoted 9 lines
drivers/i2c/busses/i2c-mpc.c +1
-1u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {drivers/i2c/busses/i2c-mpc.c +0
-0schedule ();
drivers/i2c/busses/i2c-mpc.c static int fsl_i2c_probe(struct platform_device *pdev) · line 334
Quoted 10 lines
drivers/i2c/busses/i2c-mpc.c +3
-4@@ -329,10 +329,9 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { - result = -ENXIO ; - goto fail_get_irq; - } +if (i2c->irq <0 ) + i2c->irq =NO_IRQ ;/* Use polling */ +
After this change, label fail_get_irq is unused so you should remove it. gcc should have told you, didn't it?
Quoted 32 lines
drivers/i2c/busses/i2c-mpc.c +3
-3i2c->flags = pdata->device_flags;init_waitqueue_head (&i2c->queue);@@ -344,7 +343,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR@@ -367,7 +366,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base);@@ -384,7 +383,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);
Signature · 1 line
Jean Delvare
I attached the diff file. I had forgot that I renamed the file so it wasn't getting compiled. I compiled it this time. I've made too many other changes to it to test this version on my current hardware.
Signature · 2 lines
Jon Smirl [email protected]
drivers/i2c/busses/i2c-mpc.c +7 -9
@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)u32 x;int result =0 ; -if (i2c->irq ==0 ) +if (i2c->irq ==NO_IRQ ) {while (!(readb (i2c->base +MPC_I2C_SR ) &CSR_MIF )) {schedule ();
@@ -329,10 +329,9 @@ static int fsl_i2c_probe(struct platform_device *pdev)return -ENOMEM ; i2c->irq =platform_get_irq (pdev,0 ); -if (i2c->irq <0 ) { - result = -ENXIO ; - goto fail_get_irq; - } +if (i2c->irq <0 ) + i2c->irq =NO_IRQ ;/* Use polling */ + i2c->flags = pdata->device_flags;init_waitqueue_head (&i2c->queue);
@@ -344,7 +343,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) goto fail_map; } -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )if ((result =request_irq (i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c)) <0 ) { printk(KERN_ERR
@@ -367,12 +366,11 @@ static int fsl_i2c_probe(struct platform_device *pdev)return result; fail_add: -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c); fail_irq:iounmap (i2c->base); fail_map: - fail_get_irq:kfree (i2c);return result; };
@@ -384,7 +382,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adap);platform_set_drvdata (pdev,NULL ); -if (i2c->irq !=0 ) +if (i2c->irq !=NO_IRQ )free_irq (i2c->irq, i2c);iounmap (i2c->base);
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Jean Delvare
AppliedQuoted 3 lines · Jon Smirl
I attached the diff file. I had forgot that I renamed the file so it wasn't getting compiled. I compiled it this time. I've made too many other changes to it to test this version on my current hardware.
Applied, thanks.
Signature · 6 lines
Jean Delvare _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c