All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sonic Zhang <sonic.adi@gmail.com>
Cc: linux-serial@vger.kernel.org,
	uclinux-dist-devel@blackfin.uclinux.org,
	Sonic Zhang <sonic.zhang@analog.com>
Subject: Re: [PATCH] serial: bfin_uart: Don't switch baud rate untill the transfer buffer is empty.
Date: Thu, 15 Nov 2012 16:59:46 -0800	[thread overview]
Message-ID: <20121116005946.GA1727@kroah.com> (raw)
In-Reply-To: <1352264142-30771-1-git-send-email-sonic.adi@gmail.com>

On Wed, Nov 07, 2012 at 12:55:42PM +0800, Sonic Zhang wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> set_termios may be invoked before the former data transfer is completed. Block until the
> tranfer is done.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
> ---
>  drivers/tty/serial/bfin_uart.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
> index 9242d56..71c0c09 100644
> --- a/drivers/tty/serial/bfin_uart.c
> +++ b/drivers/tty/serial/bfin_uart.c
> @@ -869,6 +869,10 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
>  
>  	UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15);
>  
> +	/* Wait till the transfer buffer is empty */
> +	while (UART_GET_GCTL(uart) & UCEN && !(UART_GET_LSR(uart) & TEMT))
> +		barrier();

Where is the "the hardware is hung" break out of this loop?

And why "barrier()"?

thanks,

greg k-h

  reply	other threads:[~2012-11-16  0:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-07  4:55 [PATCH] serial: bfin_uart: Don't switch baud rate untill the transfer buffer is empty Sonic Zhang
2012-11-16  0:59 ` Greg Kroah-Hartman [this message]
2012-11-19  6:31   ` Zhang, Sonic

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=20121116005946.GA1727@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sonic.adi@gmail.com \
    --cc=sonic.zhang@analog.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.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.