Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: export the key functions for an 8250 IRQ handler

For drivers that need to construct their own IRQ handler, the
three components are seen in the current handle_port -- i.e.
Rx, Tx and modem_status.

Make these exported symbols so that "almost" 8250 UARTs can
construct their own IRQ handler with these shared components,
while working around their own unique errata issues.

The function names are given a serial8250 prefix, since they
are now entering the global namespace.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Paul Gortmaker and committed by
Greg Kroah-Hartman
3986fb2b 0690f41f

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