Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137565
b: refs/heads/master
c: 94d78e1
h: refs/heads/master
i:
  137563: f15f9a7
v: v3
  • Loading branch information
Roel Kluin authored and Jean Delvare committed Mar 28, 2009
1 parent ebca577 commit cfb910b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0c168ceb9e1898a7f2895e80ce9915835b083bd3
refs/heads/master: 94d78e180c0323422854bc1718e657ac2d0cac1b
18 changes: 10 additions & 8 deletions trunk/drivers/i2c/algos/i2c-algo-pcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,17 @@ static int wait_for_bb(struct i2c_algo_pcf_data *adap)

status = get_pcf(adap, 1);

while (timeout-- && !(status & I2C_PCF_BB)) {
while (!(status & I2C_PCF_BB) && --timeout) {
udelay(100); /* wait for 100 us */
status = get_pcf(adap, 1);
}

if (timeout <= 0)
if (timeout == 0) {
printk(KERN_ERR "Timeout waiting for Bus Busy\n");
return -ETIMEDOUT;
}

return timeout <= 0;
return 0;
}

static int wait_for_pin(struct i2c_algo_pcf_data *adap, int *status)
Expand All @@ -133,7 +135,7 @@ static int wait_for_pin(struct i2c_algo_pcf_data *adap, int *status)

*status = get_pcf(adap, 1);

while (timeout-- && (*status & I2C_PCF_PIN)) {
while ((*status & I2C_PCF_PIN) && --timeout) {
adap->waitforpin(adap->data);
*status = get_pcf(adap, 1);
}
Expand All @@ -142,10 +144,10 @@ static int wait_for_pin(struct i2c_algo_pcf_data *adap, int *status)
return -EINTR;
}

if (timeout <= 0)
return -1;
else
return 0;
if (timeout == 0)
return -ETIMEDOUT;

return 0;
}

/*
Expand Down

0 comments on commit cfb910b

Please sign in to comment.