Commit 23d22cea authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

serial: switch the serial core to int put_char methods

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 56dbbb9a
...@@ -422,6 +422,7 @@ uart_get_divisor(struct uart_port *port, unsigned int baud) ...@@ -422,6 +422,7 @@ uart_get_divisor(struct uart_port *port, unsigned int baud)
EXPORT_SYMBOL(uart_get_divisor); EXPORT_SYMBOL(uart_get_divisor);
/* FIXME: Consistent locking policy */
static void static void
uart_change_speed(struct uart_state *state, struct ktermios *old_termios) uart_change_speed(struct uart_state *state, struct ktermios *old_termios)
{ {
...@@ -454,27 +455,30 @@ uart_change_speed(struct uart_state *state, struct ktermios *old_termios) ...@@ -454,27 +455,30 @@ uart_change_speed(struct uart_state *state, struct ktermios *old_termios)
port->ops->set_termios(port, termios, old_termios); port->ops->set_termios(port, termios, old_termios);
} }
static inline void static inline int
__uart_put_char(struct uart_port *port, struct circ_buf *circ, unsigned char c) __uart_put_char(struct uart_port *port, struct circ_buf *circ, unsigned char c)
{ {
unsigned long flags; unsigned long flags;
int ret = 0;
if (!circ->buf) if (!circ->buf)
return; return 0;
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
if (uart_circ_chars_free(circ) != 0) { if (uart_circ_chars_free(circ) != 0) {
circ->buf[circ->head] = c; circ->buf[circ->head] = c;
circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1); circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1);
ret = 1;
} }
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
return ret;
} }
static void uart_put_char(struct tty_struct *tty, unsigned char ch) static int uart_put_char(struct tty_struct *tty, unsigned char ch)
{ {
struct uart_state *state = tty->driver_data; struct uart_state *state = tty->driver_data;
__uart_put_char(state->port, &state->info->xmit, ch); return __uart_put_char(state->port, &state->info->xmit, ch);
} }
static void uart_flush_chars(struct tty_struct *tty) static void uart_flush_chars(struct tty_struct *tty)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment