提交 98a679ca 编写于 作者: J Jean Delvare

i2c-davinci: Fix timeout handling

Properly set the adapter timeout value in jiffies, and then use that
value in the driver, rather than a hard-coded constant.
Signed-off-by: NJean Delvare <khali@linux-fr.org>
Tested-by: NTroy Kisky <troy.kisky@boundarydevices.com>
Cc: Kevin Hilman <khilman@mvista.com>
上级 8a52c6b4
...@@ -216,7 +216,7 @@ static int i2c_davinci_wait_bus_not_busy(struct davinci_i2c_dev *dev, ...@@ -216,7 +216,7 @@ static int i2c_davinci_wait_bus_not_busy(struct davinci_i2c_dev *dev,
{ {
unsigned long timeout; unsigned long timeout;
timeout = jiffies + DAVINCI_I2C_TIMEOUT; timeout = jiffies + dev->adapter.timeout;
while (davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG) while (davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG)
& DAVINCI_I2C_STR_BB) { & DAVINCI_I2C_STR_BB) {
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
...@@ -289,7 +289,7 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) ...@@ -289,7 +289,7 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
DAVINCI_I2C_TIMEOUT); dev->adapter.timeout);
if (r == 0) { if (r == 0) {
dev_err(dev->dev, "controller timed out\n"); dev_err(dev->dev, "controller timed out\n");
i2c_davinci_init(dev); i2c_davinci_init(dev);
...@@ -546,9 +546,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) ...@@ -546,9 +546,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name)); strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name));
adap->algo = &i2c_davinci_algo; adap->algo = &i2c_davinci_algo;
adap->dev.parent = &pdev->dev; adap->dev.parent = &pdev->dev;
adap->timeout = DAVINCI_I2C_TIMEOUT;
/* FIXME */
adap->timeout = 1;
adap->nr = pdev->id; adap->nr = pdev->id;
r = i2c_add_numbered_adapter(adap); r = i2c_add_numbered_adapter(adap);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册