diff options
-rw-r--r-- | drivers/sbus/char/bbc_i2c.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c index 22631f8b9b48..8410587348f1 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) | |||
187 | bp->waiting = 1; | 187 | bp->waiting = 1; |
188 | add_wait_queue(&bp->wq, &wait); | 188 | add_wait_queue(&bp->wq, &wait); |
189 | while (limit-- > 0) { | 189 | while (limit-- > 0) { |
190 | u8 val; | 190 | unsigned long val; |
191 | 191 | ||
192 | set_current_state(TASK_INTERRUPTIBLE); | 192 | val = wait_event_interruptible_timeout( |
193 | *status = val = readb(bp->i2c_control_regs + 0); | 193 | bp->wq, |
194 | if ((val & I2C_PCF_PIN) == 0) { | 194 | (((*status = readb(bp->i2c_control_regs + 0)) |
195 | & I2C_PCF_PIN) == 0), | ||
196 | msecs_to_jiffies(250)); | ||
197 | if (val > 0) { | ||
195 | ret = 0; | 198 | ret = 0; |
196 | break; | 199 | break; |
197 | } | 200 | } |
198 | msleep_interruptible(250); | ||
199 | } | 201 | } |
200 | remove_wait_queue(&bp->wq, &wait); | 202 | remove_wait_queue(&bp->wq, &wait); |
201 | bp->waiting = 0; | 203 | bp->waiting = 0; |
202 | current->state = TASK_RUNNING; | ||
203 | 204 | ||
204 | return ret; | 205 | return ret; |
205 | } | 206 | } |
@@ -340,7 +341,7 @@ static irqreturn_t bbc_i2c_interrupt(int irq, void *dev_id) | |||
340 | */ | 341 | */ |
341 | if (bp->waiting && | 342 | if (bp->waiting && |
342 | !(readb(bp->i2c_control_regs + 0x0) & I2C_PCF_PIN)) | 343 | !(readb(bp->i2c_control_regs + 0x0) & I2C_PCF_PIN)) |
343 | wake_up(&bp->wq); | 344 | wake_up_interruptible(&bp->wq); |
344 | 345 | ||
345 | return IRQ_HANDLED; | 346 | return IRQ_HANDLED; |
346 | } | 347 | } |