All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, shawn.guo@linaro.org,
	Huang Shijie <b32955@freescale.com>
Subject: [PATCH 3/4] serial: imx: fix the wrong number of scatterlist entries when xmit->head is 0
Date: Fri, 11 Oct 2013 18:31:00 +0800	[thread overview]
Message-ID: <1381487461-12850-4-git-send-email-b32955@freescale.com> (raw)
In-Reply-To: <1381487461-12850-1-git-send-email-b32955@freescale.com>

When the (xmit->tail > xmit->head) is true and the xmit->head is 0,
we only need one DMA scatterlist in actually. Current code uses two DMA
scatterlists in this case, this is obviously wrong.

This patch fixes it.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/tty/serial/imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index c6c3b16..cadf7e5 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -532,7 +532,7 @@ static void dma_tx_work(struct work_struct *w)
 		return;
 	}
 
-	if (xmit->tail > xmit->head) {
+	if (xmit->tail > xmit->head && xmit->head > 0) {
 		sport->dma_tx_nents = 2;
 		sg_init_table(sgl, 2);
 		sg_set_buf(sgl, xmit->buf + xmit->tail,
-- 
1.7.2.rc3



WARNING: multiple messages have this Message-ID (diff)
From: b32955@freescale.com (Huang Shijie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] serial: imx: fix the wrong number of scatterlist entries when xmit->head is 0
Date: Fri, 11 Oct 2013 18:31:00 +0800	[thread overview]
Message-ID: <1381487461-12850-4-git-send-email-b32955@freescale.com> (raw)
In-Reply-To: <1381487461-12850-1-git-send-email-b32955@freescale.com>

When the (xmit->tail > xmit->head) is true and the xmit->head is 0,
we only need one DMA scatterlist in actually. Current code uses two DMA
scatterlists in this case, this is obviously wrong.

This patch fixes it.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/tty/serial/imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index c6c3b16..cadf7e5 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -532,7 +532,7 @@ static void dma_tx_work(struct work_struct *w)
 		return;
 	}
 
-	if (xmit->tail > xmit->head) {
+	if (xmit->tail > xmit->head && xmit->head > 0) {
 		sport->dma_tx_nents = 2;
 		sg_init_table(sgl, 2);
 		sg_set_buf(sgl, xmit->buf + xmit->tail,
-- 
1.7.2.rc3

  parent reply	other threads:[~2013-10-11 10:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 10:30 [PATCH 0/4] serail: imx: patches for DMA Huang Shijie
2013-10-11 10:30 ` Huang Shijie
2013-10-11 10:30 ` [PATCH 1/4] serial: imx: implement the flush_buffer hook Huang Shijie
2013-10-11 10:30   ` Huang Shijie
2014-06-03  5:51   ` Wang, Jiada (ESD)
2014-06-03  5:51     ` Wang, Jiada (ESD)
2013-10-11 10:30 ` [PATCH 2/4] serial: imx: check the DMA for imx_tx_empty Huang Shijie
2013-10-11 10:30   ` Huang Shijie
2013-10-11 10:31 ` Huang Shijie [this message]
2013-10-11 10:31   ` [PATCH 3/4] serial: imx: fix the wrong number of scatterlist entries when xmit->head is 0 Huang Shijie
2013-10-11 10:31 ` [PATCH 4/4] serial: imx: use the dmaengine_tx_status Huang Shijie
2013-10-11 10:31   ` Huang Shijie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381487461-12850-4-git-send-email-b32955@freescale.com \
    --to=b32955@freescale.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.