[v5,1/2] serial: core: Update uart_poll_timeout() function to return unsigned long

Message ID 20231030073542.251281-2-vamshigajjela@google.com
State New
Headers
Series serial core type consistency and clean up |

Commit Message

Vamshi Gajjela Oct. 30, 2023, 7:35 a.m. UTC
  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 <vamshigajjela@google.com>
---
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(-)
  

Comments

Ilpo Järvinen Oct. 30, 2023, 9:25 a.m. UTC | #1
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 <vamshigajjela@google.com>
> ---
> 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 <ilpo.jarvinen@linux.intel.com>
  

Patch

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;
 }