[PATCH 3/3] serial: core: Update uart_poll_timeout function to return unsigned int

From: Vamshi Gajjela
Date: Sat Oct 14 2023 - 06:50:24 EST


From: VAMSHI GAJJELA <vamshigajjela@xxxxxxxxxx>

uart_fifo_timeout() returns unsigned value, hence the function
uart_poll_timeout has been modified to use an unsigned int type for
timeout values instead of a signed int. The return type of the function
has been changed from int to unsigned int for consistency with the type
of timeout values. The result of uart_fifo_timeout() is cast to u32,
indicating that the value is truncated.

Signed-off-by: VAMSHI GAJJELA <vamshigajjela@xxxxxxxxxx>
---
include/linux/serial_core.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index b128513b009a..445a1ff7e502 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -773,9 +773,9 @@ static inline unsigned long uart_fifo_timeout(struct uart_port *port)
}

/* Base timer interval for polling */
-static inline int uart_poll_timeout(struct uart_port *port)
+static inline unsigned int uart_poll_timeout(struct uart_port *port)
{
- int timeout = uart_fifo_timeout(port);
+ unsigned int timeout = (u32)uart_fifo_timeout(port);

return timeout > 6 ? (timeout / 2 - 2) : 1;
}
--
2.42.0.655.g421f12c284-goog