From: Russell King Date: Wed, 31 Aug 2005 09:12:14 +0000 (+0100) Subject: [SERIAL] Clean up and fix tty transmission start/stoping X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b129a8ccd53f74c43e4c83c8e0031a4990040830;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [SERIAL] Clean up and fix tty transmission start/stoping The start_tx and stop_tx methods were passed a flag to indicate whether the start/stop was from the tty start/stop callbacks, and some drivers used this flag to decide whether to ask the UART to immediately stop transmission (where the UART supports such a feature.) There are other cases when we wish this to occur - when CTS is lowered, or if we change from soft to hard flow control and CTS is inactive. In these cases, this flag was false, and we would allow the transmitter to drain before stopping. There is really only one case where we want to let the transmitter drain before disabling, and that's when we run out of characters to send. Hence, re-jig the start_tx and stop_tx methods to eliminate this flag, and introduce new functions for the special "disable and allow transmitter to drain" case. Signed-off-by: Russell King --- b129a8ccd53f74c43e4c83c8e0031a4990040830 diff --cc Documentation/serial/driver index ac7eabbf662,ac7eabbf662..87856d3cfb6 --- a/Documentation/serial/driver +++ b/Documentation/serial/driver @@@ -111,24 -111,24 +111,17 @@@ hardware Interrupts: locally disabled. This call must not sleep -- stop_tx(port,tty_stop) ++ stop_tx(port) Stop transmitting characters. This might be due to the CTS line becoming inactive or the tty layer indicating we want -- to stop transmission. -- -- tty_stop: 1 if this call is due to the TTY layer issuing a -- TTY stop to the driver (equiv to rs_stop). ++ to stop transmission due to an XOFF character. Locking: port->lock taken. Interrupts: locally disabled. This call must not sleep -- start_tx(port,tty_start) -- start transmitting characters. (incidentally, nonempty will -- always be nonzero, and shouldn't be used - it will be dropped). -- -- tty_start: 1 if this call was due to the TTY layer issuing -- a TTY start to the driver (equiv to rs_start) ++ start_tx(port) ++ start transmitting characters. Locking: port->lock taken. Interrupts: locally disabled. diff --cc drivers/serial/21285.c index 0b10169961e,0b10169961e..aec39fb261c --- a/drivers/serial/21285.c +++ b/drivers/serial/21285.c @@@ -58,8 -58,8 +58,7 @@@ static const char serial21285_name[] = * int((BAUD_BASE - (baud >> 1)) / baud) */ --static void --serial21285_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void serial21285_stop_tx(struct uart_port *port) { if (tx_enabled(port)) { disable_irq(IRQ_CONTX); @@@ -67,8 -67,8 +66,7 @@@ } } --static void --serial21285_start_tx(struct uart_port *port, unsigned int tty_start) ++static void serial21285_start_tx(struct uart_port *port) { if (!tx_enabled(port)) { enable_irq(IRQ_CONTX); @@@ -148,7 -148,7 +146,7 @@@ static irqreturn_t serial21285_tx_chars goto out; } if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- serial21285_stop_tx(port, 0); ++ serial21285_stop_tx(port); goto out; } @@@ -164,7 -164,7 +162,7 @@@ uart_write_wakeup(port); if (uart_circ_empty(xmit)) -- serial21285_stop_tx(port, 0); ++ serial21285_stop_tx(port); out: return IRQ_HANDLED; diff --cc drivers/serial/8250.c index 7e8fc7c1d4c,7e8fc7c1d4c..cedb5f2f35c --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@@ -1001,7 -1001,7 +1001,7 @@@ static inline void __stop_tx(struct uar } } --static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void serial8250_stop_tx(struct uart_port *port) { struct uart_8250_port *up = (struct uart_8250_port *)port; @@@ -1018,7 -1018,7 +1018,7 @@@ static void transmit_chars(struct uart_8250_port *up); --static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start) ++static void serial8250_start_tx(struct uart_port *port) { struct uart_8250_port *up = (struct uart_8250_port *)port; @@@ -1158,7 -1158,7 +1158,11 @@@ static _INLINE_ void transmit_chars(str up->port.x_char = 0; return; } -- if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { ++ if (uart_tx_stopped(&up->port)) { ++ serial8250_stop_tx(&up->port); ++ return; ++ } ++ if (uart_circ_empty(xmit)) { __stop_tx(up); return; } diff --cc drivers/serial/amba-pl010.c index 2884b310e54,2884b310e54..978e12437e6 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c @@@ -105,7 -105,7 +105,7 @@@ struct uart_amba_port unsigned int old_status; }; --static void pl010_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void pl010_stop_tx(struct uart_port *port) { unsigned int cr; @@@ -114,7 -114,7 +114,7 @@@ UART_PUT_CR(port, cr); } --static void pl010_start_tx(struct uart_port *port, unsigned int tty_start) ++static void pl010_start_tx(struct uart_port *port) { unsigned int cr; @@@ -219,7 -219,7 +219,7 @@@ static void pl010_tx_chars(struct uart_ return; } if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- pl010_stop_tx(port, 0); ++ pl010_stop_tx(port); return; } @@@ -236,7 -236,7 +236,7 @@@ uart_write_wakeup(port); if (uart_circ_empty(xmit)) -- pl010_stop_tx(port, 0); ++ pl010_stop_tx(port); } static void pl010_modem_status(struct uart_port *port) diff --cc drivers/serial/amba-pl011.c index 7db88ee18f7,7db88ee18f7..56071309744 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c @@@ -74,7 -74,7 +74,7 @@@ struct uart_amba_port unsigned int old_status; }; --static void pl011_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void pl011_stop_tx(struct uart_port *port) { struct uart_amba_port *uap = (struct uart_amba_port *)port; @@@ -82,7 -82,7 +82,7 @@@ writew(uap->im, uap->port.membase + UART011_IMSC); } --static void pl011_start_tx(struct uart_port *port, unsigned int tty_start) ++static void pl011_start_tx(struct uart_port *port) { struct uart_amba_port *uap = (struct uart_amba_port *)port; @@@ -184,7 -184,7 +184,7 @@@ static void pl011_tx_chars(struct uart_ return; } if (uart_circ_empty(xmit) || uart_tx_stopped(&uap->port)) { -- pl011_stop_tx(&uap->port, 0); ++ pl011_stop_tx(&uap->port); return; } @@@ -201,7 -201,7 +201,7 @@@ uart_write_wakeup(&uap->port); if (uart_circ_empty(xmit)) -- pl011_stop_tx(&uap->port, 0); ++ pl011_stop_tx(&uap->port); } static void pl011_modem_status(struct uart_amba_port *uap) diff --cc drivers/serial/au1x00_uart.c index 6104aeef124,6104aeef124..a274ebf256a --- a/drivers/serial/au1x00_uart.c +++ b/drivers/serial/au1x00_uart.c @@@ -200,7 -200,7 +200,7 @@@ static void autoconfig(struct uart_8250 DEBUG_AUTOCONF("type=%s\n", uart_config[up->port.type].name); } --static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void serial8250_stop_tx(struct uart_port *port) { struct uart_8250_port *up = (struct uart_8250_port *)port; @@@ -210,7 -210,7 +210,7 @@@ } } --static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start) ++static void serial8250_start_tx(struct uart_port *port) { struct uart_8250_port *up = (struct uart_8250_port *)port; @@@ -337,7 -337,7 +337,7 @@@ static _INLINE_ void transmit_chars(str return; } if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { -- serial8250_stop_tx(&up->port, 0); ++ serial8250_stop_tx(&up->port); return; } @@@ -356,7 -356,7 +356,7 @@@ DEBUG_INTR("THRE..."); if (uart_circ_empty(xmit)) -- serial8250_stop_tx(&up->port, 0); ++ serial8250_stop_tx(&up->port); } static _INLINE_ void check_modem_status(struct uart_8250_port *up) diff --cc drivers/serial/clps711x.c index e92522b33c4,e92522b33c4..d822896b488 --- a/drivers/serial/clps711x.c +++ b/drivers/serial/clps711x.c @@@ -69,8 -69,8 +69,7 @@@ #define tx_enabled(port) ((port)->unused[0]) --static void --clps711xuart_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void clps711xuart_stop_tx(struct uart_port *port) { if (tx_enabled(port)) { disable_irq(TX_IRQ(port)); @@@ -78,8 -78,8 +77,7 @@@ } } --static void --clps711xuart_start_tx(struct uart_port *port, unsigned int tty_start) ++static void clps711xuart_start_tx(struct uart_port *port) { if (!tx_enabled(port)) { enable_irq(TX_IRQ(port)); @@@ -165,7 -165,7 +163,7 @@@ static irqreturn_t clps711xuart_int_tx( return IRQ_HANDLED; } if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- clps711xuart_stop_tx(port, 0); ++ clps711xuart_stop_tx(port); return IRQ_HANDLED; } @@@ -182,7 -182,7 +180,7 @@@ uart_write_wakeup(port); if (uart_circ_empty(xmit)) -- clps711xuart_stop_tx(port, 0); ++ clps711xuart_stop_tx(port); return IRQ_HANDLED; } diff --cc drivers/serial/cpm_uart/cpm_uart_core.c index d639ac92a11,29db677d428..282b32351d8 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c @@@ -124,7 -109,7 +124,7 @@@ static unsigned int cpm_uart_get_mctrl( /* * Stop transmitter */ --static void cpm_uart_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void cpm_uart_stop_tx(struct uart_port *port) { struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; volatile smc_t *smcp = pinfo->smcp; @@@ -141,7 -126,7 +141,7 @@@ /* * Start transmitter */ --static void cpm_uart_start_tx(struct uart_port *port, unsigned int tty_start) ++static void cpm_uart_start_tx(struct uart_port *port) { struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; volatile smc_t *smcp = pinfo->smcp; @@@ -623,7 -586,7 +623,7 @@@ static int cpm_uart_tx_pump(struct uart } if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- cpm_uart_stop_tx(port, 0); ++ cpm_uart_stop_tx(port); return 0; } @@@ -656,7 -618,7 +656,7 @@@ uart_write_wakeup(port); if (uart_circ_empty(xmit)) { -- cpm_uart_stop_tx(port, 0); ++ cpm_uart_stop_tx(port); return 0; } diff --cc drivers/serial/dz.c index 97824eeeafa,97824eeeafa..e63b9dffc8d --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c @@@ -112,7 -112,7 +112,7 @@@ static inline void dz_out(struct dz_por * ------------------------------------------------------------ */ --static void dz_stop_tx(struct uart_port *uport, unsigned int tty_stop) ++static void dz_stop_tx(struct uart_port *uport) { struct dz_port *dport = (struct dz_port *)uport; unsigned short tmp, mask = 1 << dport->port.line; @@@ -125,7 -125,7 +125,7 @@@ spin_unlock_irqrestore(&dport->port.lock, flags); } --static void dz_start_tx(struct uart_port *uport, unsigned int tty_start) ++static void dz_start_tx(struct uart_port *uport) { struct dz_port *dport = (struct dz_port *)uport; unsigned short tmp, mask = 1 << dport->port.line; @@@ -290,7 -290,7 +290,7 @@@ static inline void dz_transmit_chars(st } /* if nothing to do or stopped or hardware stopped */ if (uart_circ_empty(xmit) || uart_tx_stopped(&dport->port)) { -- dz_stop_tx(&dport->port, 0); ++ dz_stop_tx(&dport->port); return; } @@@ -308,7 -308,7 +308,7 @@@ /* Are we done */ if (uart_circ_empty(xmit)) -- dz_stop_tx(&dport->port, 0); ++ dz_stop_tx(&dport->port); } /* @@@ -440,7 -440,7 +440,7 @@@ static int dz_startup(struct uart_port */ static void dz_shutdown(struct uart_port *uport) { -- dz_stop_tx(uport, 0); ++ dz_stop_tx(uport); } /* diff --cc drivers/serial/icom.c index c112b32764e,c112b32764e..79f8df4d66b --- a/drivers/serial/icom.c +++ b/drivers/serial/icom.c @@@ -989,18 -989,18 +989,16 @@@ static unsigned int icom_get_mctrl(stru return result; } --static void icom_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void icom_stop_tx(struct uart_port *port) { unsigned char cmdReg; -- if (tty_stop) { -- trace(ICOM_PORT, "STOP", 0); -- cmdReg = readb(&ICOM_PORT->dram->CmdReg); -- writeb(cmdReg | CMD_HOLD_XMIT, &ICOM_PORT->dram->CmdReg); -- } ++ trace(ICOM_PORT, "STOP", 0); ++ cmdReg = readb(&ICOM_PORT->dram->CmdReg); ++ writeb(cmdReg | CMD_HOLD_XMIT, &ICOM_PORT->dram->CmdReg); } --static void icom_start_tx(struct uart_port *port, unsigned int tty_start) ++static void icom_start_tx(struct uart_port *port) { unsigned char cmdReg; diff --cc drivers/serial/imx.c index 01a8726a3f9,01a8726a3f9..8861bcf84ad --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c @@@ -124,7 -124,7 +124,7 @@@ static void imx_timeout(unsigned long d /* * interrupts disabled on entry */ --static void imx_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void imx_stop_tx(struct uart_port *port) { struct imx_port *sport = (struct imx_port *)port; UCR1((u32)sport->port.membase) &= ~UCR1_TXMPTYEN; @@@ -165,13 -165,13 +165,13 @@@ static inline void imx_transmit_buffer( } while (!(UTS((u32)sport->port.membase) & UTS_TXFULL)); if (uart_circ_empty(xmit)) -- imx_stop_tx(&sport->port, 0); ++ imx_stop_tx(&sport->port); } /* * interrupts disabled on entry */ --static void imx_start_tx(struct uart_port *port, unsigned int tty_start) ++static void imx_start_tx(struct uart_port *port) { struct imx_port *sport = (struct imx_port *)port; @@@ -196,7 -196,7 +196,7 @@@ static irqreturn_t imx_txint(int irq, v } if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) { -- imx_stop_tx(&sport->port, 0); ++ imx_stop_tx(&sport->port); goto out; } diff --cc drivers/serial/ioc4_serial.c index 793c3a7cbe4,793c3a7cbe4..0c5c96a582b --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c @@@ -2373,10 -2373,10 +2373,9 @@@ static unsigned int ic4_tx_empty(struc /** * ic4_stop_tx - stop the transmitter * @port: Port to operate on -- * @tty_stop: Set to 1 if called via uart_stop * */ --static void ic4_stop_tx(struct uart_port *the_port, unsigned int tty_stop) ++static void ic4_stop_tx(struct uart_port *the_port) { } @@@ -2471,10 -2471,10 +2470,9 @@@ static unsigned int ic4_get_mctrl(struc /** * ic4_start_tx - Start transmitter, flush any output * @port: Port to operate on -- * @tty_stop: Set to 1 if called via uart_start * */ --static void ic4_start_tx(struct uart_port *the_port, unsigned int tty_stop) ++static void ic4_start_tx(struct uart_port *the_port) { struct ioc4_port *port = get_ioc4_port(the_port); unsigned long flags; diff --cc drivers/serial/ip22zilog.c index ea5bf4d4daa,ea5bf4d4daa..ef132349f31 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c @@@ -592,7 -592,7 +592,7 @@@ static void ip22zilog_set_mctrl(struct } /* The port lock is held and interrupts are disabled. */ --static void ip22zilog_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void ip22zilog_stop_tx(struct uart_port *port) { struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port; @@@ -600,7 -600,7 +600,7 @@@ } /* The port lock is held and interrupts are disabled. */ --static void ip22zilog_start_tx(struct uart_port *port, unsigned int tty_start) ++static void ip22zilog_start_tx(struct uart_port *port) { struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port; struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port); diff --cc drivers/serial/jsm/jsm_tty.c index 98de2258fd0,98de2258fd0..6fa0d62d6f6 --- a/drivers/serial/jsm/jsm_tty.c +++ b/drivers/serial/jsm/jsm_tty.c @@@ -113,7 -113,7 +113,7 @@@ static void jsm_tty_set_mctrl(struct ua udelay(10); } --static void jsm_tty_start_tx(struct uart_port *port, unsigned int tty_start) ++static void jsm_tty_start_tx(struct uart_port *port) { struct jsm_channel *channel = (struct jsm_channel *)port; @@@ -125,7 -125,7 +125,7 @@@ jsm_printk(IOCTL, INFO, &channel->ch_bd->pci_dev, "finish\n"); } --static void jsm_tty_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void jsm_tty_stop_tx(struct uart_port *port) { struct jsm_channel *channel = (struct jsm_channel *)port; diff --cc drivers/serial/m32r_sio.c index 9b50560b9d1,0301feacbde..b0ecc7537ce --- a/drivers/serial/m32r_sio.c +++ b/drivers/serial/m32r_sio.c @@@ -275,7 -275,7 +275,7 @@@ serial_out(struct uart_sio_port *up, in __sio_out(value, offset); } --static void m32r_sio_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void m32r_sio_stop_tx(struct uart_port *port) { struct uart_sio_port *up = (struct uart_sio_port *)port; @@@ -285,7 -285,7 +285,7 @@@ } } --static void m32r_sio_start_tx(struct uart_port *port, unsigned int tty_start) ++static void m32r_sio_start_tx(struct uart_port *port) { #ifdef CONFIG_SERIAL_M32R_PLDSIO struct uart_sio_port *up = (struct uart_sio_port *)port; @@@ -425,7 -425,7 +425,7 @@@ static _INLINE_ void transmit_chars(str return; } if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { -- m32r_sio_stop_tx(&up->port, 0); ++ m32r_sio_stop_tx(&up->port); return; } @@@ -446,7 -446,7 +446,7 @@@ DEBUG_INTR("THRE..."); if (uart_circ_empty(xmit)) -- m32r_sio_stop_tx(&up->port, 0); ++ m32r_sio_stop_tx(&up->port); } /* diff --cc drivers/serial/mpc52xx_uart.c index 2a5cf174ca3,2a5cf174ca3..a3cd0ee8486 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c @@@ -119,7 -119,7 +119,7 @@@ mpc52xx_uart_get_mctrl(struct uart_por } static void --mpc52xx_uart_stop_tx(struct uart_port *port, unsigned int tty_stop) ++mpc52xx_uart_stop_tx(struct uart_port *port) { /* port->lock taken by caller */ port->read_status_mask &= ~MPC52xx_PSC_IMR_TXRDY; @@@ -127,7 -127,7 +127,7 @@@ } static void --mpc52xx_uart_start_tx(struct uart_port *port, unsigned int tty_start) ++mpc52xx_uart_start_tx(struct uart_port *port) { /* port->lock taken by caller */ port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY; @@@ -485,7 -485,7 +485,7 @@@ mpc52xx_uart_int_tx_chars(struct uart_p /* Nothing to do ? */ if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- mpc52xx_uart_stop_tx(port,0); ++ mpc52xx_uart_stop_tx(port); return 0; } @@@ -504,7 -504,7 +504,7 @@@ /* Maybe we're done after all */ if (uart_circ_empty(xmit)) { -- mpc52xx_uart_stop_tx(port,0); ++ mpc52xx_uart_stop_tx(port); return 0; } diff --cc drivers/serial/mpsc.c index e43276c6a95,e43276c6a95..efe79b1fd43 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c @@@ -1072,18 -1072,18 +1072,18 @@@ mpsc_get_mctrl(struct uart_port *port } static void --mpsc_stop_tx(struct uart_port *port, uint tty_start) ++mpsc_stop_tx(struct uart_port *port) { struct mpsc_port_info *pi = (struct mpsc_port_info *)port; -- pr_debug("mpsc_stop_tx[%d]: tty_start: %d\n", port->line, tty_start); ++ pr_debug("mpsc_stop_tx[%d]\n", port->line); mpsc_freeze(pi); return; } static void --mpsc_start_tx(struct uart_port *port, uint tty_start) ++mpsc_start_tx(struct uart_port *port) { struct mpsc_port_info *pi = (struct mpsc_port_info *)port; @@@ -1091,7 -1091,7 +1091,7 @@@ mpsc_copy_tx_data(pi); mpsc_sdma_start_tx(pi); -- pr_debug("mpsc_start_tx[%d]: tty_start: %d\n", port->line, tty_start); ++ pr_debug("mpsc_start_tx[%d]\n", port->line); return; } diff --cc drivers/serial/mux.c index dadd7e19714,dadd7e19714..18906460770 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@@ -111,22 -111,22 +111,20 @@@ static unsigned int mux_get_mctrl(struc /** * mux_stop_tx - Stop transmitting characters. * @port: Ptr to the uart_port. -- * @tty_stop: tty layer issue this command? * * The Serial MUX does not support this function. */ --static void mux_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void mux_stop_tx(struct uart_port *port) { } /** * mux_start_tx - Start transmitting characters. * @port: Ptr to the uart_port. -- * @tty_start: tty layer issue this command? * * The Serial Mux does not support this function. */ --static void mux_start_tx(struct uart_port *port, unsigned int tty_start) ++static void mux_start_tx(struct uart_port *port) { } @@@ -181,7 -181,7 +179,7 @@@ static void mux_write(struct uart_port } if(uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- mux_stop_tx(port, 0); ++ mux_stop_tx(port); return; } @@@ -202,7 -202,7 +200,7 @@@ uart_write_wakeup(port); if (uart_circ_empty(xmit)) -- mux_stop_tx(port, 0); ++ mux_stop_tx(port); } /** diff --cc drivers/serial/pmac_zilog.c index 7db2f37532c,7db2f37532c..5bfde99e245 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c @@@ -630,11 -630,11 +630,10 @@@ static unsigned int pmz_get_mctrl(struc /* * Stop TX side. Dealt like sunzilog at next Tx interrupt, -- * though for DMA, we will have to do a bit more. What is -- * the meaning of the tty_stop bit ? XXX ++ * though for DMA, we will have to do a bit more. * The port lock is held and interrupts are disabled. */ --static void pmz_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void pmz_stop_tx(struct uart_port *port) { to_pmz(port)->flags |= PMACZILOG_FLAG_TX_STOPPED; } @@@ -643,7 -643,7 +642,7 @@@ * Kick the Tx side. * The port lock is held and interrupts are disabled. */ --static void pmz_start_tx(struct uart_port *port, unsigned int tty_start) ++static void pmz_start_tx(struct uart_port *port) { struct uart_pmac_port *uap = to_pmz(port); unsigned char status; diff --cc drivers/serial/pxa.c index 461c81c9320,461c81c9320..eaa0af83529 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c @@@ -80,7 -80,7 +80,7 @@@ static void serial_pxa_enable_ms(struc serial_out(up, UART_IER, up->ier); } --static void serial_pxa_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void serial_pxa_stop_tx(struct uart_port *port) { struct uart_pxa_port *up = (struct uart_pxa_port *)port; @@@ -185,7 -185,7 +185,7 @@@ static void transmit_chars(struct uart_ return; } if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { -- serial_pxa_stop_tx(&up->port, 0); ++ serial_pxa_stop_tx(&up->port); return; } @@@ -203,10 -203,10 +203,10 @@@ if (uart_circ_empty(xmit)) -- serial_pxa_stop_tx(&up->port, 0); ++ serial_pxa_stop_tx(&up->port); } --static void serial_pxa_start_tx(struct uart_port *port, unsigned int tty_start) ++static void serial_pxa_start_tx(struct uart_port *port) { struct uart_pxa_port *up = (struct uart_pxa_port *)port; diff --cc drivers/serial/s3c2410.c index 7365d4b50b9,7365d4b50b9..c361c6fb080 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c @@@ -246,8 -246,8 +246,7 @@@ static void s3c24xx_serial_rx_disable(s spin_unlock_irqrestore(&port->lock, flags); } --static void --s3c24xx_serial_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void s3c24xx_serial_stop_tx(struct uart_port *port) { if (tx_enabled(port)) { disable_irq(TX_IRQ(port)); @@@ -257,8 -257,8 +256,7 @@@ } } --static void --s3c24xx_serial_start_tx(struct uart_port *port, unsigned int tty_start) ++static void s3c24xx_serial_start_tx(struct uart_port *port) { if (!tx_enabled(port)) { if (port->flags & UPF_CONS_FLOW) @@@ -424,7 -424,7 +422,7 @@@ static irqreturn_t s3c24xx_serial_tx_ch */ if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- s3c24xx_serial_stop_tx(port, 0); ++ s3c24xx_serial_stop_tx(port); goto out; } @@@ -443,7 -443,7 +441,7 @@@ uart_write_wakeup(port); if (uart_circ_empty(xmit)) -- s3c24xx_serial_stop_tx(port, 0); ++ s3c24xx_serial_stop_tx(port); out: return IRQ_HANDLED; diff --cc drivers/serial/sa1100.c index 98641c3f5ab,98641c3f5ab..1225b14f6e9 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c @@@ -145,7 -145,7 +145,7 @@@ static void sa1100_timeout(unsigned lon /* * interrupts disabled on entry */ --static void sa1100_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void sa1100_stop_tx(struct uart_port *port) { struct sa1100_port *sport = (struct sa1100_port *)port; u32 utcr3; @@@ -158,7 -158,7 +158,7 @@@ /* * interrupts may not be disabled on entry */ --static void sa1100_start_tx(struct uart_port *port, unsigned int tty_start) ++static void sa1100_start_tx(struct uart_port *port) { struct sa1100_port *sport = (struct sa1100_port *)port; unsigned long flags; @@@ -264,7 -264,7 +264,7 @@@ static void sa1100_tx_chars(struct sa11 sa1100_mctrl_check(sport); if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) { -- sa1100_stop_tx(&sport->port, 0); ++ sa1100_stop_tx(&sport->port); return; } @@@ -284,7 -284,7 +284,7 @@@ uart_write_wakeup(&sport->port); if (uart_circ_empty(xmit)) -- sa1100_stop_tx(&sport->port, 0); ++ sa1100_stop_tx(&sport->port); } static irqreturn_t sa1100_int(int irq, void *dev_id, struct pt_regs *regs) diff --cc drivers/serial/serial_core.c index 54699c3a00a,54699c3a00a..ac3a0bf924d --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@@ -80,7 -80,7 +80,7 @@@ static void uart_stop(struct tty_struc unsigned long flags; spin_lock_irqsave(&port->lock, flags); -- port->ops->stop_tx(port, 1); ++ port->ops->stop_tx(port); spin_unlock_irqrestore(&port->lock, flags); } @@@ -91,7 -91,7 +91,7 @@@ static void __uart_start(struct tty_str if (!uart_circ_empty(&state->info->xmit) && state->info->xmit.buf && !tty->stopped && !tty->hw_stopped) -- port->ops->start_tx(port, 1); ++ port->ops->start_tx(port); } static void uart_start(struct tty_struct *tty) @@@ -542,7 -542,7 +542,7 @@@ static void uart_send_xchar(struct tty_ port->x_char = ch; if (ch) { spin_lock_irqsave(&port->lock, flags); -- port->ops->start_tx(port, 0); ++ port->ops->start_tx(port); spin_unlock_irqrestore(&port->lock, flags); } } @@@ -1146,7 -1146,7 +1146,7 @@@ static void uart_set_termios(struct tty spin_lock_irqsave(&state->port->lock, flags); if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) { tty->hw_stopped = 1; -- state->port->ops->stop_tx(state->port, 0); ++ state->port->ops->stop_tx(state->port); } spin_unlock_irqrestore(&state->port->lock, flags); } @@@ -1869,7 -1869,7 +1869,7 @@@ int uart_suspend_port(struct uart_drive struct uart_ops *ops = port->ops; spin_lock_irq(&port->lock); -- ops->stop_tx(port, 0); ++ ops->stop_tx(port); ops->set_mctrl(port, 0); ops->stop_rx(port); spin_unlock_irq(&port->lock); @@@ -1935,7 -1935,7 +1935,7 @@@ int uart_resume_port(struct uart_drive uart_change_speed(state, NULL); spin_lock_irq(&port->lock); ops->set_mctrl(port, port->mctrl); -- ops->start_tx(port, 0); ++ ops->start_tx(port); spin_unlock_irq(&port->lock); } diff --cc drivers/serial/serial_lh7a40x.c index 56f269b6bfb,56f269b6bfb..32f808d157a --- a/drivers/serial/serial_lh7a40x.c +++ b/drivers/serial/serial_lh7a40x.c @@@ -112,13 -112,13 +112,12 @@@ struct uart_port_lh7a40x unsigned int statusPrev; /* Most recently read modem status */ }; --static void lh7a40xuart_stop_tx (struct uart_port* port, unsigned int tty_stop) ++static void lh7a40xuart_stop_tx (struct uart_port* port) { BIT_CLR (port, UART_R_INTEN, TxInt); } --static void lh7a40xuart_start_tx (struct uart_port* port, -- unsigned int tty_start) ++static void lh7a40xuart_start_tx (struct uart_port* port) { BIT_SET (port, UART_R_INTEN, TxInt); diff --cc drivers/serial/serial_txx9.c index d085030df70,d085030df70..49afadbe461 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c @@@ -253,7 -253,7 +253,7 @@@ sio_quot_set(struct uart_txx9_port *up sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6); } --static void serial_txx9_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void serial_txx9_stop_tx(struct uart_port *port) { struct uart_txx9_port *up = (struct uart_txx9_port *)port; unsigned long flags; @@@ -263,7 -263,7 +263,7 @@@ spin_unlock_irqrestore(&up->port.lock, flags); } --static void serial_txx9_start_tx(struct uart_port *port, unsigned int tty_start) ++static void serial_txx9_start_tx(struct uart_port *port) { struct uart_txx9_port *up = (struct uart_txx9_port *)port; unsigned long flags; @@@ -372,7 -372,7 +372,7 @@@ static inline void transmit_chars(struc return; } if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { -- serial_txx9_stop_tx(&up->port, 0); ++ serial_txx9_stop_tx(&up->port); return; } @@@ -389,7 -389,7 +389,7 @@@ uart_write_wakeup(&up->port); if (uart_circ_empty(xmit)) -- serial_txx9_stop_tx(&up->port, 0); ++ serial_txx9_stop_tx(&up->port); } static irqreturn_t serial_txx9_interrupt(int irq, void *dev_id, struct pt_regs *regs) diff --cc drivers/serial/sh-sci.c index ad5b776d779,ad5b776d779..51226630786 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c @@@ -79,8 -79,8 +79,8 @@@ static struct sci_port *serial_console_ #endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */ /* Function prototypes */ --static void sci_stop_tx(struct uart_port *port, unsigned int tty_stop); --static void sci_start_tx(struct uart_port *port, unsigned int tty_start); ++static void sci_stop_tx(struct uart_port *port); ++static void sci_start_tx(struct uart_port *port); static void sci_start_rx(struct uart_port *port, unsigned int tty_start); static void sci_stop_rx(struct uart_port *port); static int sci_request_irq(struct sci_port *port); @@@ -455,7 -455,7 +455,7 @@@ static void sci_transmit_chars(struct u if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) uart_write_wakeup(port); if (uart_circ_empty(xmit)) { -- sci_stop_tx(port, 0); ++ sci_stop_tx(port); } else { local_irq_save(flags); ctrl = sci_in(port, SCSCR); @@@ -900,7 -900,7 +900,7 @@@ static unsigned int sci_get_mctrl(struc return TIOCM_DTR | TIOCM_RTS | TIOCM_DSR; } --static void sci_start_tx(struct uart_port *port, unsigned int tty_start) ++static void sci_start_tx(struct uart_port *port) { struct sci_port *s = &sci_ports[port->line]; @@@ -909,7 -909,7 +909,7 @@@ enable_irq(s->irqs[SCIx_TXI_IRQ]); } --static void sci_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void sci_stop_tx(struct uart_port *port) { unsigned long flags; unsigned short ctrl; @@@ -978,7 -978,7 +978,7 @@@ static void sci_shutdown(struct uart_po struct sci_port *s = &sci_ports[port->line]; sci_stop_rx(port); -- sci_stop_tx(port, 1); ++ sci_stop_tx(port); sci_free_irq(s); #if defined(__H8300S__) diff --cc drivers/serial/sn_console.c index 12d1f14e78c,840815fde49..313f9df24a2 --- a/drivers/serial/sn_console.c +++ b/drivers/serial/sn_console.c @@@ -259,10 -259,10 +259,9 @@@ static unsigned int snp_tx_empty(struc /** * snp_stop_tx - stop the transmitter - no-op for us * @port: Port to operat eon - we ignore - no-op function -- * @tty_stop: Set to 1 if called via uart_stop * */ --static void snp_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void snp_stop_tx(struct uart_port *port) { } @@@ -325,10 -325,10 +324,9 @@@ static void snp_stop_rx(struct uart_por /** * snp_start_tx - Start transmitter * @port: Port to operate on -- * @tty_stop: Set to 1 if called via uart_start * */ --static void snp_start_tx(struct uart_port *port, unsigned int tty_stop) ++static void snp_start_tx(struct uart_port *port) { if (sal_console_port.sc_ops->sal_wakeup_transmit) sal_console_port.sc_ops->sal_wakeup_transmit(&sal_console_port, @@@ -615,7 -615,7 +613,7 @@@ static void sn_transmit_chars(struct sn uart_write_wakeup(&port->sc_port); if (uart_circ_empty(xmit)) -- snp_stop_tx(&port->sc_port, 0); /* no-op for us */ ++ snp_stop_tx(&port->sc_port); /* no-op for us */ } /** diff --cc drivers/serial/sunsab.c index 8d198880756,8d198880756..e971156daa6 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c @@@ -245,7 -245,7 +245,7 @@@ receive_chars(struct uart_sunsab_port * return tty; } --static void sunsab_stop_tx(struct uart_port *, unsigned int); ++static void sunsab_stop_tx(struct uart_port *); static void sunsab_tx_idle(struct uart_sunsab_port *); static void transmit_chars(struct uart_sunsab_port *up, @@@ -301,7 -301,7 +301,7 @@@ uart_write_wakeup(&up->port); if (uart_circ_empty(xmit)) -- sunsab_stop_tx(&up->port, 0); ++ sunsab_stop_tx(&up->port); } static void check_status(struct uart_sunsab_port *up, @@@ -448,7 -448,7 +448,7 @@@ static unsigned int sunsab_get_mctrl(st } /* port->lock held by caller. */ --static void sunsab_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void sunsab_stop_tx(struct uart_port *port) { struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; @@@ -476,7 -476,7 +476,7 @@@ static void sunsab_tx_idle(struct uart_ } /* port->lock held by caller. */ --static void sunsab_start_tx(struct uart_port *port, unsigned int tty_start) ++static void sunsab_start_tx(struct uart_port *port) { struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; struct circ_buf *xmit = &up->port.info->xmit; diff --cc drivers/serial/sunsu.c index d57a3553aea,d57a3553aea..0cc879eb1c0 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c @@@ -255,21 -255,21 +255,27 @@@ static void disable_rsa(struct uart_sun } #endif /* CONFIG_SERIAL_8250_RSA */ --static void sunsu_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static inline void __stop_tx(struct uart_sunsu_port *p) ++{ ++ if (p->ier & UART_IER_THRI) { ++ p->ier &= ~UART_IER_THRI; ++ serial_out(p, UART_IER, p->ier); ++ } ++} ++ ++static void sunsu_stop_tx(struct uart_port *port) { struct uart_sunsu_port *up = (struct uart_sunsu_port *) port; -- if (up->ier & UART_IER_THRI) { -- up->ier &= ~UART_IER_THRI; -- serial_out(up, UART_IER, up->ier); -- } -- if (up->port.type == PORT_16C950 && tty_stop) { ++ __stop_tx(up); ++ ++ if (up->port.type == PORT_16C950 && tty_stop /*FIXME*/) { up->acr |= UART_ACR_TXDIS; serial_icr_write(up, UART_ACR, up->acr); } } --static void sunsu_start_tx(struct uart_port *port, unsigned int tty_start) ++static void sunsu_start_tx(struct uart_port *port) { struct uart_sunsu_port *up = (struct uart_sunsu_port *) port; @@@ -280,7 -280,7 +286,7 @@@ /* * We only do this from uart_start */ -- if (tty_start && up->port.type == PORT_16C950) { ++ if (tty_start && up->port.type == PORT_16C950 /*FIXME*/) { up->acr &= ~UART_ACR_TXDIS; serial_icr_write(up, UART_ACR, up->acr); } @@@ -413,8 -413,8 +419,12 @@@ static _INLINE_ void transmit_chars(str up->port.x_char = 0; return; } -- if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { -- sunsu_stop_tx(&up->port, 0); ++ if (uart_tx_stopped(&up->port)) { ++ sunsu_stop_tx(&up->port); ++ return; ++ } ++ if (uart_circ_empty(xmit)) { ++ __stop_tx(up); return; } @@@ -431,7 -431,7 +441,7 @@@ uart_write_wakeup(&up->port); if (uart_circ_empty(xmit)) -- sunsu_stop_tx(&up->port, 0); ++ __stop_tx(up); } static _INLINE_ void check_modem_status(struct uart_sunsu_port *up) diff --cc drivers/serial/sunzilog.c index bff42a7b89d,bff42a7b89d..d75445738c8 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c @@@ -684,7 -684,7 +684,7 @@@ static void sunzilog_set_mctrl(struct u } /* The port lock is held and interrupts are disabled. */ --static void sunzilog_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void sunzilog_stop_tx(struct uart_port *port) { struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; @@@ -692,7 -692,7 +692,7 @@@ } /* The port lock is held and interrupts are disabled. */ --static void sunzilog_start_tx(struct uart_port *port, unsigned int tty_start) ++static void sunzilog_start_tx(struct uart_port *port) { struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); diff --cc drivers/serial/uart00.c index 186f1300cea,186f1300cea..47b504ff38b --- a/drivers/serial/uart00.c +++ b/drivers/serial/uart00.c @@@ -87,7 -87,7 +87,7 @@@ #define UART_TX_READY(s) (((s) & UART_TSR_TX_LEVEL_MSK) < 15) //#define UART_TX_EMPTY(p) ((UART_GET_FR(p) & UART00_UARTFR_TMSK) == 0) --static void uart00_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void uart00_stop_tx(struct uart_port *port) { UART_PUT_IEC(port, UART_IEC_TIE_MSK); } @@@ -199,7 -199,7 +199,7 @@@ static void uart00_tx_chars(struct uart return; } if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- uart00_stop_tx(port, 0); ++ uart00_stop_tx(port); return; } @@@ -218,10 -218,10 +218,10 @@@ uart_write_wakeup(port); if (uart_circ_empty(xmit)) -- uart00_stop_tx(port, 0); ++ uart00_stop_tx(port); } --static void uart00_start_tx(struct uart_port *port, unsigned int tty_start) ++static void uart00_start_tx(struct uart_port *port) { UART_PUT_IES(port, UART_IES_TIE_MSK); uart00_tx_chars(port); diff --cc drivers/serial/v850e_uart.c index bb482780a41,bb482780a41..9378895a8d5 --- a/drivers/serial/v850e_uart.c +++ b/drivers/serial/v850e_uart.c @@@ -240,7 -240,7 +240,7 @@@ console_initcall(v850e_uart_console_ini /* TX/RX interrupt handlers. */ --static void v850e_uart_stop_tx (struct uart_port *port, unsigned tty_stop); ++static void v850e_uart_stop_tx (struct uart_port *port); void v850e_uart_tx (struct uart_port *port) { @@@ -339,14 -339,14 +339,14 @@@ static unsigned v850e_uart_get_mctrl (s return mctrl; } --static void v850e_uart_start_tx (struct uart_port *port, unsigned tty_start) ++static void v850e_uart_start_tx (struct uart_port *port) { v850e_intc_disable_irq (V850E_UART_TX_IRQ (port->line)); v850e_uart_tx (port); v850e_intc_enable_irq (V850E_UART_TX_IRQ (port->line)); } --static void v850e_uart_stop_tx (struct uart_port *port, unsigned tty_stop) ++static void v850e_uart_stop_tx (struct uart_port *port) { v850e_intc_disable_irq (V850E_UART_TX_IRQ (port->line)); } diff --cc drivers/serial/vr41xx_siu.c index 1f985327b0d,1f985327b0d..0c5d65a08f6 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c @@@ -284,7 -284,7 +284,7 @@@ static unsigned int siu_get_mctrl(struc return mctrl; } --static void siu_stop_tx(struct uart_port *port, unsigned int tty_stop) ++static void siu_stop_tx(struct uart_port *port) { unsigned long flags; uint8_t ier; @@@ -298,7 -298,7 +298,7 @@@ spin_unlock_irqrestore(&port->lock, flags); } --static void siu_start_tx(struct uart_port *port, unsigned int tty_start) ++static void siu_start_tx(struct uart_port *port) { unsigned long flags; uint8_t ier; @@@ -458,7 -458,7 +458,7 @@@ static inline void transmit_chars(struc } if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { -- siu_stop_tx(port, 0); ++ siu_stop_tx(port); return; } @@@ -474,7 -474,7 +474,7 @@@ uart_write_wakeup(port); if (uart_circ_empty(xmit)) -- siu_stop_tx(port, 0); ++ siu_stop_tx(port); } static irqreturn_t siu_interrupt(int irq, void *dev_id, struct pt_regs *regs) diff --cc include/linux/serial_core.h index f6fca8f2f3c,f6fca8f2f3c..1c53302db04 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@@ -142,8 -142,8 +142,8 @@@ struct uart_ops unsigned int (*tx_empty)(struct uart_port *); void (*set_mctrl)(struct uart_port *, unsigned int mctrl); unsigned int (*get_mctrl)(struct uart_port *); -- void (*stop_tx)(struct uart_port *, unsigned int tty_stop); -- void (*start_tx)(struct uart_port *, unsigned int tty_start); ++ void (*stop_tx)(struct uart_port *); ++ void (*start_tx)(struct uart_port *); void (*send_xchar)(struct uart_port *, char ch); void (*stop_rx)(struct uart_port *); void (*enable_ms)(struct uart_port *); @@@ -468,13 -468,13 +468,13 @@@ uart_handle_cts_change(struct uart_por if (tty->hw_stopped) { if (status) { tty->hw_stopped = 0; -- port->ops->start_tx(port, 0); ++ port->ops->start_tx(port); uart_write_wakeup(port); } } else { if (!status) { tty->hw_stopped = 1; -- port->ops->stop_tx(port, 0); ++ port->ops->stop_tx(port); } } }