Commit 387fa6a5 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Russell King

[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: default avatarDmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: default avatarEric Miao <eric.miao@marvell.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 9ba63c4f
...@@ -189,14 +189,14 @@ static inline int i2c_pxa_is_slavemode(struct pxa_i2c *i2c) ...@@ -189,14 +189,14 @@ static inline int i2c_pxa_is_slavemode(struct pxa_i2c *i2c)
static void i2c_pxa_abort(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)) { if (i2c_pxa_is_slavemode(i2c)) {
dev_dbg(&i2c->adap.dev, "%s: called in slave mode\n", __func__); dev_dbg(&i2c->adap.dev, "%s: called in slave mode\n", __func__);
return; 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)); unsigned long icr = readl(_ICR(i2c));
icr &= ~ICR_START; icr &= ~ICR_START;
...@@ -206,7 +206,8 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c) ...@@ -206,7 +206,8 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c)
show_state(i2c); show_state(i2c);
msleep(1); mdelay(1);
i --;
} }
writel(readl(_ICR(i2c)) & ~(ICR_MA | ICR_START | ICR_STOP), writel(readl(_ICR(i2c)) & ~(ICR_MA | ICR_START | ICR_STOP),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment