Re: [PATCH] serial: ifx6x60: ifx_spi_write don't need to do mrdy_assert when fifo is not empty.

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

 



On Tue, 06 Nov 2012 04:28:54 -0500
Jun Chen <jun.d.chen@xxxxxxxxx> wrote:

> 
> This patch check whether the kfifo lenth equal to the count of write data.If condition
> is true,ifx_spi_write need to trigger one mrdy_assert. If condition is false,the mrdy_assert
> will be triggered by the next ifx_spi_io.
> Cc: Bi Chao <chao.bi@xxxxxxxxx>
> Signed-off-by: Chen Jun <jun.d.chen@xxxxxxxxx>
> ---
>  drivers/tty/serial/ifx6x60.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
> index ac718e1..b52ef8d 100644
> --- a/drivers/tty/serial/ifx6x60.c
> +++ b/drivers/tty/serial/ifx6x60.c
> @@ -522,7 +522,8 @@ static int ifx_spi_write(struct tty_struct *tty, const unsigned char *buf,
>  	unsigned char *tmp_buf = (unsigned char *)buf;
>  	int tx_count = kfifo_in_locked(&ifx_dev->tx_fifo, tmp_buf, count,
>  				   &ifx_dev->fifo_lock);
> -	mrdy_assert(ifx_dev);
> +	if (kfifo_len(&ifx_dev->tx_fifo) == count)
> +		mrdy_assert(ifx_dev);
>  	return tx_count;

I'm not convinced this is safe. What stops the sending task from emptying
data out of the fifo between the kfifo_in_locked and the kfifo_len check ?

Can't you just check tx_count ?

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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