summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-rockchip.c
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2014-09-03 13:44:25 -0700
committerMark Brown <broonie@kernel.org>2014-09-04 23:54:11 +0100
commit64bc0110f1ec905b1676b5ef60c1cc5b1799e1b6 (patch)
tree88cbe1c3b5b31576b3688d4e1fc0521a593c99d4 /drivers/spi/spi-rockchip.c
parent7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff)
downloadlinux-64bc0110f1ec905b1676b5ef60c1cc5b1799e1b6.tar.gz
linux-64bc0110f1ec905b1676b5ef60c1cc5b1799e1b6.tar.bz2
linux-64bc0110f1ec905b1676b5ef60c1cc5b1799e1b6.zip
spi/rockchip: Fix the wait_for_idle() timeout
The wait_for_idle() could get unlucky and timeout too quickly. Specifically, the old calculation was effectively: timeout = jiffies + 1; if (jiffies >= timeout) print warning; From the above it should be obvious that if jiffies ticks in just the wrong place then we'll have an effective timeout of 0. Fix this by effectively changing the above ">=" to a ">". That gives us an extra jiffy to finish. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-rockchip.c')
-rw-r--r--drivers/spi/spi-rockchip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index c0743604b906..2a31bc2d3fd3 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -220,7 +220,7 @@ static inline void wait_for_idle(struct rockchip_spi *rs)
do {
if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY))
return;
- } while (time_before(jiffies, timeout));
+ } while (!time_after(jiffies, timeout));
dev_warn(rs->dev, "spi controller is in busy state!\n");
}