diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-imx.c')
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 32375bddae7d..d1ff9408dc1f 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/sched.h> | 47 | #include <linux/sched.h> |
48 | #include <linux/platform_device.h> | 48 | #include <linux/platform_device.h> |
49 | #include <linux/clk.h> | 49 | #include <linux/clk.h> |
50 | #include <linux/slab.h> | ||
50 | 51 | ||
51 | #include <mach/irqs.h> | 52 | #include <mach/irqs.h> |
52 | #include <mach/hardware.h> | 53 | #include <mach/hardware.h> |
@@ -145,10 +146,10 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) | |||
145 | "<%s> I2C Interrupted\n", __func__); | 146 | "<%s> I2C Interrupted\n", __func__); |
146 | return -EINTR; | 147 | return -EINTR; |
147 | } | 148 | } |
148 | if (time_after(jiffies, orig_jiffies + HZ / 1000)) { | 149 | if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) { |
149 | dev_dbg(&i2c_imx->adapter.dev, | 150 | dev_dbg(&i2c_imx->adapter.dev, |
150 | "<%s> I2C bus is busy\n", __func__); | 151 | "<%s> I2C bus is busy\n", __func__); |
151 | return -EIO; | 152 | return -ETIMEDOUT; |
152 | } | 153 | } |
153 | schedule(); | 154 | schedule(); |
154 | } | 155 | } |
@@ -443,6 +444,8 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter, | |||
443 | result = i2c_imx_read(i2c_imx, &msgs[i]); | 444 | result = i2c_imx_read(i2c_imx, &msgs[i]); |
444 | else | 445 | else |
445 | result = i2c_imx_write(i2c_imx, &msgs[i]); | 446 | result = i2c_imx_write(i2c_imx, &msgs[i]); |
447 | if (result) | ||
448 | goto fail0; | ||
446 | } | 449 | } |
447 | 450 | ||
448 | fail0: | 451 | fail0: |