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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 14 Oct 2023, Vamshi Gajjela wrote:

> 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)

This is in jiffies so why don't you return unsigned long instead also 
here?

>  {
> -	int timeout = uart_fifo_timeout(port);
> +	unsigned int timeout = (u32)uart_fifo_timeout(port);

Use unsigned long and avoid casting entirely?
>  
>  	return timeout > 6 ? (timeout / 2 - 2) : 1;
>  }
> 

-- 
 i.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux