diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-08-18 15:38:48 +0200 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-09 17:32:51 +0200 |
commit | 387fa6a5eca021ed5bef5454413b7cdfda74ba41 (patch) | |
tree | 4bfd563146ca2dc77b7d489f4d33011c36b043bb /drivers | |
parent | [ARM] 5201/1: PXA3xx: Add support for power i2c bus (diff) | |
download | linux-387fa6a5eca021ed5bef5454413b7cdfda74ba41.tar.xz linux-387fa6a5eca021ed5bef5454413b7cdfda74ba41.zip |
[ARM] 5203/1: i2c-pxa: fix scheduling while atomic in i2c_pxa_abort()
i2c_pxa_abort can be called from the atomic context.
Change it to use mdelay and counted loop.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 5d5fbc518b7b..57fbffd1ccc0 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -189,14 +189,14 @@ static inline int i2c_pxa_is_slavemode(struct pxa_i2c *i2c) static void i2c_pxa_abort(struct pxa_i2c *i2c) { - unsigned long timeout = jiffies + HZ/4; + int i = 250; if (i2c_pxa_is_slavemode(i2c)) { dev_dbg(&i2c->adap.dev, "%s: called in slave mode\n", __func__); return; } - while (time_before(jiffies, timeout) && (readl(_IBMR(i2c)) & 0x1) == 0) { + while ((i > 0) && (readl(_IBMR(i2c)) & 0x1) == 0) { unsigned long icr = readl(_ICR(i2c)); icr &= ~ICR_START; @@ -206,7 +206,8 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c) show_state(i2c); - msleep(1); + mdelay(1); + i --; } writel(readl(_ICR(i2c)) & ~(ICR_MA | ICR_START | ICR_STOP), |