]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
spi: omap2-mcspi: Switch to readl_poll_timeout()
authorVignesh R <vigneshr@ti.com>
Mon, 15 Oct 2018 06:38:27 +0000 (12:08 +0530)
committerMark Brown <broonie@kernel.org>
Fri, 19 Oct 2018 12:32:57 +0000 (13:32 +0100)
Use standard readl_poll_timeout() macro for polling on status bits.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-omap2-mcspi.c

index 508c61c669e7d701525af13309430d7a4d1e9ce8..985f00d8a9649d5bb9a692b8b1b17075e5149159 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/gcd.h>
+#include <linux/iopoll.h>
 
 #include <linux/spi/spi.h>
 #include <linux/gpio.h>
@@ -353,19 +354,9 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi,
 
 static int mcspi_wait_for_reg_bit(void __iomem *reg, unsigned long bit)
 {
-       unsigned long timeout;
-
-       timeout = jiffies + msecs_to_jiffies(1000);
-       while (!(readl_relaxed(reg) & bit)) {
-               if (time_after(jiffies, timeout)) {
-                       if (!(readl_relaxed(reg) & bit))
-                               return -ETIMEDOUT;
-                       else
-                               return 0;
-               }
-               cpu_relax();
-       }
-       return 0;
+       u32 val;
+
+       return readl_poll_timeout(reg, val, val & bit, 1, MSEC_PER_SEC);
 }
 
 static void omap2_mcspi_rx_callback(void *data)