diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2019-04-02 16:40:22 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-04-03 11:32:26 +0700 |
commit | 9115b4d89b213dc73fd35844e0199b1763f751d6 (patch) | |
tree | c32b3e9408185a955106cb9b67a00c7d45bbf078 /drivers | |
parent | 8863eca8c46affaa91ae35390b00358b925483eb (diff) | |
download | linux-9115b4d89b213dc73fd35844e0199b1763f751d6.tar.bz2 |
spi: sh-msiof: Use readl_poll_timeout_atomic() instead of open-coding
Replace the open-coded loop in sh_msiof_modify_ctr_wait() by a call to
the readl_poll_timeout_atomic() helper macro.
Suggested-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-sh-msiof.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 6edc76636e81..3243ff258896 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -18,6 +18,7 @@ #include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/io.h> +#include <linux/iopoll.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/of.h> @@ -219,21 +220,14 @@ static int sh_msiof_modify_ctr_wait(struct sh_msiof_spi_priv *p, { u32 mask = clr | set; u32 data; - int k; data = sh_msiof_read(p, CTR); data &= ~clr; data |= set; sh_msiof_write(p, CTR, data); - for (k = 100; k > 0; k--) { - if ((sh_msiof_read(p, CTR) & mask) == set) - break; - - udelay(10); - } - - return k > 0 ? 0 : -ETIMEDOUT; + return readl_poll_timeout_atomic(p->mapbase + CTR, data, + (data & mask) == set, 10, 1000); } static irqreturn_t sh_msiof_spi_irq(int irq, void *data) |