From: Andy Shevchenko Date: Mon, 29 Dec 2025 13:42:32 +0000 (+0100) Subject: auxdisplay: arm-charlcd: Use readl_poll_timeout X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7eda5634e9b1e8bb1930c7b27511fde4ed8efa5;p=thirdparty%2Flinux.git auxdisplay: arm-charlcd: Use readl_poll_timeout Use readl_poll_timeout_atomic() from 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 --- diff --git a/drivers/auxdisplay/arm-charlcd.c b/drivers/auxdisplay/arm-charlcd.c index ac8604d3b9a0a..a537126f5d6aa 100644 --- a/drivers/auxdisplay/arm-charlcd.c +++ b/drivers/auxdisplay/arm-charlcd.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -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);