diff options
author | Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com> | 2011-05-13 06:29:28 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2011-05-24 19:20:26 -0400 |
commit | 99381bec0a569a69345148cb1ac74c2caa43a227 (patch) | |
tree | 1f88159771942d1a71a1d77e2e859874c18c1906 /drivers/i2c/busses | |
parent | 2320f504d3c87b814abf37f224ab68d52d2a512c (diff) |
i2c-nomadik: corrrect returned error numbers
The code was returning bad error numbers or just -1 in some cases.
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>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-nomadik.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 3bf95b90abae..a02141a99713 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c | |||
@@ -615,6 +615,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
615 | cause >= ARRAY_SIZE(abort_causes) | 615 | cause >= ARRAY_SIZE(abort_causes) |
616 | ? "unknown reason" : abort_causes[cause]); | 616 | ? "unknown reason" : abort_causes[cause]); |
617 | 617 | ||
618 | status = status ? status : dev->result; | ||
619 | |||
618 | goto out; | 620 | goto out; |
619 | } | 621 | } |
620 | udelay(I2C_DELAY); | 622 | udelay(I2C_DELAY); |
@@ -759,7 +761,7 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg) | |||
759 | | I2C_IT_RXFF | I2C_IT_RXFE)); | 761 | | I2C_IT_RXFF | I2C_IT_RXFE)); |
760 | 762 | ||
761 | if (dev->cli.count) { | 763 | if (dev->cli.count) { |
762 | dev->result = -1; | 764 | dev->result = -EIO; |
763 | dev_err(&dev->pdev->dev, "%lu bytes still remain to be" | 765 | dev_err(&dev->pdev->dev, "%lu bytes still remain to be" |
764 | "xfered\n", dev->cli.count); | 766 | "xfered\n", dev->cli.count); |
765 | (void) init_hw(dev); | 767 | (void) init_hw(dev); |
@@ -770,7 +772,7 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg) | |||
770 | 772 | ||
771 | /* Master Arbitration lost interrupt */ | 773 | /* Master Arbitration lost interrupt */ |
772 | case I2C_IT_MAL: | 774 | case I2C_IT_MAL: |
773 | dev->result = -1; | 775 | dev->result = -EIO; |
774 | (void) init_hw(dev); | 776 | (void) init_hw(dev); |
775 | 777 | ||
776 | i2c_set_bit(dev->virtbase + I2C_ICR, I2C_IT_MAL); | 778 | i2c_set_bit(dev->virtbase + I2C_ICR, I2C_IT_MAL); |
@@ -784,7 +786,7 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg) | |||
784 | * during the transaction. | 786 | * during the transaction. |
785 | */ | 787 | */ |
786 | case I2C_IT_BERR: | 788 | case I2C_IT_BERR: |
787 | dev->result = -1; | 789 | dev->result = -EIO; |
788 | /* get the status */ | 790 | /* get the status */ |
789 | if (((readl(dev->virtbase + I2C_SR) >> 2) & 0x3) == I2C_ABORT) | 791 | if (((readl(dev->virtbase + I2C_SR) >> 2) & 0x3) == I2C_ABORT) |
790 | (void) init_hw(dev); | 792 | (void) init_hw(dev); |
@@ -800,7 +802,7 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg) | |||
800 | * the Tx FIFO is full. | 802 | * the Tx FIFO is full. |
801 | */ | 803 | */ |
802 | case I2C_IT_TXFOVR: | 804 | case I2C_IT_TXFOVR: |
803 | dev->result = -1; | 805 | dev->result = -EIO; |
804 | (void) init_hw(dev); | 806 | (void) init_hw(dev); |
805 | 807 | ||
806 | dev_err(&dev->pdev->dev, "Tx Fifo Over run\n"); | 808 | dev_err(&dev->pdev->dev, "Tx Fifo Over run\n"); |