Skip to content

Commit

Permalink
atmel_serial: use cpu_relax() when busy-waiting
Browse files Browse the repository at this point in the history
Replace two instances of barrier() with cpu_relax() since that's the right
thing to do when busy-waiting.  This does not actually change anything since
cpu_relax() is defined as barrier() on both ARM and AVR32.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Acked-by: Andrew Victor <linux@maxim.org.za>
Tested-by: Marc Pignat <marc.pignat@hevs.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Haavard Skinnemoen authored and Linus Torvalds committed Feb 8, 2008
1 parent b843aa2 commit 829dd81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/serial/atmel_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
imr = UART_GET_IMR(port);
UART_PUT_IDR(port, -1);
while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY))
barrier();
cpu_relax();

/* disable receiver and transmitter */
UART_PUT_CR(port, ATMEL_US_TXDIS | ATMEL_US_RXDIS);
Expand Down Expand Up @@ -794,7 +794,7 @@ void __init atmel_register_uart_fns(struct atmel_port_fns *fns)
static void atmel_console_putchar(struct uart_port *port, int ch)
{
while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY))
barrier();
cpu_relax();
UART_PUT_CHAR(port, ch);
}

Expand Down

0 comments on commit 829dd81

Please sign in to comment.