2009-09-18 14:04:18

by Jon Ringle

[permalink] [raw]
Subject: [PATCH] i2c: Move i2c request_irq so that it occurs after iop3xx_i2c_enable

If there is a pending i2c interrupt present before i2c-iop3xx initialization
then it must be cleared first before registering irq handler. Otherwise,
a hung system due to an unhandled interrupt loop may occur.

Signed-off-by: Jon Ringle <[email protected]>

---
drivers/i2c/busses/i2c-iop3xx.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index a75c75e..e6dc46d 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -471,14 +471,6 @@ iop3xx_i2c_probe(struct platform_device *pdev)
ret = -ENXIO;
goto unmap;
}
- ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
- pdev->name, adapter_data);
-
- if (ret) {
- ret = -EIO;
- goto unmap;
- }
-
memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
new_adapter->owner = THIS_MODULE;
new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
@@ -497,6 +489,14 @@ iop3xx_i2c_probe(struct platform_device *pdev)
iop3xx_i2c_reset(adapter_data);
iop3xx_i2c_enable(adapter_data);

+ ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
+ pdev->name, adapter_data);
+
+ if (ret) {
+ ret = -EIO;
+ goto unmap;
+ }
+
platform_set_drvdata(pdev, new_adapter);
new_adapter->algo_data = adapter_data;

--
tg: (74fca6a..) t/isc-31/i2c-request_irq-iop3xx_i2c_enable-reorder (depends on: b2.6.31.y)


2009-09-18 14:32:04

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH] i2c: Move i2c request_irq so that it occurs after iop3xx_i2c_enable

On Fri, 18 Sep 2009, Jon Ringle wrote:

> If there is a pending i2c interrupt present before i2c-iop3xx initialization
> then it must be cleared first before registering irq handler. Otherwise,
> a hung system due to an unhandled interrupt loop may occur.

Hi Jon,

this doesn't really qualify for trivial tree. I am adding Jean Delvare to
CC.

> Signed-off-by: Jon Ringle <[email protected]>
>
> ---
> drivers/i2c/busses/i2c-iop3xx.c | 16 ++++++++--------
> 1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
> index a75c75e..e6dc46d 100644
> --- a/drivers/i2c/busses/i2c-iop3xx.c
> +++ b/drivers/i2c/busses/i2c-iop3xx.c
> @@ -471,14 +471,6 @@ iop3xx_i2c_probe(struct platform_device *pdev)
> ret = -ENXIO;
> goto unmap;
> }
> - ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
> - pdev->name, adapter_data);
> -
> - if (ret) {
> - ret = -EIO;
> - goto unmap;
> - }
> -
> memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
> new_adapter->owner = THIS_MODULE;
> new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
> @@ -497,6 +489,14 @@ iop3xx_i2c_probe(struct platform_device *pdev)
> iop3xx_i2c_reset(adapter_data);
> iop3xx_i2c_enable(adapter_data);
>
> + ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
> + pdev->name, adapter_data);
> +
> + if (ret) {
> + ret = -EIO;
> + goto unmap;
> + }
> +
> platform_set_drvdata(pdev, new_adapter);
> new_adapter->algo_data = adapter_data;
>
> --
> tg: (74fca6a..) t/isc-31/i2c-request_irq-iop3xx_i2c_enable-reorder (depends on: b2.6.31.y)
>

--
Jiri Kosina
SUSE Labs, Novell Inc.

2009-09-18 14:35:54

by Ben Dooks

[permalink] [raw]
Subject: Re: [PATCH] i2c: Move i2c request_irq so that it occurs after iop3xx_i2c_enable

On Fri, Sep 18, 2009 at 04:32:04PM +0200, Jiri Kosina wrote:
> On Fri, 18 Sep 2009, Jon Ringle wrote:
>
> > If there is a pending i2c interrupt present before i2c-iop3xx initialization
> > then it must be cleared first before registering irq handler. Otherwise,
> > a hung system due to an unhandled interrupt loop may occur.
>
> Hi Jon,
>
> this doesn't really qualify for trivial tree. I am adding Jean Delvare to
> CC.

I'm the correct one to add, will probably be doing a push over the weekend
so will add it to my i2c next tree.

> > Signed-off-by: Jon Ringle <[email protected]>
> >
> > ---
> > drivers/i2c/busses/i2c-iop3xx.c | 16 ++++++++--------
> > 1 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
> > index a75c75e..e6dc46d 100644
> > --- a/drivers/i2c/busses/i2c-iop3xx.c
> > +++ b/drivers/i2c/busses/i2c-iop3xx.c
> > @@ -471,14 +471,6 @@ iop3xx_i2c_probe(struct platform_device *pdev)
> > ret = -ENXIO;
> > goto unmap;
> > }
> > - ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
> > - pdev->name, adapter_data);
> > -
> > - if (ret) {
> > - ret = -EIO;
> > - goto unmap;
> > - }
> > -
> > memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
> > new_adapter->owner = THIS_MODULE;
> > new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
> > @@ -497,6 +489,14 @@ iop3xx_i2c_probe(struct platform_device *pdev)
> > iop3xx_i2c_reset(adapter_data);
> > iop3xx_i2c_enable(adapter_data);
> >
> > + ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
> > + pdev->name, adapter_data);
> > +
> > + if (ret) {
> > + ret = -EIO;
> > + goto unmap;
> > + }
> > +
> > platform_set_drvdata(pdev, new_adapter);
> > new_adapter->algo_data = adapter_data;
> >
> > --
> > tg: (74fca6a..) t/isc-31/i2c-request_irq-iop3xx_i2c_enable-reorder (depends on: b2.6.31.y)
> >
>
> --
> Jiri Kosina
> SUSE Labs, Novell Inc.

--
--
Ben

Q: What's a light-year?
A: One-third less calories than a regular year.