Commit 3b36fb84 authored by David S. Miller's avatar David S. Miller

[SPARC64] bbc_i2c: Fix kenvctrld eating %100 cpu.

Based almost entirely upon a patch by Joerg Friedrich
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent abfd336c
...@@ -187,19 +187,20 @@ static int wait_for_pin(struct bbc_i2c_bus *bp, u8 *status) ...@@ -187,19 +187,20 @@ static int wait_for_pin(struct bbc_i2c_bus *bp, u8 *status)
bp->waiting = 1; bp->waiting = 1;
add_wait_queue(&bp->wq, &wait); add_wait_queue(&bp->wq, &wait);
while (limit-- > 0) { while (limit-- > 0) {
u8 val; unsigned long val;
set_current_state(TASK_INTERRUPTIBLE); val = wait_event_interruptible_timeout(
*status = val = readb(bp->i2c_control_regs + 0); bp->wq,
if ((val & I2C_PCF_PIN) == 0) { (((*status = readb(bp->i2c_control_regs + 0))
& I2C_PCF_PIN) == 0),
msecs_to_jiffies(250));
if (val > 0) {
ret = 0; ret = 0;
break; break;
} }
msleep_interruptible(250);
} }
remove_wait_queue(&bp->wq, &wait); remove_wait_queue(&bp->wq, &wait);
bp->waiting = 0; bp->waiting = 0;
current->state = TASK_RUNNING;
return ret; return ret;
} }
...@@ -340,7 +341,7 @@ static irqreturn_t bbc_i2c_interrupt(int irq, void *dev_id) ...@@ -340,7 +341,7 @@ static irqreturn_t bbc_i2c_interrupt(int irq, void *dev_id)
*/ */
if (bp->waiting && if (bp->waiting &&
!(readb(bp->i2c_control_regs + 0x0) & I2C_PCF_PIN)) !(readb(bp->i2c_control_regs + 0x0) & I2C_PCF_PIN))
wake_up(&bp->wq); wake_up_interruptible(&bp->wq);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
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