diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2014-05-28 03:44:40 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-06-01 16:22:34 -0400 |
commit | 3f7de22eb28244fc79bc744d9f51d018da343962 (patch) | |
tree | ea076b7b0aca7e9f54e2e3630f78567087e3378a /drivers/i2c | |
parent | f2382249b27d1589a1ae495a1df84d890982a3e1 (diff) |
i2c: rcar: check bus free before first message
We should always check if the bus is free, independently if it is a read
or write. It should be done before the first message, though. After
that, we ourselves keep the bus busy. Remove a 'ret' assignment which
only silenced a build warning.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-rcar.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index f2cbb8a7d0ba..828b519146fc 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c | |||
@@ -294,15 +294,6 @@ static int rcar_i2c_recv(struct rcar_i2c_priv *priv) | |||
294 | 294 | ||
295 | static int rcar_i2c_send(struct rcar_i2c_priv *priv) | 295 | static int rcar_i2c_send(struct rcar_i2c_priv *priv) |
296 | { | 296 | { |
297 | int ret; | ||
298 | |||
299 | /* | ||
300 | * It should check bus status when send case | ||
301 | */ | ||
302 | ret = rcar_i2c_bus_barrier(priv); | ||
303 | if (ret < 0) | ||
304 | return ret; | ||
305 | |||
306 | rcar_i2c_set_addr(priv, 0); | 297 | rcar_i2c_set_addr(priv, 0); |
307 | rcar_i2c_status_clear(priv); | 298 | rcar_i2c_status_clear(priv); |
308 | rcar_i2c_write(priv, ICMCR, RCAR_BUS_PHASE_START); | 299 | rcar_i2c_write(priv, ICMCR, RCAR_BUS_PHASE_START); |
@@ -508,7 +499,10 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, | |||
508 | spin_unlock_irqrestore(&priv->lock, flags); | 499 | spin_unlock_irqrestore(&priv->lock, flags); |
509 | /*-------------- spin unlock -----------------*/ | 500 | /*-------------- spin unlock -----------------*/ |
510 | 501 | ||
511 | ret = -EINVAL; | 502 | ret = rcar_i2c_bus_barrier(priv); |
503 | if (ret < 0) | ||
504 | goto out; | ||
505 | |||
512 | for (i = 0; i < num; i++) { | 506 | for (i = 0; i < num; i++) { |
513 | /* This HW can't send STOP after address phase */ | 507 | /* This HW can't send STOP after address phase */ |
514 | if (msgs[i].len == 0) { | 508 | if (msgs[i].len == 0) { |
@@ -569,7 +563,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, | |||
569 | 563 | ||
570 | ret = i + 1; /* The number of transfer */ | 564 | ret = i + 1; /* The number of transfer */ |
571 | } | 565 | } |
572 | 566 | out: | |
573 | pm_runtime_put(dev); | 567 | pm_runtime_put(dev); |
574 | 568 | ||
575 | if (ret < 0 && ret != -ENXIO) | 569 | if (ret < 0 && ret != -ENXIO) |