serial: ifx6x60: ifx_spi_write don't need to do mrdy_assert when fifo is not empty.
PATCH 1/1 serial: ifx6x60: ifx_spi_write don't need to do mrdy_assert when fifo is not empty.
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.
--- drivers/tty/serial/ifx6x60.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/tty/serial/ifx6x60.c +2 -1
@@ -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; }
Signature · 1 line
1.7.4.1
Quoted 15 lines · On Tue, 06 Nov 2012 04:28:54 -0500 Jun Chen <[email protected]> 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,themrdy_assertwill be triggered by the nextifx_spi_io.Cc Bi Chao <[email protected]>Signed-off-by Chen Jun <[email protected]>--- drivers/tty/serial/ifx6x60.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/tty/serial/ifx6x60.c +0
-0
drivers/tty/serial/ifx6x60.c static int ifx_spi_write(struct tty_struct *tty, const unsigned char *buf, · line 527
Quoted 7 lines
drivers/tty/serial/ifx6x60.c +2
-1@@ -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
Hi,Alan
Thank for your question, I will update this patch in other email.
-----Original Message-----
From: Alan Cox [mailto:[email protected]]
Sent: Tuesday, November 06, 2012 5:47 PM
To: Chen, Jun D
Cc: Alan Cox; serial; Gorby, Russ; Bi, Chao
Subject: Re: [PATCH] serial: ifx6x60: ifx_spi_write don't need to do mrdy_assert when fifo is not empty.
Quoted 15 lines · On Tue, 06 Nov 2012 04:28:54 -0500 Jun Chen <[email protected]> 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 onemrdy_assert. If condition is false,themrdy_assertwill be triggered by the nextifx_spi_io.Cc Bi Chao <[email protected]>Signed-off-by Chen Jun <[email protected]>--- drivers/tty/serial/ifx6x60.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/ifx6x60.cindex ac718e1..b52ef8d 100644
drivers/tty/serial/ifx6x60.c static int ifx_spi_write(struct tty_struct *tty, const unsigned char *buf, · line 527
Quoted 7 lines
drivers/tty/serial/ifx6x60.c +2
-1@@ -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