[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1370630768-4077-3-git-send-email-grygorii.strashko@ti.com>
Date: Fri, 7 Jun 2013 21:46:05 +0300
From: Grygorii Strashko <grygorii.strashko@...com>
To: Wolfram Sang <wsa@...-dreams.de>, Tony Lindgren <tony@...mide.com>
CC: <linux-kernel@...r.kernel.org>, <linux-omap@...r.kernel.org>,
<linux-i2c@...r.kernel.org>,
Grygorii Strashko <grygorii.strashko@...com>,
Kevin Hilman <khilman@...aro.org>
Subject: [PATCH 2/5] i2c: omap: add runtime check in isr to be sure that i2c is enabled
Add runtime check at the beginning of omap_i2c_isr/omap_i2c_isr_thread
to be sure that i2c is enabled, before performing IRQ handling and accessing
I2C IP registers:
if (pm_runtime_suspended(dev->dev)) {
WARN_ONCE(true, "We should never be here!\n");
return IRQ_NONE;
}
Produce warning in case if ISR called when i2c is disabled
CC: Kevin Hilman <khilman@...aro.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@...com>
---
drivers/i2c/busses/i2c-omap.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 97844ff..2dac598 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -885,6 +885,11 @@ omap_i2c_isr(int irq, void *dev_id)
u16 stat;
spin_lock(&dev->lock);
+ if (pm_runtime_suspended(dev->dev)) {
+ WARN_ONCE(true, "We should never be here!\n");
+ return IRQ_NONE;
+ }
+
mask = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
@@ -905,6 +910,11 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
u16 stat;
int err = 0, count = 0;
+ if (pm_runtime_suspended(dev->dev)) {
+ WARN_ONCE(true, "We should never be here!\n");
+ return IRQ_NONE;
+ }
+
spin_lock_irqsave(&dev->lock, flags);
do {
bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists