Commit 9115b4d8 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Mark Brown

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: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8863eca8
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
...@@ -219,21 +220,14 @@ static int sh_msiof_modify_ctr_wait(struct sh_msiof_spi_priv *p, ...@@ -219,21 +220,14 @@ static int sh_msiof_modify_ctr_wait(struct sh_msiof_spi_priv *p,
{ {
u32 mask = clr | set; u32 mask = clr | set;
u32 data; u32 data;
int k;
data = sh_msiof_read(p, CTR); data = sh_msiof_read(p, CTR);
data &= ~clr; data &= ~clr;
data |= set; data |= set;
sh_msiof_write(p, CTR, data); sh_msiof_write(p, CTR, data);
for (k = 100; k > 0; k--) { return readl_poll_timeout_atomic(p->mapbase + CTR, data,
if ((sh_msiof_read(p, CTR) & mask) == set) (data & mask) == set, 10, 1000);
break;
udelay(10);
}
return k > 0 ? 0 : -ETIMEDOUT;
} }
static irqreturn_t sh_msiof_spi_irq(int irq, void *data) static irqreturn_t sh_msiof_spi_irq(int irq, void *data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment