Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137572
b: refs/heads/master
c: 8e99ada
h: refs/heads/master
v: v3
  • Loading branch information
Wolfram Sang authored and Jean Delvare committed Mar 28, 2009
1 parent 114e6d6 commit 09a68a7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 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: eff9ec95efaaf6b12d230f0ea7d3c295d3bc9d57
refs/heads/master: 8e99ada8deaa9033600cd2c7d0a9366b0e99ab68
2 changes: 1 addition & 1 deletion trunk/arch/sh/boards/board-sh7785lcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static struct resource i2c_resources[] = {
static struct i2c_pca9564_pf_platform_data i2c_platform_data = {
.gpio = 0,
.i2c_clock_speed = I2C_PCA_CON_330kHz,
.timeout = 100,
.timeout = HZ,
};

static struct platform_device i2c_device = {
Expand Down
17 changes: 10 additions & 7 deletions trunk/drivers/i2c/algos/i2c-algo-pca.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/i2c.h>
Expand Down Expand Up @@ -186,14 +187,16 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
int numbytes = 0;
int state;
int ret;
int timeout = i2c_adap->timeout;
unsigned long timeout = jiffies + i2c_adap->timeout;

while ((state = pca_status(adap)) != 0xf8 && timeout--) {
msleep(10);
}
if (state != 0xf8) {
dev_dbg(&i2c_adap->dev, "bus is not idle. status is %#04x\n", state);
return -EAGAIN;
while (pca_status(adap) != 0xf8) {
if (time_before(jiffies, timeout)) {
msleep(10);
} else {
dev_dbg(&i2c_adap->dev, "bus is not idle. status is "
"%#04x\n", state);
return -EAGAIN;
}
}

DEB1("{{{ XFER %d messages\n", num);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/i2c/busses/i2c-pca-isa.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static struct i2c_adapter pca_isa_ops = {
.owner = THIS_MODULE,
.algo_data = &pca_isa_data,
.name = "PCA9564/PCA9665 ISA Adapter",
.timeout = 100,
.timeout = HZ,
};

static int __devinit pca_isa_match(struct device *dev, unsigned int id)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/i2c-pca-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct i2c_pca9564_pf_platform_data {
* not supplied (negative value), but it
* cannot exit some error conditions then */
int i2c_clock_speed; /* values are defined in linux/i2c-algo-pca.h */
int timeout; /* timeout = this value * 10us */
int timeout; /* timeout in jiffies */
};

#endif /* I2C_PCA9564_PLATFORM_H */

0 comments on commit 09a68a7

Please sign in to comment.