aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/serial/8250.c29
-rw-r--r--include/linux/serial_8250.h4
2 files changed, 19 insertions, 14 deletions
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index 5274228fa03c..9c0396fa3915 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -1300,8 +1300,6 @@ static void serial8250_stop_tx(struct uart_port *port)
1300 } 1300 }
1301} 1301}
1302 1302
1303static void transmit_chars(struct uart_8250_port *up);
1304
1305static void serial8250_start_tx(struct uart_port *port) 1303static void serial8250_start_tx(struct uart_port *port)
1306{ 1304{
1307 struct uart_8250_port *up = 1305 struct uart_8250_port *up =
@@ -1318,7 +1316,7 @@ static void serial8250_start_tx(struct uart_port *port)
1318 if ((up->port.type == PORT_RM9000) ? 1316 if ((up->port.type == PORT_RM9000) ?
1319 (lsr & UART_LSR_THRE) : 1317 (lsr & UART_LSR_THRE) :
1320 (lsr & UART_LSR_TEMT)) 1318 (lsr & UART_LSR_TEMT))
1321 transmit_chars(up); 1319 serial8250_tx_chars(up);
1322 } 1320 }
1323 } 1321 }
1324 1322
@@ -1376,12 +1374,12 @@ static void clear_rx_fifo(struct uart_8250_port *up)
1376} 1374}
1377 1375
1378/* 1376/*
1379 * receive_chars: processes according to the passed in LSR 1377 * serial8250_rx_chars: processes according to the passed in LSR
1380 * value, and returns the remaining LSR bits not handled 1378 * value, and returns the remaining LSR bits not handled
1381 * by this Rx routine. 1379 * by this Rx routine.
1382 */ 1380 */
1383static unsigned char 1381unsigned char
1384receive_chars(struct uart_8250_port *up, unsigned char lsr) 1382serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr)
1385{ 1383{
1386 struct tty_struct *tty = up->port.state->port.tty; 1384 struct tty_struct *tty = up->port.state->port.tty;
1387 unsigned char ch; 1385 unsigned char ch;
@@ -1462,8 +1460,9 @@ ignore_char:
1462 spin_lock(&up->port.lock); 1460 spin_lock(&up->port.lock);
1463 return lsr; 1461 return lsr;
1464} 1462}
1463EXPORT_SYMBOL_GPL(serial8250_rx_chars);
1465 1464
1466static void transmit_chars(struct uart_8250_port *up) 1465void serial8250_tx_chars(struct uart_8250_port *up)
1467{ 1466{
1468 struct circ_buf *xmit = &up->port.state->xmit; 1467 struct circ_buf *xmit = &up->port.state->xmit;
1469 int count; 1468 int count;
@@ -1500,8 +1499,9 @@ static void transmit_chars(struct uart_8250_port *up)
1500 if (uart_circ_empty(xmit)) 1499 if (uart_circ_empty(xmit))
1501 __stop_tx(up); 1500 __stop_tx(up);
1502} 1501}
1502EXPORT_SYMBOL_GPL(serial8250_tx_chars);
1503 1503
1504static unsigned int check_modem_status(struct uart_8250_port *up) 1504unsigned int serial8250_modem_status(struct uart_8250_port *up)
1505{ 1505{
1506 unsigned int status = serial_in(up, UART_MSR); 1506 unsigned int status = serial_in(up, UART_MSR);
1507 1507
@@ -1523,6 +1523,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
1523 1523
1524 return status; 1524 return status;
1525} 1525}
1526EXPORT_SYMBOL_GPL(serial8250_modem_status);
1526 1527
1527/* 1528/*
1528 * This handles the interrupt from one port. 1529 * This handles the interrupt from one port.
@@ -1539,10 +1540,10 @@ static void serial8250_handle_port(struct uart_8250_port *up)
1539 DEBUG_INTR("status = %x...", status); 1540 DEBUG_INTR("status = %x...", status);
1540 1541
1541 if (status & (UART_LSR_DR | UART_LSR_BI)) 1542 if (status & (UART_LSR_DR | UART_LSR_BI))
1542 status = receive_chars(up, status); 1543 status = serial8250_rx_chars(up, status);
1543 check_modem_status(up); 1544 serial8250_modem_status(up);
1544 if (status & UART_LSR_THRE) 1545 if (status & UART_LSR_THRE)
1545 transmit_chars(up); 1546 serial8250_tx_chars(up);
1546 1547
1547 spin_unlock_irqrestore(&up->port.lock, flags); 1548 spin_unlock_irqrestore(&up->port.lock, flags);
1548} 1549}
@@ -1782,7 +1783,7 @@ static void serial8250_backup_timeout(unsigned long data)
1782 } 1783 }
1783 1784
1784 if (!(iir & UART_IIR_NO_INT)) 1785 if (!(iir & UART_IIR_NO_INT))
1785 transmit_chars(up); 1786 serial8250_tx_chars(up);
1786 1787
1787 if (is_real_interrupt(up->port.irq)) 1788 if (is_real_interrupt(up->port.irq))
1788 serial_out(up, UART_IER, ier); 1789 serial_out(up, UART_IER, ier);
@@ -1816,7 +1817,7 @@ static unsigned int serial8250_get_mctrl(struct uart_port *port)
1816 unsigned int status; 1817 unsigned int status;
1817 unsigned int ret; 1818 unsigned int ret;
1818 1819
1819 status = check_modem_status(up); 1820 status = serial8250_modem_status(up);
1820 1821
1821 ret = 0; 1822 ret = 0;
1822 if (status & UART_MSR_DCD) 1823 if (status & UART_MSR_DCD)
@@ -2863,7 +2864,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
2863 * while processing with interrupts off. 2864 * while processing with interrupts off.
2864 */ 2865 */
2865 if (up->msr_saved_flags) 2866 if (up->msr_saved_flags)
2866 check_modem_status(up); 2867 serial8250_modem_status(up);
2867 2868
2868 if (locked) 2869 if (locked)
2869 spin_unlock(&up->port.lock); 2870 spin_unlock(&up->port.lock);
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 1f05bbeac01e..b44034eca123 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -66,6 +66,7 @@ enum {
66 * dependent on the 8250 driver. 66 * dependent on the 8250 driver.
67 */ 67 */
68struct uart_port; 68struct uart_port;
69struct uart_8250_port;
69 70
70int serial8250_register_port(struct uart_port *); 71int serial8250_register_port(struct uart_port *);
71void serial8250_unregister_port(int line); 72void serial8250_unregister_port(int line);
@@ -82,6 +83,9 @@ extern void serial8250_do_set_termios(struct uart_port *port,
82extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 83extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
83 unsigned int oldstate); 84 unsigned int oldstate);
84int serial8250_handle_irq(struct uart_port *port, unsigned int iir); 85int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
86unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr);
87void serial8250_tx_chars(struct uart_8250_port *up);
88unsigned int serial8250_modem_status(struct uart_8250_port *up);
85 89
86extern void serial8250_set_isa_configurator(void (*v) 90extern void serial8250_set_isa_configurator(void (*v)
87 (int port, struct uart_port *up, 91 (int port, struct uart_port *up,