i2c-tegra: fix possible race condition after tx
authorDoug Anderson <dianders@chromium.org>
Tue, 30 Aug 2011 17:46:10 +0000 (11:46 -0600)
committerBen Dooks <ben-linux@fluff.org>
Tue, 6 Sep 2011 23:13:40 +0000 (00:13 +0100)
commit96219c3a257cc8ba3b3cae67efdc88be37cf7c9d
tree9b46e7ee94f9db13a414ec2e445c8a0551aa3982
parent048e29cff95168ea3a9f176e84cc0bae54d0ae64
i2c-tegra: fix possible race condition after tx

In tegra_i2c_fill_tx_fifo, once we have finished pushing all the bytes
to the I2C hardware controller, the interrupt might happen before we
have updated i2c_dev->msg_buf_remaining at the end of the function.
Then, in tegra_i2c_isr, we will call again tegra_i2c_fill_tx_fifo
triggering weird behaviour. This has been shown to happen under real
conditions.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
drivers/i2c/busses/i2c-tegra.c