summaryrefslogtreecommitdiff
path: root/drivers/sbus
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2007-03-08 08:36:44 +0100
committerAdrian Bunk <bunk@stusta.de>2007-03-08 08:36:44 +0100
commite61f6a0e0627eeaaaae5cef83f877e77f64cc607 (patch)
tree62b2132b25098663905f54c82834e8b24a2a8eb1 /drivers/sbus
parent822f952f2ab27ca3f06d6fb3e57c34195b1e0583 (diff)
[SPARC64] bbc_i2c: Fix kenvctrld eating %100 cpu.
Based almost entirely upon a patch by Joerg Friedrich Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'drivers/sbus')
-rw-r--r--drivers/sbus/char/bbc_i2c.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 1c8b612d8234..026e813d1b0b 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -187,19 +187,20 @@ static int wait_for_pin(struct bbc_i2c_bus *bp, u8 *status)
bp->waiting = 1;
add_wait_queue(&bp->wq, &wait);
while (limit-- > 0) {
- u8 val;
-
- set_current_state(TASK_INTERRUPTIBLE);
- *status = val = readb(bp->i2c_control_regs + 0);
- if ((val & I2C_PCF_PIN) == 0) {
+ unsigned long val;
+
+ val = wait_event_interruptible_timeout(
+ bp->wq,
+ (((*status = readb(bp->i2c_control_regs + 0))
+ & I2C_PCF_PIN) == 0),
+ msecs_to_jiffies(250));
+ if (val > 0) {
ret = 0;
break;
}
- msleep_interruptible(250);
}
remove_wait_queue(&bp->wq, &wait);
bp->waiting = 0;
- current->state = TASK_RUNNING;
return ret;
}
@@ -340,7 +341,7 @@ static irqreturn_t bbc_i2c_interrupt(int irq, void *dev_id, struct pt_regs *regs
*/
if (bp->waiting &&
!(readb(bp->i2c_control_regs + 0x0) & I2C_PCF_PIN))
- wake_up(&bp->wq);
+ wake_up_interruptible(&bp->wq);
return IRQ_HANDLED;
}