linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* i2c/janitoral: drop NO_IRQ from the subsystem
@ 2009-10-22 21:11 Wolfram Sang
       [not found] ` <1256245888-25210-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2009-10-22 21:11 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ

Hello,

after having to deal with NO_IRQ confusion more than once, I decided to start a
bit of janitorial work and remove it from the i2c-subsystem. Detail for better
using 0 as "no irq" can be found here: http://lkml.org/lkml/2005/11/21/221

Regards,

   Wolfram

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

* [PATCH 1/3] i2c/mpc: drop NO_IRQ
       [not found] ` <1256245888-25210-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2009-10-22 21:11   ` Wolfram Sang
       [not found]     ` <1256245888-25210-2-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2009-10-22 21:11 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Wolfram Sang, Grant Likely,
	Ben Dooks

Drop NO_IRQ as 0 is the preferred way to describe 'no irq'
(http://lkml.org/lkml/2005/11/21/221). This change is safe, as the driver is
only used on powerpc, where NO_IRQ is 0 anyhow.

Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
---
 drivers/i2c/busses/i2c-mpc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index d325e86..7e58443 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -115,7 +115,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
 	u32 x;
 	int result = 0;
 
-	if (i2c->irq == NO_IRQ) {
+	if (!i2c->irq) {
 		while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
 			schedule();
 			if (time_after(jiffies, orig_jiffies + timeout)) {
@@ -520,7 +520,7 @@ static int __devinit fsl_i2c_probe(struct of_device *op,
 	}
 
 	i2c->irq = irq_of_parse_and_map(op->node, 0);
-	if (i2c->irq != NO_IRQ) { /* i2c->irq = NO_IRQ implies polling */
+	if (i2c->irq) { /* no i2c->irq implies polling */
 		result = request_irq(i2c->irq, mpc_i2c_isr,
 				     IRQF_SHARED, "i2c-mpc", i2c);
 		if (result < 0) {
@@ -579,7 +579,7 @@ static int __devexit fsl_i2c_remove(struct of_device *op)
 	i2c_del_adapter(&i2c->adap);
 	dev_set_drvdata(&op->dev, NULL);
 
-	if (i2c->irq != NO_IRQ)
+	if (i2c->irq)
 		free_irq(i2c->irq, i2c);
 
 	irq_dispose_mapping(i2c->irq);
-- 
1.6.5

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

* [PATCH 2/3] i2c/cpm: drop NO_IRQ
       [not found]     ` <1256245888-25210-2-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2009-10-22 21:11       ` Wolfram Sang
       [not found]         ` <1256245888-25210-3-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2010-02-16 15:59       ` [PATCH 1/3] i2c/mpc: " Grant Likely
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2009-10-22 21:11 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Wolfram Sang,
	Jochen Friedrich, Ben Dooks

Drop NO_IRQ as 0 is the preferred way to describe 'no irq'
(http://lkml.org/lkml/2005/11/21/221). This change is safe, as the driver is
only used on powerpc, where NO_IRQ is 0 anyhow.

Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Jochen Friedrich <jochen-NIgtFMG+Po8@public.gmane.org>
Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
---
 drivers/i2c/busses/i2c-cpm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 9c2e100..16948db 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -441,7 +441,7 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
 	init_waitqueue_head(&cpm->i2c_wait);
 
 	cpm->irq = of_irq_to_resource(ofdev->node, 0, NULL);
-	if (cpm->irq == NO_IRQ)
+	if (!cpm->irq)
 		return -EINVAL;
 
 	/* Install interrupt handler. */
-- 
1.6.5

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

* [PATCH 3/3] i2c/ibm-iic: drop NO_IRQ
       [not found]         ` <1256245888-25210-3-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2009-10-22 21:11           ` Wolfram Sang
       [not found]             ` <1256245888-25210-4-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2010-02-16 15:59           ` [PATCH 2/3] i2c/cpm: " Grant Likely
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2009-10-22 21:11 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Wolfram Sang, Sean MacLennan,
	Ben Dooks

Drop NO_IRQ as 0 is the preferred way to describe 'no irq'
(http://lkml.org/lkml/2005/11/21/221). This change is safe, as the driver is
only used on powerpc, where NO_IRQ is 0 anyhow.

Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Sean MacLennan <smaclennan-Qtffpm9i2AVWk0Htik3J/w@public.gmane.org>
Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
---
 drivers/i2c/busses/i2c-ibm_iic.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index b1bc6e2..2bef534 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -668,12 +668,12 @@ static int __devinit iic_request_irq(struct of_device *ofdev,
 	int irq;
 
 	if (iic_force_poll)
-		return NO_IRQ;
+		return 0;
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq == NO_IRQ) {
+	if (!irq) {
 		dev_err(&ofdev->dev, "irq_of_parse_and_map failed\n");
-		return NO_IRQ;
+		return 0;
 	}
 
 	/* Disable interrupts until we finish initialization, assumes
@@ -683,7 +683,7 @@ static int __devinit iic_request_irq(struct of_device *ofdev,
 	if (request_irq(irq, iic_handler, 0, "IBM IIC", dev)) {
 		dev_err(&ofdev->dev, "request_irq %d failed\n", irq);
 		/* Fallback to the polling mode */
-		return NO_IRQ;
+		return 0;
 	}
 
 	return irq;
@@ -719,7 +719,7 @@ static int __devinit iic_probe(struct of_device *ofdev,
 	init_waitqueue_head(&dev->wq);
 
 	dev->irq = iic_request_irq(ofdev, dev);
-	if (dev->irq == NO_IRQ)
+	if (!dev->irq)
 		dev_warn(&ofdev->dev, "using polling mode\n");
 
 	/* Board specific settings */
@@ -766,7 +766,7 @@ static int __devinit iic_probe(struct of_device *ofdev,
 	return 0;
 
 error_cleanup:
-	if (dev->irq != NO_IRQ) {
+	if (dev->irq) {
 		iic_interrupt_mode(dev, 0);
 		free_irq(dev->irq, dev);
 	}
@@ -790,7 +790,7 @@ static int __devexit iic_remove(struct of_device *ofdev)
 
 	i2c_del_adapter(&dev->adap);
 
-	if (dev->irq != NO_IRQ) {
+	if (dev->irq) {
 		iic_interrupt_mode(dev, 0);
 		free_irq(dev->irq, dev);
 	}
-- 
1.6.5

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

* Re: [PATCH 1/3] i2c/mpc: drop NO_IRQ
       [not found]     ` <1256245888-25210-2-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2009-10-22 21:11       ` [PATCH 2/3] i2c/cpm: " Wolfram Sang
@ 2010-02-16 15:59       ` Grant Likely
  1 sibling, 0 replies; 7+ messages in thread
From: Grant Likely @ 2010-02-16 15:59 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Ben Dooks

On Thu, Oct 22, 2009 at 2:11 PM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> Drop NO_IRQ as 0 is the preferred way to describe 'no irq'
> (http://lkml.org/lkml/2005/11/21/221). This change is safe, as the driver is
> only used on powerpc, where NO_IRQ is 0 anyhow.
>
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  drivers/i2c/busses/i2c-mpc.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index d325e86..7e58443 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -115,7 +115,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
>        u32 x;
>        int result = 0;
>
> -       if (i2c->irq == NO_IRQ) {
> +       if (!i2c->irq) {
>                while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
>                        schedule();
>                        if (time_after(jiffies, orig_jiffies + timeout)) {
> @@ -520,7 +520,7 @@ static int __devinit fsl_i2c_probe(struct of_device *op,
>        }
>
>        i2c->irq = irq_of_parse_and_map(op->node, 0);
> -       if (i2c->irq != NO_IRQ) { /* i2c->irq = NO_IRQ implies polling */
> +       if (i2c->irq) { /* no i2c->irq implies polling */
>                result = request_irq(i2c->irq, mpc_i2c_isr,
>                                     IRQF_SHARED, "i2c-mpc", i2c);
>                if (result < 0) {
> @@ -579,7 +579,7 @@ static int __devexit fsl_i2c_remove(struct of_device *op)
>        i2c_del_adapter(&i2c->adap);
>        dev_set_drvdata(&op->dev, NULL);
>
> -       if (i2c->irq != NO_IRQ)
> +       if (i2c->irq)
>                free_irq(i2c->irq, i2c);
>
>        irq_dispose_mapping(i2c->irq);
> --
> 1.6.5
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 2/3] i2c/cpm: drop NO_IRQ
       [not found]         ` <1256245888-25210-3-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2009-10-22 21:11           ` [PATCH 3/3] i2c/ibm-iic: " Wolfram Sang
@ 2010-02-16 15:59           ` Grant Likely
  1 sibling, 0 replies; 7+ messages in thread
From: Grant Likely @ 2010-02-16 15:59 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Ben Dooks

On Thu, Oct 22, 2009 at 2:11 PM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> Drop NO_IRQ as 0 is the preferred way to describe 'no irq'
> (http://lkml.org/lkml/2005/11/21/221). This change is safe, as the driver is
> only used on powerpc, where NO_IRQ is 0 anyhow.
>
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Jochen Friedrich <jochen-NIgtFMG+Po8@public.gmane.org>
> Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  drivers/i2c/busses/i2c-cpm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index 9c2e100..16948db 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -441,7 +441,7 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
>        init_waitqueue_head(&cpm->i2c_wait);
>
>        cpm->irq = of_irq_to_resource(ofdev->node, 0, NULL);
> -       if (cpm->irq == NO_IRQ)
> +       if (!cpm->irq)
>                return -EINVAL;
>
>        /* Install interrupt handler. */
> --
> 1.6.5
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 3/3] i2c/ibm-iic: drop NO_IRQ
       [not found]             ` <1256245888-25210-4-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-02-16 16:01               ` Grant Likely
  0 siblings, 0 replies; 7+ messages in thread
From: Grant Likely @ 2010-02-16 16:01 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Ben Dooks, Sean MacLennan

On Thu, Oct 22, 2009 at 2:11 PM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> Drop NO_IRQ as 0 is the preferred way to describe 'no irq'
> (http://lkml.org/lkml/2005/11/21/221). This change is safe, as the driver is
> only used on powerpc, where NO_IRQ is 0 anyhow.
>
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Sean MacLennan <smaclennan-Qtffpm9i2AVWk0Htik3J/w@public.gmane.org>
> Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

Ben, will you pick up this series of 3, or would you like me to merge
them through the powerpc tree?

Thanks,
g.

> ---
>  drivers/i2c/busses/i2c-ibm_iic.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index b1bc6e2..2bef534 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -668,12 +668,12 @@ static int __devinit iic_request_irq(struct of_device *ofdev,
>        int irq;
>
>        if (iic_force_poll)
> -               return NO_IRQ;
> +               return 0;
>
>        irq = irq_of_parse_and_map(np, 0);
> -       if (irq == NO_IRQ) {
> +       if (!irq) {
>                dev_err(&ofdev->dev, "irq_of_parse_and_map failed\n");
> -               return NO_IRQ;
> +               return 0;
>        }
>
>        /* Disable interrupts until we finish initialization, assumes
> @@ -683,7 +683,7 @@ static int __devinit iic_request_irq(struct of_device *ofdev,
>        if (request_irq(irq, iic_handler, 0, "IBM IIC", dev)) {
>                dev_err(&ofdev->dev, "request_irq %d failed\n", irq);
>                /* Fallback to the polling mode */
> -               return NO_IRQ;
> +               return 0;
>        }
>
>        return irq;
> @@ -719,7 +719,7 @@ static int __devinit iic_probe(struct of_device *ofdev,
>        init_waitqueue_head(&dev->wq);
>
>        dev->irq = iic_request_irq(ofdev, dev);
> -       if (dev->irq == NO_IRQ)
> +       if (!dev->irq)
>                dev_warn(&ofdev->dev, "using polling mode\n");
>
>        /* Board specific settings */
> @@ -766,7 +766,7 @@ static int __devinit iic_probe(struct of_device *ofdev,
>        return 0;
>
>  error_cleanup:
> -       if (dev->irq != NO_IRQ) {
> +       if (dev->irq) {
>                iic_interrupt_mode(dev, 0);
>                free_irq(dev->irq, dev);
>        }
> @@ -790,7 +790,7 @@ static int __devexit iic_remove(struct of_device *ofdev)
>
>        i2c_del_adapter(&dev->adap);
>
> -       if (dev->irq != NO_IRQ) {
> +       if (dev->irq) {
>                iic_interrupt_mode(dev, 0);
>                free_irq(dev->irq, dev);
>        }
> --
> 1.6.5
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

end of thread, other threads:[~2010-02-16 16:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-22 21:11 i2c/janitoral: drop NO_IRQ from the subsystem Wolfram Sang
     [not found] ` <1256245888-25210-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-22 21:11   ` [PATCH 1/3] i2c/mpc: drop NO_IRQ Wolfram Sang
     [not found]     ` <1256245888-25210-2-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-22 21:11       ` [PATCH 2/3] i2c/cpm: " Wolfram Sang
     [not found]         ` <1256245888-25210-3-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-22 21:11           ` [PATCH 3/3] i2c/ibm-iic: " Wolfram Sang
     [not found]             ` <1256245888-25210-4-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-02-16 16:01               ` Grant Likely
2010-02-16 15:59           ` [PATCH 2/3] i2c/cpm: " Grant Likely
2010-02-16 15:59       ` [PATCH 1/3] i2c/mpc: " Grant Likely

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).