2023-10-30 07:36:29

by VAMSHI GAJJELA

[permalink] [raw]
Subject: [PATCH v5 0/2] serial core type consistency and clean up

This patch series primarily focus on improving type consistency and
ensuring proper handling of timeout values. The changes aim to enhance
the redability and maintainability of the serial core.

Greg, sorry for the confusion.

I started the patch series with 3 patches. I submitted improvised
patches based on review comments for each patch in the series instead
of submitting all the patches at once. This may have caused confusion,
as each patch is now at a different version, with one patch at
v2 (NACKED) the second one ready for v2, and the third at v4.

From now on, I will increment the version for the whole series instead
of for individual patches.

I have now submitted the series as v5 to avoid duplicate version numbers.
In v5 it has two patches [v4 3/3] and [v2 2/3] while [v2 1/3] discarded.

Vamshi Gajjela (2):
serial: core: Update uart_poll_timeout() function to return unsigned
long
serial: core: Clean up uart_update_timeout() function

drivers/tty/serial/serial_core.c | 7 +++----
include/linux/serial_core.h | 4 ++--
2 files changed, 5 insertions(+), 6 deletions(-)

--
2.42.0.820.g83a721a137-goog


2023-10-30 07:36:30

by VAMSHI GAJJELA

[permalink] [raw]
Subject: [PATCH v5 1/2] serial: core: Update uart_poll_timeout() function to return unsigned long

The function uart_fifo_timeout() returns an unsigned long value, which
is the number of jiffies. Therefore, change the variable timeout in the
function uart_poll_timeout() from int to unsigned long.
Change the return type of the function uart_poll_timeout() from int to
unsigned long to be consistent with the type of timeout values.

Signed-off-by: Vamshi Gajjela <[email protected]>
---
v5:
- no change. Consistent version for series
v4:
- author name in capitals to lowercase
v3:
- updated description
v2:
- unsigned long instead of unsigned int
- added () after function name in short log
- updated description

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 bb6f073bc159..6916a1d7e477 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 long uart_poll_timeout(struct uart_port *port)
{
- int timeout = uart_fifo_timeout(port);
+ unsigned long timeout = uart_fifo_timeout(port);

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

2023-10-30 09:25:58

by Ilpo Järvinen

[permalink] [raw]
Subject: Re: [PATCH v5 1/2] serial: core: Update uart_poll_timeout() function to return unsigned long

On Mon, 30 Oct 2023, Vamshi Gajjela wrote:

> The function uart_fifo_timeout() returns an unsigned long value, which
> is the number of jiffies. Therefore, change the variable timeout in the
> function uart_poll_timeout() from int to unsigned long.
> Change the return type of the function uart_poll_timeout() from int to
> unsigned long to be consistent with the type of timeout values.
>
> Signed-off-by: Vamshi Gajjela <[email protected]>
> ---
> v5:
> - no change. Consistent version for series
> v4:
> - author name in capitals to lowercase
> v3:
> - updated description
> v2:
> - unsigned long instead of unsigned int
> - added () after function name in short log
> - updated description
>
> 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 bb6f073bc159..6916a1d7e477 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 long uart_poll_timeout(struct uart_port *port)
> {
> - int timeout = uart_fifo_timeout(port);
> + unsigned long timeout = uart_fifo_timeout(port);
>
> return timeout > 6 ? (timeout / 2 - 2) : 1;
> }
>

Reviewed-by: Ilpo Järvinen <[email protected]>

--
i.