From: daniel@caiaq.de (Daniel Mack)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] serial/imx: check that the buffer is non-empty before sending it out
Date: Thu, 14 Oct 2010 13:27:35 +0200 [thread overview]
Message-ID: <20101014112735.GK10432@buzzloop.caiaq.de> (raw)
In-Reply-To: <1286960637-11600-1-git-send-email-u.kleine-koenig@pengutronix.de>
On Wed, Oct 13, 2010 at 11:03:57AM +0200, Uwe Kleine-K?nig wrote:
> From: Volker Ernst <volker.ernst@txtr.com>
>
> The .start_tx callback (imx_start_tx here) isn't only called when the
> buffer is non-empty. E.g. after resume or when handshaking is enabled
> and the other side starts to signal being ready.
>
> So check for an empty puffer already before sending the first character.
> This prevents sending out stale (or uninitialised) data.
>
> Signed-off-by: Volker Ernst <volker.ernst@txtr.com>
> Signed-off-by: Daniel Mack <daniel@caiaq.de>
> Cc: Andy Green <andy@warmcat.com>
> [ukl: reword commit log, put check in while condition]
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> as I didn't sent a patch, here comes my current version. Don't know if
> it makes it easier to test for you ...
>
> I faked Daniel's SoB as Andrew said he did, compressed the changelog a
> bit and put the check in the while condition as I suggested.
FWIW, that looks good to me. Thanks for finishing the work :)
Daniel
> drivers/serial/imx.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
> index 66ecc7a..dfcf4b1 100644
> --- a/drivers/serial/imx.c
> +++ b/drivers/serial/imx.c
> @@ -327,14 +327,13 @@ static inline void imx_transmit_buffer(struct imx_port *sport)
> {
> struct circ_buf *xmit = &sport->port.state->xmit;
>
> - while (!(readl(sport->port.membase + UTS) & UTS_TXFULL)) {
> + while (!uart_circ_empty(xmit) &&
> + !(readl(sport->port.membase + UTS) & UTS_TXFULL)) {
> /* send xmit->buf[xmit->tail]
> * out the port here */
> writel(xmit->buf[xmit->tail], sport->port.membase + URTX0);
> xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> sport->port.icount.tx++;
> - if (uart_circ_empty(xmit))
> - break;
> }
>
> if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
> --
> 1.7.2.3
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2010-10-14 11:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 16:57 [PATCH] ARM: imx serial driver: fix resume Daniel Mack
2010-10-07 22:56 ` Andrew Morton
2010-10-08 9:16 ` Uwe Kleine-König
2010-10-13 9:03 ` [PATCH] serial/imx: check that the buffer is non-empty before sending it out Uwe Kleine-König
2010-10-14 11:27 ` Daniel Mack [this message]
2010-10-14 18:47 ` Greg KH
2010-10-12 17:56 ` [PATCH] ARM: imx serial driver: fix resume Uwe Kleine-König
2010-10-12 18:32 ` Daniel Mack
2010-10-13 8:46 ` Uwe Kleine-König
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=20101014112735.GK10432@buzzloop.caiaq.de \
--to=daniel@caiaq.de \
--cc=linux-arm-kernel@lists.infradead.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.