aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVirupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>2011-05-13 06:29:46 -0400
committerBen Dooks <ben-linux@fluff.org>2011-05-24 19:20:33 -0400
commitcd20e4fa910540c339b483d0b95ca237abf3354a (patch)
tree4ba5c4c788e21b21aa4a1375844b8855004518b0
parentc436f92a4646e4635554bda39407dfb907352321 (diff)
i2c-nomadik: correct adapter timeout initialization
Correct the incorrect initialization of adapter timeout not to be in milliseconds, as it needs to be done in jiffies. Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com> Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r--drivers/i2c/busses/i2c-nomadik.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index dbd93b25d2c5..28389c29af75 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -210,7 +210,7 @@ static int flush_i2c_fifo(struct nmk_i2c_dev *dev)
210 writel((I2C_CR_FTX | I2C_CR_FRX), dev->virtbase + I2C_CR); 210 writel((I2C_CR_FTX | I2C_CR_FRX), dev->virtbase + I2C_CR);
211 211
212 for (i = 0; i < LOOP_ATTEMPTS; i++) { 212 for (i = 0; i < LOOP_ATTEMPTS; i++) {
213 timeout = jiffies + msecs_to_jiffies(dev->adap.timeout); 213 timeout = jiffies + dev->adap.timeout;
214 214
215 while (!time_after(jiffies, timeout)) { 215 while (!time_after(jiffies, timeout)) {
216 if ((readl(dev->virtbase + I2C_CR) & 216 if ((readl(dev->virtbase + I2C_CR) &
@@ -431,7 +431,7 @@ static int read_i2c(struct nmk_i2c_dev *dev)
431 dev->virtbase + I2C_IMSCR); 431 dev->virtbase + I2C_IMSCR);
432 432
433 timeout = wait_for_completion_interruptible_timeout( 433 timeout = wait_for_completion_interruptible_timeout(
434 &dev->xfer_complete, msecs_to_jiffies(dev->adap.timeout)); 434 &dev->xfer_complete, dev->adap.timeout);
435 435
436 if (timeout < 0) { 436 if (timeout < 0) {
437 dev_err(&dev->pdev->dev, 437 dev_err(&dev->pdev->dev,
@@ -495,7 +495,7 @@ static int write_i2c(struct nmk_i2c_dev *dev)
495 dev->virtbase + I2C_IMSCR); 495 dev->virtbase + I2C_IMSCR);
496 496
497 timeout = wait_for_completion_interruptible_timeout( 497 timeout = wait_for_completion_interruptible_timeout(
498 &dev->xfer_complete, msecs_to_jiffies(dev->adap.timeout)); 498 &dev->xfer_complete, dev->adap.timeout);
499 499
500 if (timeout < 0) { 500 if (timeout < 0) {
501 dev_err(&dev->pdev->dev, 501 dev_err(&dev->pdev->dev,
@@ -914,7 +914,8 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
914 adap->owner = THIS_MODULE; 914 adap->owner = THIS_MODULE;
915 adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; 915 adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
916 adap->algo = &nmk_i2c_algo; 916 adap->algo = &nmk_i2c_algo;
917 adap->timeout = pdata->timeout ? pdata->timeout : 20000; 917 adap->timeout = pdata->timeout ? msecs_to_jiffies(pdata->timeout) :
918 msecs_to_jiffies(20000);
918 snprintf(adap->name, sizeof(adap->name), 919 snprintf(adap->name, sizeof(adap->name),
919 "Nomadik I2C%d at %lx", pdev->id, (unsigned long)res->start); 920 "Nomadik I2C%d at %lx", pdev->id, (unsigned long)res->start);
920 921