public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jon Ringle <jon@ringle.org>
To: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
Cc: linux-kernel@vger.kernel.org, trivial@kernel.org,
	Jon Ringle <jon@ringle.org>
Subject: [PATCH] i2c: Move i2c request_irq so that it occurs after iop3xx_i2c_enable
Date: Fri, 18 Sep 2009 09:51:11 -0400	[thread overview]
Message-ID: <1253281871-28243-1-git-send-email-jon@ringle.org> (raw)

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 <jon@ringle.org>

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

             reply	other threads:[~2009-09-18 14:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18 13:51 Jon Ringle [this message]
2009-09-18 14:32 ` [PATCH] i2c: Move i2c request_irq so that it occurs after iop3xx_i2c_enable Jiri Kosina
2009-09-18 14:35   ` Ben Dooks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1253281871-28243-1-git-send-email-jon@ringle.org \
    --to=jon@ringle.org \
    --cc=ben-linux@fluff.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox