diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2025-12-29 14:42:32 +0100 |
|---|---|---|
| committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2025-12-29 14:52:19 +0100 |
| commit | b7eda5634e9b1e8bb1930c7b27511fde4ed8efa5 (patch) | |
| tree | 4eaf101b84bb02d5974054c1268ad1fc1b1eb9a9 /drivers/auxdisplay | |
| parent | de2248f7a4965f629390322063a1ff1742014efa (diff) | |
auxdisplay: arm-charlcd: Use readl_poll_timeout
Use readl_poll_timeout_atomic() from <iopoll.h> instead of using
custom poll loops.
The timeout settings are different, but that shouldn't be much of a
problem. Instead of polling 10 times in a close loop, it polls for
one millisecond.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/auxdisplay')
| -rw-r--r-- | drivers/auxdisplay/arm-charlcd.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/auxdisplay/arm-charlcd.c b/drivers/auxdisplay/arm-charlcd.c index ac8604d3b9a0..a537126f5d6a 100644 --- a/drivers/auxdisplay/arm-charlcd.c +++ b/drivers/auxdisplay/arm-charlcd.c @@ -13,7 +13,7 @@ #include <linux/err.h> #include <linux/init.h> #include <linux/interrupt.h> -#include <linux/io.h> +#include <linux/iopoll.h> #include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/string.h> @@ -115,20 +115,14 @@ static u8 charlcd_4bit_read_char(struct charlcd *lcd) { u8 data; u32 val; - int i; /* If we can, use an IRQ to wait for the data, else poll */ if (lcd->irq >= 0) charlcd_wait_complete_irq(lcd); else { - i = 0; - val = 0; - while (!(val & CHAR_RAW_VALID) && i < 10) { - udelay(100); - val = readl(lcd->virtbase + CHAR_RAW); - i++; - } - + udelay(100); + readl_poll_timeout_atomic(lcd->virtbase + CHAR_RAW, val, + val & CHAR_RAW_VALID, 100, 1000); writel(CHAR_RAW_CLEAR, lcd->virtbase + CHAR_RAW); } msleep(1); @@ -140,13 +134,9 @@ static u8 charlcd_4bit_read_char(struct charlcd *lcd) * The second read for the low bits does not trigger an IRQ * so in this case we have to poll for the 4 lower bits */ - i = 0; - val = 0; - while (!(val & CHAR_RAW_VALID) && i < 10) { - udelay(100); - val = readl(lcd->virtbase + CHAR_RAW); - i++; - } + udelay(100); + readl_poll_timeout_atomic(lcd->virtbase + CHAR_RAW, val, + val & CHAR_RAW_VALID, 100, 1000); writel(CHAR_RAW_CLEAR, lcd->virtbase + CHAR_RAW); msleep(1); |
