Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: Aaron Brice <aaron.brice@datasoft.com>, gregkh@linuxfoundation.org
Cc: jslaby@suse.com, bhuvanchandra.dv@toradex.com,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] tty: serial: fsl_lpuart: Fix Tx DMA edge case
Date: Fri, 07 Oct 2016 11:06:25 -0700	[thread overview]
Message-ID: <a93b300237eef1e9a02f680e96449504@agner.ch> (raw)
In-Reply-To: <1475791984-17705-1-git-send-email-aaron.brice@datasoft.com>

On 2016-10-06 15:13, Aaron Brice wrote:
> In the case where head == 0 on the circular buffer, there should be one
> DMA buffer, not two.  The second zero-length buffer would break the
> lpuart driver, transfer would never complete.

That looks right, and seems to work fine here:

Acked-by: Stefan Agner <stefan@agner.ch>
Tested-by: Stefan Agner <stefan@agner.ch>

@Greg, would be good if this would still make it into 4.9.

--
Stefan

> 
> Signed-off-by: Aaron Brice <aaron.brice@datasoft.com>
> ---
>  drivers/tty/serial/fsl_lpuart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
> index de9d510..76103f2 100644
> --- a/drivers/tty/serial/fsl_lpuart.c
> +++ b/drivers/tty/serial/fsl_lpuart.c
> @@ -328,7 +328,7 @@ static void lpuart_dma_tx(struct lpuart_port *sport)
>  
>  	sport->dma_tx_bytes = uart_circ_chars_pending(xmit);
>  
> -	if (xmit->tail < xmit->head) {
> +	if (xmit->tail < xmit->head || xmit->head == 0) {
>  		sport->dma_tx_nents = 1;
>  		sg_init_one(sgl, xmit->buf + xmit->tail, sport->dma_tx_bytes);
>  	} else {
> @@ -359,7 +359,6 @@ static void lpuart_dma_tx(struct lpuart_port *sport)
>  	sport->dma_tx_in_progress = true;
>  	sport->dma_tx_cookie = dmaengine_submit(sport->dma_tx_desc);
>  	dma_async_issue_pending(sport->dma_tx_chan);
> -
>  }
>  
>  static void lpuart_dma_tx_complete(void *arg)

  reply	other threads:[~2016-10-07 18:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 22:13 [PATCH] tty: serial: fsl_lpuart: Fix Tx DMA edge case Aaron Brice
2016-10-07 18:06 ` Stefan Agner [this message]
2016-10-10 11:12 ` Bhuvanchandra DV

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=a93b300237eef1e9a02f680e96449504@agner.ch \
    --to=stefan@agner.ch \
    --cc=aaron.brice@datasoft.com \
    --cc=bhuvanchandra.dv@toradex.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox