diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 09:53:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-16 01:21:36 -0500 |
commit | 92a19f9cec9a80ad93c06e115822deb729e2c6ad (patch) | |
tree | 80e1550ac1647a1cdf20a0b568554c0c50a63f75 /drivers/tty/serial | |
parent | 2f69335710884ae6112fc8196ebe29b5cda7b79b (diff) |
TTY: switch tty_insert_flip_char
Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.
tty_insert_flip_char is the next one to proceed. This one is used all
over the code, so the patch is huge.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
33 files changed, 147 insertions, 132 deletions
diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c index f99a84526f82..3719273cf0be 100644 --- a/drivers/tty/serial/68328serial.c +++ b/drivers/tty/serial/68328serial.c | |||
@@ -305,7 +305,7 @@ static void receive_chars(struct m68k_serial *info, struct tty_struct *tty, | |||
305 | else if (rx & URX_FRAME_ERROR) | 305 | else if (rx & URX_FRAME_ERROR) |
306 | flag = TTY_FRAME; | 306 | flag = TTY_FRAME; |
307 | 307 | ||
308 | tty_insert_flip_char(tty, ch, flag); | 308 | tty_insert_flip_char(&info->tport, ch, flag); |
309 | #ifndef CONFIG_XCOPILOT_BUGS | 309 | #ifndef CONFIG_XCOPILOT_BUGS |
310 | } while((rx = uart->urx.w) & URX_DATA_READY); | 310 | } while((rx = uart->urx.w) & URX_DATA_READY); |
311 | #endif | 311 | #endif |
diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c index 505c490c0b44..6ca5dd615f9e 100644 --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c | |||
@@ -297,10 +297,11 @@ static void ar933x_uart_set_termios(struct uart_port *port, | |||
297 | 297 | ||
298 | static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) | 298 | static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) |
299 | { | 299 | { |
300 | struct tty_port *port = &up->port.state->port; | ||
300 | struct tty_struct *tty; | 301 | struct tty_struct *tty; |
301 | int max_count = 256; | 302 | int max_count = 256; |
302 | 303 | ||
303 | tty = tty_port_tty_get(&up->port.state->port); | 304 | tty = tty_port_tty_get(port); |
304 | do { | 305 | do { |
305 | unsigned int rdata; | 306 | unsigned int rdata; |
306 | unsigned char ch; | 307 | unsigned char ch; |
@@ -313,11 +314,6 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) | |||
313 | ar933x_uart_write(up, AR933X_UART_DATA_REG, | 314 | ar933x_uart_write(up, AR933X_UART_DATA_REG, |
314 | AR933X_UART_DATA_RX_CSR); | 315 | AR933X_UART_DATA_RX_CSR); |
315 | 316 | ||
316 | if (!tty) { | ||
317 | /* discard the data if no tty available */ | ||
318 | continue; | ||
319 | } | ||
320 | |||
321 | up->port.icount.rx++; | 317 | up->port.icount.rx++; |
322 | ch = rdata & AR933X_UART_DATA_TX_RX_MASK; | 318 | ch = rdata & AR933X_UART_DATA_TX_RX_MASK; |
323 | 319 | ||
@@ -325,7 +321,7 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) | |||
325 | continue; | 321 | continue; |
326 | 322 | ||
327 | if ((up->port.ignore_status_mask & AR933X_DUMMY_STATUS_RD) == 0) | 323 | if ((up->port.ignore_status_mask & AR933X_DUMMY_STATUS_RD) == 0) |
328 | tty_insert_flip_char(tty, ch, TTY_NORMAL); | 324 | tty_insert_flip_char(port, ch, TTY_NORMAL); |
329 | } while (max_count-- > 0); | 325 | } while (max_count-- > 0); |
330 | 326 | ||
331 | if (tty) { | 327 | if (tty) { |
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index c76a226080f2..de30b1909728 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -235,6 +235,7 @@ static const char *bcm_uart_type(struct uart_port *port) | |||
235 | */ | 235 | */ |
236 | static void bcm_uart_do_rx(struct uart_port *port) | 236 | static void bcm_uart_do_rx(struct uart_port *port) |
237 | { | 237 | { |
238 | struct tty_port *port = &port->state->port; | ||
238 | struct tty_struct *tty; | 239 | struct tty_struct *tty; |
239 | unsigned int max_count; | 240 | unsigned int max_count; |
240 | 241 | ||
@@ -242,7 +243,7 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
242 | * higher than fifo size anyway since we're much faster than | 243 | * higher than fifo size anyway since we're much faster than |
243 | * serial port */ | 244 | * serial port */ |
244 | max_count = 32; | 245 | max_count = 32; |
245 | tty = port->state->port.tty; | 246 | tty = port->tty; |
246 | do { | 247 | do { |
247 | unsigned int iestat, c, cstat; | 248 | unsigned int iestat, c, cstat; |
248 | char flag; | 249 | char flag; |
@@ -261,7 +262,7 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
261 | bcm_uart_writel(port, val, UART_CTL_REG); | 262 | bcm_uart_writel(port, val, UART_CTL_REG); |
262 | 263 | ||
263 | port->icount.overrun++; | 264 | port->icount.overrun++; |
264 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 265 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
265 | } | 266 | } |
266 | 267 | ||
267 | if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY))) | 268 | if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY))) |
@@ -300,7 +301,7 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
300 | 301 | ||
301 | 302 | ||
302 | if ((cstat & port->ignore_status_mask) == 0) | 303 | if ((cstat & port->ignore_status_mask) == 0) |
303 | tty_insert_flip_char(tty, c, flag); | 304 | tty_insert_flip_char(port, c, flag); |
304 | 305 | ||
305 | } while (--max_count); | 306 | } while (--max_count); |
306 | 307 | ||
diff --git a/drivers/tty/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c index f5d117379b60..e4d3ac2e8992 100644 --- a/drivers/tty/serial/bfin_sport_uart.c +++ b/drivers/tty/serial/bfin_sport_uart.c | |||
@@ -149,7 +149,8 @@ static int sport_uart_setup(struct sport_uart_port *up, int size, int baud_rate) | |||
149 | static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) | 149 | static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) |
150 | { | 150 | { |
151 | struct sport_uart_port *up = dev_id; | 151 | struct sport_uart_port *up = dev_id; |
152 | struct tty_struct *tty = up->port.state->port.tty; | 152 | struct tty_port *port = &up->port.state->port; |
153 | struct tty_struct *tty = tport->tty; | ||
153 | unsigned int ch; | 154 | unsigned int ch; |
154 | 155 | ||
155 | spin_lock(&up->port.lock); | 156 | spin_lock(&up->port.lock); |
@@ -159,7 +160,7 @@ static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) | |||
159 | up->port.icount.rx++; | 160 | up->port.icount.rx++; |
160 | 161 | ||
161 | if (!uart_handle_sysrq_char(&up->port, ch)) | 162 | if (!uart_handle_sysrq_char(&up->port, ch)) |
162 | tty_insert_flip_char(tty, ch, TTY_NORMAL); | 163 | tty_insert_flip_char(port, ch, TTY_NORMAL); |
163 | } | 164 | } |
164 | tty_flip_buffer_push(tty); | 165 | tty_flip_buffer_push(tty); |
165 | 166 | ||
@@ -182,7 +183,6 @@ static irqreturn_t sport_uart_tx_irq(int irq, void *dev_id) | |||
182 | static irqreturn_t sport_uart_err_irq(int irq, void *dev_id) | 183 | static irqreturn_t sport_uart_err_irq(int irq, void *dev_id) |
183 | { | 184 | { |
184 | struct sport_uart_port *up = dev_id; | 185 | struct sport_uart_port *up = dev_id; |
185 | struct tty_struct *tty = up->port.state->port.tty; | ||
186 | unsigned int stat = SPORT_GET_STAT(up); | 186 | unsigned int stat = SPORT_GET_STAT(up); |
187 | 187 | ||
188 | spin_lock(&up->port.lock); | 188 | spin_lock(&up->port.lock); |
@@ -190,7 +190,7 @@ static irqreturn_t sport_uart_err_irq(int irq, void *dev_id) | |||
190 | /* Overflow in RX FIFO */ | 190 | /* Overflow in RX FIFO */ |
191 | if (stat & ROVF) { | 191 | if (stat & ROVF) { |
192 | up->port.icount.overrun++; | 192 | up->port.icount.overrun++; |
193 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 193 | tty_insert_flip_char(&up->port.state->port, 0, TTY_OVERRUN); |
194 | SPORT_PUT_STAT(up, ROVF); /* Clear ROVF bit */ | 194 | SPORT_PUT_STAT(up, ROVF); /* Clear ROVF bit */ |
195 | } | 195 | } |
196 | /* These should not happen */ | 196 | /* These should not happen */ |
@@ -205,6 +205,8 @@ static irqreturn_t sport_uart_err_irq(int irq, void *dev_id) | |||
205 | SSYNC(); | 205 | SSYNC(); |
206 | 206 | ||
207 | spin_unlock(&up->port.lock); | 207 | spin_unlock(&up->port.lock); |
208 | /* XXX we don't push the overrun bit to TTY? */ | ||
209 | |||
208 | return IRQ_HANDLED; | 210 | return IRQ_HANDLED; |
209 | } | 211 | } |
210 | 212 | ||
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 42d5eb0125b3..108122f8f3c2 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c | |||
@@ -303,7 +303,7 @@ static void cpm_uart_int_rx(struct uart_port *port) | |||
303 | } | 303 | } |
304 | #endif | 304 | #endif |
305 | error_return: | 305 | error_return: |
306 | tty_insert_flip_char(tty, ch, flg); | 306 | tty_insert_flip_char(tport, ch, flg); |
307 | 307 | ||
308 | } /* End while (i--) */ | 308 | } /* End while (i--) */ |
309 | 309 | ||
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index 35ee6a2c6877..d12306625458 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
@@ -1760,8 +1760,7 @@ add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char fl | |||
1760 | 1760 | ||
1761 | info->icount.rx++; | 1761 | info->icount.rx++; |
1762 | } else { | 1762 | } else { |
1763 | struct tty_struct *tty = info->port.tty; | 1763 | tty_insert_flip_char(&info->port, data, flag); |
1764 | tty_insert_flip_char(tty, data, flag); | ||
1765 | info->icount.rx++; | 1764 | info->icount.rx++; |
1766 | } | 1765 | } |
1767 | 1766 | ||
@@ -2338,8 +2337,7 @@ more_data: | |||
2338 | data_in, data_read); | 2337 | data_in, data_read); |
2339 | char flag = TTY_NORMAL; | 2338 | char flag = TTY_NORMAL; |
2340 | if (info->errorcode == ERRCODE_INSERT_BREAK) { | 2339 | if (info->errorcode == ERRCODE_INSERT_BREAK) { |
2341 | struct tty_struct *tty = info->port.tty; | 2340 | tty_insert_flip_char(&info->port, 0, flag); |
2342 | tty_insert_flip_char(tty, 0, flag); | ||
2343 | info->icount.rx++; | 2341 | info->icount.rx++; |
2344 | } | 2342 | } |
2345 | 2343 | ||
@@ -2353,7 +2351,7 @@ more_data: | |||
2353 | info->icount.frame++; | 2351 | info->icount.frame++; |
2354 | flag = TTY_FRAME; | 2352 | flag = TTY_FRAME; |
2355 | } | 2353 | } |
2356 | tty_insert_flip_char(tty, data, flag); | 2354 | tty_insert_flip_char(&info->port, data, flag); |
2357 | info->errorcode = 0; | 2355 | info->errorcode = 0; |
2358 | } | 2356 | } |
2359 | info->break_detected_cnt = 0; | 2357 | info->break_detected_cnt = 0; |
@@ -2369,7 +2367,7 @@ more_data: | |||
2369 | log_int(rdpc(), 0, 0); | 2367 | log_int(rdpc(), 0, 0); |
2370 | } | 2368 | } |
2371 | ); | 2369 | ); |
2372 | tty_insert_flip_char(tty, | 2370 | tty_insert_flip_char(&info->port, |
2373 | IO_EXTRACT(R_SERIAL0_READ, data_in, data_read), | 2371 | IO_EXTRACT(R_SERIAL0_READ, data_in, data_read), |
2374 | TTY_NORMAL); | 2372 | TTY_NORMAL); |
2375 | } else { | 2373 | } else { |
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c index a8cbb2670521..bdf67b0cb8b6 100644 --- a/drivers/tty/serial/efm32-uart.c +++ b/drivers/tty/serial/efm32-uart.c | |||
@@ -194,8 +194,7 @@ static void efm32_uart_break_ctl(struct uart_port *port, int ctl) | |||
194 | /* not possible without fiddling with gpios */ | 194 | /* not possible without fiddling with gpios */ |
195 | } | 195 | } |
196 | 196 | ||
197 | static void efm32_uart_rx_chars(struct efm32_uart_port *efm_port, | 197 | static void efm32_uart_rx_chars(struct efm32_uart_port *efm_port) |
198 | struct tty_struct *tty) | ||
199 | { | 198 | { |
200 | struct uart_port *port = &efm_port->port; | 199 | struct uart_port *port = &efm_port->port; |
201 | 200 | ||
@@ -237,8 +236,8 @@ static void efm32_uart_rx_chars(struct efm32_uart_port *efm_port, | |||
237 | rxdata & UARTn_RXDATAX_RXDATA__MASK)) | 236 | rxdata & UARTn_RXDATAX_RXDATA__MASK)) |
238 | continue; | 237 | continue; |
239 | 238 | ||
240 | if (tty && (rxdata & port->ignore_status_mask) == 0) | 239 | if ((rxdata & port->ignore_status_mask) == 0) |
241 | tty_insert_flip_char(tty, | 240 | tty_insert_flip_char(&port->state->port, |
242 | rxdata & UARTn_RXDATAX_RXDATA__MASK, flag); | 241 | rxdata & UARTn_RXDATAX_RXDATA__MASK, flag); |
243 | } | 242 | } |
244 | } | 243 | } |
@@ -249,15 +248,16 @@ static irqreturn_t efm32_uart_rxirq(int irq, void *data) | |||
249 | u32 irqflag = efm32_uart_read32(efm_port, UARTn_IF); | 248 | u32 irqflag = efm32_uart_read32(efm_port, UARTn_IF); |
250 | int handled = IRQ_NONE; | 249 | int handled = IRQ_NONE; |
251 | struct uart_port *port = &efm_port->port; | 250 | struct uart_port *port = &efm_port->port; |
251 | struct tty_port *tport = &port->state->port; | ||
252 | struct tty_struct *tty; | 252 | struct tty_struct *tty; |
253 | 253 | ||
254 | spin_lock(&port->lock); | 254 | spin_lock(&port->lock); |
255 | 255 | ||
256 | tty = tty_kref_get(port->state->port.tty); | 256 | tty = tty_kref_get(tport->tty); |
257 | 257 | ||
258 | if (irqflag & UARTn_IF_RXDATAV) { | 258 | if (irqflag & UARTn_IF_RXDATAV) { |
259 | efm32_uart_write32(efm_port, UARTn_IF_RXDATAV, UARTn_IFC); | 259 | efm32_uart_write32(efm_port, UARTn_IF_RXDATAV, UARTn_IFC); |
260 | efm32_uart_rx_chars(efm_port, tty); | 260 | efm32_uart_rx_chars(efm_port); |
261 | 261 | ||
262 | handled = IRQ_HANDLED; | 262 | handled = IRQ_HANDLED; |
263 | } | 263 | } |
@@ -265,8 +265,7 @@ static irqreturn_t efm32_uart_rxirq(int irq, void *data) | |||
265 | if (irqflag & UARTn_IF_RXOF) { | 265 | if (irqflag & UARTn_IF_RXOF) { |
266 | efm32_uart_write32(efm_port, UARTn_IF_RXOF, UARTn_IFC); | 266 | efm32_uart_write32(efm_port, UARTn_IF_RXOF, UARTn_IFC); |
267 | port->icount.overrun++; | 267 | port->icount.overrun++; |
268 | if (tty) | 268 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
269 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
270 | 269 | ||
271 | handled = IRQ_HANDLED; | 270 | handled = IRQ_HANDLED; |
272 | } | 271 | } |
diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c index 72b6334bcf1a..2b0b60ff7f01 100644 --- a/drivers/tty/serial/icom.c +++ b/drivers/tty/serial/icom.c | |||
@@ -734,7 +734,8 @@ static void xmit_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
734 | static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | 734 | static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) |
735 | { | 735 | { |
736 | short int count, rcv_buff; | 736 | short int count, rcv_buff; |
737 | struct tty_struct *tty = icom_port->uart_port.state->port.tty; | 737 | struct tty_port *port = &icom_port->uart_port.state->port; |
738 | struct tty_struct *tty = port->tty; | ||
738 | unsigned short int status; | 739 | unsigned short int status; |
739 | struct uart_icount *icount; | 740 | struct uart_icount *icount; |
740 | unsigned long offset; | 741 | unsigned long offset; |
@@ -812,7 +813,7 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
812 | 813 | ||
813 | } | 814 | } |
814 | 815 | ||
815 | tty_insert_flip_char(tty, *(icom_port->recv_buf + offset + count - 1), flag); | 816 | tty_insert_flip_char(port, *(icom_port->recv_buf + offset + count - 1), flag); |
816 | 817 | ||
817 | if (status & SA_FLAGS_OVERRUN) | 818 | if (status & SA_FLAGS_OVERRUN) |
818 | /* | 819 | /* |
@@ -820,7 +821,7 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
820 | * reported immediately, and doesn't | 821 | * reported immediately, and doesn't |
821 | * affect the current character | 822 | * affect the current character |
822 | */ | 823 | */ |
823 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 824 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
824 | ignore_char: | 825 | ignore_char: |
825 | icom_port->statStg->rcv[rcv_buff].flags = 0; | 826 | icom_port->statStg->rcv[rcv_buff].flags = 0; |
826 | icom_port->statStg->rcv[rcv_buff].leLength = 0; | 827 | icom_port->statStg->rcv[rcv_buff].leLength = 0; |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 1a2488495f69..f60c4028b6e1 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -517,6 +517,8 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) | |||
517 | struct imx_port *sport = dev_id; | 517 | struct imx_port *sport = dev_id; |
518 | unsigned int rx, flg, ignored = 0; | 518 | unsigned int rx, flg, ignored = 0; |
519 | struct tty_struct *tty = sport->port.state->port.tty; | 519 | struct tty_struct *tty = sport->port.state->port.tty; |
520 | struct tty_port *port = &sport->port.state->port; | ||
521 | struct tty_struct *tty = port->tty; | ||
520 | unsigned long flags, temp; | 522 | unsigned long flags, temp; |
521 | 523 | ||
522 | spin_lock_irqsave(&sport->port.lock, flags); | 524 | spin_lock_irqsave(&sport->port.lock, flags); |
@@ -569,7 +571,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) | |||
569 | #endif | 571 | #endif |
570 | } | 572 | } |
571 | 573 | ||
572 | tty_insert_flip_char(tty, rx, flg); | 574 | tty_insert_flip_char(port, rx, flg); |
573 | } | 575 | } |
574 | 576 | ||
575 | out: | 577 | out: |
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c index 3969e54744cc..ac1d36cb2032 100644 --- a/drivers/tty/serial/jsm/jsm_tty.c +++ b/drivers/tty/serial/jsm/jsm_tty.c | |||
@@ -631,13 +631,13 @@ void jsm_input(struct jsm_channel *ch) | |||
631 | * format it likes. | 631 | * format it likes. |
632 | */ | 632 | */ |
633 | if (*(ch->ch_equeue +tail +i) & UART_LSR_BI) | 633 | if (*(ch->ch_equeue +tail +i) & UART_LSR_BI) |
634 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_BREAK); | 634 | tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_BREAK); |
635 | else if (*(ch->ch_equeue +tail +i) & UART_LSR_PE) | 635 | else if (*(ch->ch_equeue +tail +i) & UART_LSR_PE) |
636 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_PARITY); | 636 | tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_PARITY); |
637 | else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE) | 637 | else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE) |
638 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_FRAME); | 638 | tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_FRAME); |
639 | else | 639 | else |
640 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL); | 640 | tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_NORMAL); |
641 | } | 641 | } |
642 | } else { | 642 | } else { |
643 | tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ; | 643 | tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ; |
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c index 6ac2b797a764..ba2ef627d9c6 100644 --- a/drivers/tty/serial/kgdb_nmi.c +++ b/drivers/tty/serial/kgdb_nmi.c | |||
@@ -216,7 +216,7 @@ static void kgdb_nmi_tty_receiver(unsigned long data) | |||
216 | return; | 216 | return; |
217 | 217 | ||
218 | while (kfifo_out(&priv->fifo, &ch, 1)) | 218 | while (kfifo_out(&priv->fifo, &ch, 1)) |
219 | tty_insert_flip_char(priv->port.tty, ch, TTY_NORMAL); | 219 | tty_insert_flip_char(&priv->port, ch, TTY_NORMAL); |
220 | tty_flip_buffer_push(priv->port.tty); | 220 | tty_flip_buffer_push(priv->port.tty); |
221 | 221 | ||
222 | tty_kref_put(tty); | 222 | tty_kref_put(tty); |
diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c index 02da071fe1e7..1933fe3c98dd 100644 --- a/drivers/tty/serial/lantiq.c +++ b/drivers/tty/serial/lantiq.c | |||
@@ -162,7 +162,8 @@ lqasc_enable_ms(struct uart_port *port) | |||
162 | static int | 162 | static int |
163 | lqasc_rx_chars(struct uart_port *port) | 163 | lqasc_rx_chars(struct uart_port *port) |
164 | { | 164 | { |
165 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | 165 | struct tty_port *tport = &port->state->port; |
166 | struct tty_struct *tty = tty_port_tty_get(tport); | ||
166 | unsigned int ch = 0, rsr = 0, fifocnt; | 167 | unsigned int ch = 0, rsr = 0, fifocnt; |
167 | 168 | ||
168 | if (!tty) { | 169 | if (!tty) { |
@@ -208,7 +209,7 @@ lqasc_rx_chars(struct uart_port *port) | |||
208 | } | 209 | } |
209 | 210 | ||
210 | if ((rsr & port->ignore_status_mask) == 0) | 211 | if ((rsr & port->ignore_status_mask) == 0) |
211 | tty_insert_flip_char(tty, ch, flag); | 212 | tty_insert_flip_char(tport, ch, flag); |
212 | 213 | ||
213 | if (rsr & ASCSTATE_ROE) | 214 | if (rsr & ASCSTATE_ROE) |
214 | /* | 215 | /* |
@@ -216,7 +217,7 @@ lqasc_rx_chars(struct uart_port *port) | |||
216 | * immediately, and doesn't affect the current | 217 | * immediately, and doesn't affect the current |
217 | * character | 218 | * character |
218 | */ | 219 | */ |
219 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 220 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
220 | } | 221 | } |
221 | if (ch != 0) | 222 | if (ch != 0) |
222 | tty_flip_buffer_push(tty); | 223 | tty_flip_buffer_push(tty); |
diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c index 0e86bff3fe2a..5cd180564c03 100644 --- a/drivers/tty/serial/lpc32xx_hs.c +++ b/drivers/tty/serial/lpc32xx_hs.c | |||
@@ -257,8 +257,9 @@ static void __serial_uart_flush(struct uart_port *port) | |||
257 | 257 | ||
258 | static void __serial_lpc32xx_rx(struct uart_port *port) | 258 | static void __serial_lpc32xx_rx(struct uart_port *port) |
259 | { | 259 | { |
260 | struct tty_port *tport = &port->state->port; | ||
260 | unsigned int tmp, flag; | 261 | unsigned int tmp, flag; |
261 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | 262 | struct tty_struct *tty = tty_port_tty_get(tport); |
262 | 263 | ||
263 | if (!tty) { | 264 | if (!tty) { |
264 | /* Discard data: no tty available */ | 265 | /* Discard data: no tty available */ |
@@ -281,10 +282,10 @@ static void __serial_lpc32xx_rx(struct uart_port *port) | |||
281 | LPC32XX_HSUART_IIR(port->membase)); | 282 | LPC32XX_HSUART_IIR(port->membase)); |
282 | port->icount.frame++; | 283 | port->icount.frame++; |
283 | flag = TTY_FRAME; | 284 | flag = TTY_FRAME; |
284 | tty_insert_flip_char(tty, 0, TTY_FRAME); | 285 | tty_insert_flip_char(tport, 0, TTY_FRAME); |
285 | } | 286 | } |
286 | 287 | ||
287 | tty_insert_flip_char(tty, (tmp & 0xFF), flag); | 288 | tty_insert_flip_char(tport, (tmp & 0xFF), flag); |
288 | 289 | ||
289 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); | 290 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); |
290 | } | 291 | } |
@@ -332,7 +333,8 @@ exit_tx: | |||
332 | static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) | 333 | static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) |
333 | { | 334 | { |
334 | struct uart_port *port = dev_id; | 335 | struct uart_port *port = dev_id; |
335 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | 336 | struct tty_port *port = &port->state->port; |
337 | struct tty_struct *tty = tty_port_tty_get(tport); | ||
336 | u32 status; | 338 | u32 status; |
337 | 339 | ||
338 | spin_lock(&port->lock); | 340 | spin_lock(&port->lock); |
@@ -356,8 +358,8 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) | |||
356 | writel(LPC32XX_HSU_RX_OE_INT, | 358 | writel(LPC32XX_HSU_RX_OE_INT, |
357 | LPC32XX_HSUART_IIR(port->membase)); | 359 | LPC32XX_HSUART_IIR(port->membase)); |
358 | port->icount.overrun++; | 360 | port->icount.overrun++; |
361 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); | ||
359 | if (tty) { | 362 | if (tty) { |
360 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
361 | tty_schedule_flip(tty); | 363 | tty_schedule_flip(tty); |
362 | } | 364 | } |
363 | } | 365 | } |
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c index b13949ad3408..2e9a390f2ac4 100644 --- a/drivers/tty/serial/m32r_sio.c +++ b/drivers/tty/serial/m32r_sio.c | |||
@@ -300,7 +300,8 @@ static void m32r_sio_enable_ms(struct uart_port *port) | |||
300 | 300 | ||
301 | static void receive_chars(struct uart_sio_port *up, int *status) | 301 | static void receive_chars(struct uart_sio_port *up, int *status) |
302 | { | 302 | { |
303 | struct tty_struct *tty = up->port.state->port.tty; | 303 | struct tty_port *port = &up->port.state->port; |
304 | struct tty_struct *tty = tport->tty; | ||
304 | unsigned char ch; | 305 | unsigned char ch; |
305 | unsigned char flag; | 306 | unsigned char flag; |
306 | int max_count = 256; | 307 | int max_count = 256; |
@@ -355,7 +356,7 @@ static void receive_chars(struct uart_sio_port *up, int *status) | |||
355 | if (uart_handle_sysrq_char(&up->port, ch)) | 356 | if (uart_handle_sysrq_char(&up->port, ch)) |
356 | goto ignore_char; | 357 | goto ignore_char; |
357 | if ((*status & up->port.ignore_status_mask) == 0) | 358 | if ((*status & up->port.ignore_status_mask) == 0) |
358 | tty_insert_flip_char(tty, ch, flag); | 359 | tty_insert_flip_char(port, ch, flag); |
359 | 360 | ||
360 | if (*status & UART_LSR_OE) { | 361 | if (*status & UART_LSR_OE) { |
361 | /* | 362 | /* |
@@ -363,7 +364,7 @@ static void receive_chars(struct uart_sio_port *up, int *status) | |||
363 | * immediately, and doesn't affect the current | 364 | * immediately, and doesn't affect the current |
364 | * character. | 365 | * character. |
365 | */ | 366 | */ |
366 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 367 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
367 | } | 368 | } |
368 | ignore_char: | 369 | ignore_char: |
369 | *status = serial_in(up, UART_LSR); | 370 | *status = serial_in(up, UART_LSR); |
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c index 7c23c4f4c58d..0145aeb7721c 100644 --- a/drivers/tty/serial/mpc52xx_uart.c +++ b/drivers/tty/serial/mpc52xx_uart.c | |||
@@ -941,7 +941,8 @@ static struct uart_ops mpc52xx_uart_ops = { | |||
941 | static inline int | 941 | static inline int |
942 | mpc52xx_uart_int_rx_chars(struct uart_port *port) | 942 | mpc52xx_uart_int_rx_chars(struct uart_port *port) |
943 | { | 943 | { |
944 | struct tty_struct *tty = port->state->port.tty; | 944 | struct tty_port *tport = &port->state->port; |
945 | struct tty_struct *tty = tport->tty; | ||
945 | unsigned char ch, flag; | 946 | unsigned char ch, flag; |
946 | unsigned short status; | 947 | unsigned short status; |
947 | 948 | ||
@@ -986,14 +987,14 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port) | |||
986 | out_8(&PSC(port)->command, MPC52xx_PSC_RST_ERR_STAT); | 987 | out_8(&PSC(port)->command, MPC52xx_PSC_RST_ERR_STAT); |
987 | 988 | ||
988 | } | 989 | } |
989 | tty_insert_flip_char(tty, ch, flag); | 990 | tty_insert_flip_char(tport, ch, flag); |
990 | if (status & MPC52xx_PSC_SR_OE) { | 991 | if (status & MPC52xx_PSC_SR_OE) { |
991 | /* | 992 | /* |
992 | * Overrun is special, since it's | 993 | * Overrun is special, since it's |
993 | * reported immediately, and doesn't | 994 | * reported immediately, and doesn't |
994 | * affect the current character | 995 | * affect the current character |
995 | */ | 996 | */ |
996 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 997 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
997 | port->icount.overrun++; | 998 | port->icount.overrun++; |
998 | } | 999 | } |
999 | } | 1000 | } |
diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c index 50366863cfa3..4bcbc66c48c4 100644 --- a/drivers/tty/serial/mpsc.c +++ b/drivers/tty/serial/mpsc.c | |||
@@ -1040,10 +1040,10 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi) | |||
1040 | | SDMA_DESC_CMDSTAT_FR | 1040 | | SDMA_DESC_CMDSTAT_FR |
1041 | | SDMA_DESC_CMDSTAT_OR))) | 1041 | | SDMA_DESC_CMDSTAT_OR))) |
1042 | && !(cmdstat & pi->port.ignore_status_mask)) { | 1042 | && !(cmdstat & pi->port.ignore_status_mask)) { |
1043 | tty_insert_flip_char(tty, *bp, flag); | 1043 | tty_insert_flip_char(port, *bp, flag); |
1044 | } else { | 1044 | } else { |
1045 | for (i=0; i<bytes_in; i++) | 1045 | for (i=0; i<bytes_in; i++) |
1046 | tty_insert_flip_char(tty, *bp++, TTY_NORMAL); | 1046 | tty_insert_flip_char(port, *bp++, TTY_NORMAL); |
1047 | 1047 | ||
1048 | pi->port.icount.rx += bytes_in; | 1048 | pi->port.icount.rx += bytes_in; |
1049 | } | 1049 | } |
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 95fd39be2934..e4eb81a12793 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c | |||
@@ -91,14 +91,15 @@ static void msm_enable_ms(struct uart_port *port) | |||
91 | 91 | ||
92 | static void handle_rx_dm(struct uart_port *port, unsigned int misr) | 92 | static void handle_rx_dm(struct uart_port *port, unsigned int misr) |
93 | { | 93 | { |
94 | struct tty_struct *tty = port->state->port.tty; | 94 | struct tty_port *tport = &port->state->port; |
95 | struct tty_struct *tty = tport->tty; | ||
95 | unsigned int sr; | 96 | unsigned int sr; |
96 | int count = 0; | 97 | int count = 0; |
97 | struct msm_port *msm_port = UART_TO_MSM(port); | 98 | struct msm_port *msm_port = UART_TO_MSM(port); |
98 | 99 | ||
99 | if ((msm_read(port, UART_SR) & UART_SR_OVERRUN)) { | 100 | if ((msm_read(port, UART_SR) & UART_SR_OVERRUN)) { |
100 | port->icount.overrun++; | 101 | port->icount.overrun++; |
101 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 102 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
102 | msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR); | 103 | msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR); |
103 | } | 104 | } |
104 | 105 | ||
@@ -146,7 +147,8 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr) | |||
146 | 147 | ||
147 | static void handle_rx(struct uart_port *port) | 148 | static void handle_rx(struct uart_port *port) |
148 | { | 149 | { |
149 | struct tty_struct *tty = port->state->port.tty; | 150 | struct tty_port *tport = &port->state->port; |
151 | struct tty_struct *tty = tport->tty; | ||
150 | unsigned int sr; | 152 | unsigned int sr; |
151 | 153 | ||
152 | /* | 154 | /* |
@@ -155,7 +157,7 @@ static void handle_rx(struct uart_port *port) | |||
155 | */ | 157 | */ |
156 | if ((msm_read(port, UART_SR) & UART_SR_OVERRUN)) { | 158 | if ((msm_read(port, UART_SR) & UART_SR_OVERRUN)) { |
157 | port->icount.overrun++; | 159 | port->icount.overrun++; |
158 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 160 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
159 | msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR); | 161 | msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR); |
160 | } | 162 | } |
161 | 163 | ||
@@ -186,7 +188,7 @@ static void handle_rx(struct uart_port *port) | |||
186 | } | 188 | } |
187 | 189 | ||
188 | if (!uart_handle_sysrq_char(port, c)) | 190 | if (!uart_handle_sysrq_char(port, c)) |
189 | tty_insert_flip_char(tty, c, flag); | 191 | tty_insert_flip_char(tport, c, flag); |
190 | } | 192 | } |
191 | 193 | ||
192 | tty_flip_buffer_push(tty); | 194 | tty_flip_buffer_push(tty); |
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c index 1fa92284ade0..6aa9d470ef54 100644 --- a/drivers/tty/serial/msm_serial_hs.c +++ b/drivers/tty/serial/msm_serial_hs.c | |||
@@ -908,6 +908,7 @@ static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr, | |||
908 | unsigned long flags; | 908 | unsigned long flags; |
909 | unsigned int flush; | 909 | unsigned int flush; |
910 | struct tty_struct *tty; | 910 | struct tty_struct *tty; |
911 | struct tty_port *port; | ||
911 | struct uart_port *uport; | 912 | struct uart_port *uport; |
912 | struct msm_hs_port *msm_uport; | 913 | struct msm_hs_port *msm_uport; |
913 | 914 | ||
@@ -917,7 +918,8 @@ static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr, | |||
917 | spin_lock_irqsave(&uport->lock, flags); | 918 | spin_lock_irqsave(&uport->lock, flags); |
918 | clk_enable(msm_uport->clk); | 919 | clk_enable(msm_uport->clk); |
919 | 920 | ||
920 | tty = uport->state->port.tty; | 921 | port = &uport->state->port; |
922 | tty = port->tty; | ||
921 | 923 | ||
922 | msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE); | 924 | msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE); |
923 | 925 | ||
@@ -926,7 +928,7 @@ static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr, | |||
926 | /* overflow is not connect to data in a FIFO */ | 928 | /* overflow is not connect to data in a FIFO */ |
927 | if (unlikely((status & UARTDM_SR_OVERRUN_BMSK) && | 929 | if (unlikely((status & UARTDM_SR_OVERRUN_BMSK) && |
928 | (uport->read_status_mask & CREAD))) { | 930 | (uport->read_status_mask & CREAD))) { |
929 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 931 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
930 | uport->icount.buf_overrun++; | 932 | uport->icount.buf_overrun++; |
931 | error_f = 1; | 933 | error_f = 1; |
932 | } | 934 | } |
@@ -939,7 +941,7 @@ static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr, | |||
939 | uport->icount.parity++; | 941 | uport->icount.parity++; |
940 | error_f = 1; | 942 | error_f = 1; |
941 | if (uport->ignore_status_mask & IGNPAR) | 943 | if (uport->ignore_status_mask & IGNPAR) |
942 | tty_insert_flip_char(tty, 0, TTY_PARITY); | 944 | tty_insert_flip_char(port, 0, TTY_PARITY); |
943 | } | 945 | } |
944 | 946 | ||
945 | if (error_f) | 947 | if (error_f) |
@@ -1344,7 +1346,6 @@ static irqreturn_t msm_hs_rx_wakeup_isr(int irq, void *dev) | |||
1344 | unsigned long flags; | 1346 | unsigned long flags; |
1345 | struct msm_hs_port *msm_uport = dev; | 1347 | struct msm_hs_port *msm_uport = dev; |
1346 | struct uart_port *uport = &msm_uport->uport; | 1348 | struct uart_port *uport = &msm_uport->uport; |
1347 | struct tty_struct *tty = NULL; | ||
1348 | 1349 | ||
1349 | spin_lock_irqsave(&uport->lock, flags); | 1350 | spin_lock_irqsave(&uport->lock, flags); |
1350 | if (msm_uport->clk_state == MSM_HS_CLK_OFF) { | 1351 | if (msm_uport->clk_state == MSM_HS_CLK_OFF) { |
@@ -1361,8 +1362,7 @@ static irqreturn_t msm_hs_rx_wakeup_isr(int irq, void *dev) | |||
1361 | * optionally inject char into tty rx */ | 1362 | * optionally inject char into tty rx */ |
1362 | msm_hs_request_clock_on_locked(uport); | 1363 | msm_hs_request_clock_on_locked(uport); |
1363 | if (msm_uport->rx_wakeup.inject_rx) { | 1364 | if (msm_uport->rx_wakeup.inject_rx) { |
1364 | tty = uport->state->port.tty; | 1365 | tty_insert_flip_char(&uport->state->port, |
1365 | tty_insert_flip_char(tty, | ||
1366 | msm_uport->rx_wakeup.rx_to_inject, | 1366 | msm_uport->rx_wakeup.rx_to_inject, |
1367 | TTY_NORMAL); | 1367 | TTY_NORMAL); |
1368 | queue_work(msm_hs_workqueue, &msm_uport->rx.tty_work); | 1368 | queue_work(msm_hs_workqueue, &msm_uport->rx.tty_work); |
diff --git a/drivers/tty/serial/mux.c b/drivers/tty/serial/mux.c index e2775b6df5a5..83b21686020e 100644 --- a/drivers/tty/serial/mux.c +++ b/drivers/tty/serial/mux.c | |||
@@ -242,8 +242,9 @@ static void mux_write(struct uart_port *port) | |||
242 | */ | 242 | */ |
243 | static void mux_read(struct uart_port *port) | 243 | static void mux_read(struct uart_port *port) |
244 | { | 244 | { |
245 | struct tty_port *tport = &port->state->port; | ||
245 | int data; | 246 | int data; |
246 | struct tty_struct *tty = port->state->port.tty; | 247 | struct tty_struct *tty = tport->tty; |
247 | __u32 start_count = port->icount.rx; | 248 | __u32 start_count = port->icount.rx; |
248 | 249 | ||
249 | while(1) { | 250 | while(1) { |
@@ -266,7 +267,7 @@ static void mux_read(struct uart_port *port) | |||
266 | if (uart_handle_sysrq_char(port, data & 0xffu)) | 267 | if (uart_handle_sysrq_char(port, data & 0xffu)) |
267 | continue; | 268 | continue; |
268 | 269 | ||
269 | tty_insert_flip_char(tty, data & 0xFF, TTY_NORMAL); | 270 | tty_insert_flip_char(tport, data & 0xFF, TTY_NORMAL); |
270 | } | 271 | } |
271 | 272 | ||
272 | if (start_count != port->icount.rx) { | 273 | if (start_count != port->icount.rx) { |
diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c index dd4c31d1aee5..10d64a3697fb 100644 --- a/drivers/tty/serial/nwpserial.c +++ b/drivers/tty/serial/nwpserial.c | |||
@@ -128,7 +128,8 @@ static void nwpserial_config_port(struct uart_port *port, int flags) | |||
128 | static irqreturn_t nwpserial_interrupt(int irq, void *dev_id) | 128 | static irqreturn_t nwpserial_interrupt(int irq, void *dev_id) |
129 | { | 129 | { |
130 | struct nwpserial_port *up = dev_id; | 130 | struct nwpserial_port *up = dev_id; |
131 | struct tty_struct *tty = up->port.state->port.tty; | 131 | struct tty_port *port = &up->port.state->port; |
132 | struct tty_struct *tty = port->tty; | ||
132 | irqreturn_t ret; | 133 | irqreturn_t ret; |
133 | unsigned int iir; | 134 | unsigned int iir; |
134 | unsigned char ch; | 135 | unsigned char ch; |
@@ -146,7 +147,7 @@ static irqreturn_t nwpserial_interrupt(int irq, void *dev_id) | |||
146 | up->port.icount.rx++; | 147 | up->port.icount.rx++; |
147 | ch = dcr_read(up->dcr_host, UART_RX); | 148 | ch = dcr_read(up->dcr_host, UART_RX); |
148 | if (up->port.ignore_status_mask != NWPSERIAL_STATUS_RXVALID) | 149 | if (up->port.ignore_status_mask != NWPSERIAL_STATUS_RXVALID) |
149 | tty_insert_flip_char(tty, ch, TTY_NORMAL); | 150 | tty_insert_flip_char(port, ch, TTY_NORMAL); |
150 | } while (dcr_read(up->dcr_host, UART_LSR) & UART_LSR_DR); | 151 | } while (dcr_read(up->dcr_host, UART_LSR) & UART_LSR_DR); |
151 | 152 | ||
152 | tty_flip_buffer_push(tty); | 153 | tty_flip_buffer_push(tty); |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 333c8d012b0e..73a3f295e7c4 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
@@ -229,6 +229,7 @@ static void pmz_interrupt_control(struct uart_pmac_port *uap, int enable) | |||
229 | 229 | ||
230 | static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap) | 230 | static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap) |
231 | { | 231 | { |
232 | struct tty_port *port; | ||
232 | struct tty_struct *tty = NULL; | 233 | struct tty_struct *tty = NULL; |
233 | unsigned char ch, r1, drop, error, flag; | 234 | unsigned char ch, r1, drop, error, flag; |
234 | int loops = 0; | 235 | int loops = 0; |
@@ -239,7 +240,8 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap) | |||
239 | (void)read_zsdata(uap); | 240 | (void)read_zsdata(uap); |
240 | return NULL; | 241 | return NULL; |
241 | } | 242 | } |
242 | tty = uap->port.state->port.tty; | 243 | port = &uap->port.state->port; |
244 | tty = port->tty; /* TOCTOU above */ | ||
243 | 245 | ||
244 | while (1) { | 246 | while (1) { |
245 | error = 0; | 247 | error = 0; |
@@ -309,10 +311,10 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap) | |||
309 | 311 | ||
310 | if (uap->port.ignore_status_mask == 0xff || | 312 | if (uap->port.ignore_status_mask == 0xff || |
311 | (r1 & uap->port.ignore_status_mask) == 0) { | 313 | (r1 & uap->port.ignore_status_mask) == 0) { |
312 | tty_insert_flip_char(tty, ch, flag); | 314 | tty_insert_flip_char(port, ch, flag); |
313 | } | 315 | } |
314 | if (r1 & Rx_OVR) | 316 | if (r1 & Rx_OVR) |
315 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 317 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
316 | next_char: | 318 | next_char: |
317 | /* We can get stuck in an infinite loop getting char 0 when the | 319 | /* We can get stuck in an infinite loop getting char 0 when the |
318 | * line is in a wrong HW state, we break that here. | 320 | * line is in a wrong HW state, we break that here. |
diff --git a/drivers/tty/serial/sc26xx.c b/drivers/tty/serial/sc26xx.c index aced1dd923d8..0cd0e4ac12a6 100644 --- a/drivers/tty/serial/sc26xx.c +++ b/drivers/tty/serial/sc26xx.c | |||
@@ -138,14 +138,18 @@ static void sc26xx_disable_irq(struct uart_port *port, int mask) | |||
138 | 138 | ||
139 | static struct tty_struct *receive_chars(struct uart_port *port) | 139 | static struct tty_struct *receive_chars(struct uart_port *port) |
140 | { | 140 | { |
141 | struct tty_port *tport = NULL; | ||
141 | struct tty_struct *tty = NULL; | 142 | struct tty_struct *tty = NULL; |
142 | int limit = 10000; | 143 | int limit = 10000; |
143 | unsigned char ch; | 144 | unsigned char ch; |
144 | char flag; | 145 | char flag; |
145 | u8 status; | 146 | u8 status; |
146 | 147 | ||
147 | if (port->state != NULL) /* Unopened serial console */ | 148 | /* FIXME what is this trying to achieve? */ |
148 | tty = port->state->port.tty; | 149 | if (port->state != NULL) { /* Unopened serial console */ |
150 | tport = &port->state->port; | ||
151 | tty = tport->tty; | ||
152 | } | ||
149 | 153 | ||
150 | while (limit-- > 0) { | 154 | while (limit-- > 0) { |
151 | status = READ_SC_PORT(port, SR); | 155 | status = READ_SC_PORT(port, SR); |
@@ -185,7 +189,7 @@ static struct tty_struct *receive_chars(struct uart_port *port) | |||
185 | if (status & port->ignore_status_mask) | 189 | if (status & port->ignore_status_mask) |
186 | continue; | 190 | continue; |
187 | 191 | ||
188 | tty_insert_flip_char(tty, ch, flag); | 192 | tty_insert_flip_char(tport, ch, flag); |
189 | } | 193 | } |
190 | return tty; | 194 | return tty; |
191 | } | 195 | } |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index ba7863bbbb4d..675343a20f24 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -2792,10 +2792,10 @@ EXPORT_SYMBOL_GPL(uart_handle_cts_change); | |||
2792 | void uart_insert_char(struct uart_port *port, unsigned int status, | 2792 | void uart_insert_char(struct uart_port *port, unsigned int status, |
2793 | unsigned int overrun, unsigned int ch, unsigned int flag) | 2793 | unsigned int overrun, unsigned int ch, unsigned int flag) |
2794 | { | 2794 | { |
2795 | struct tty_struct *tty = port->state->port.tty; | 2795 | struct tty_port *tport = &port->state->port; |
2796 | 2796 | ||
2797 | if ((status & port->ignore_status_mask & ~overrun) == 0) | 2797 | if ((status & port->ignore_status_mask & ~overrun) == 0) |
2798 | if (tty_insert_flip_char(tty, ch, flag) == 0) | 2798 | if (tty_insert_flip_char(tport, ch, flag) == 0) |
2799 | ++port->icount.buf_overrun; | 2799 | ++port->icount.buf_overrun; |
2800 | 2800 | ||
2801 | /* | 2801 | /* |
@@ -2803,7 +2803,7 @@ void uart_insert_char(struct uart_port *port, unsigned int status, | |||
2803 | * it doesn't affect the current character. | 2803 | * it doesn't affect the current character. |
2804 | */ | 2804 | */ |
2805 | if (status & ~port->ignore_status_mask & overrun) | 2805 | if (status & ~port->ignore_status_mask & overrun) |
2806 | if (tty_insert_flip_char(tty, 0, TTY_OVERRUN) == 0) | 2806 | if (tty_insert_flip_char(tport, 0, TTY_OVERRUN) == 0) |
2807 | ++port->icount.buf_overrun; | 2807 | ++port->icount.buf_overrun; |
2808 | } | 2808 | } |
2809 | EXPORT_SYMBOL_GPL(uart_insert_char); | 2809 | EXPORT_SYMBOL_GPL(uart_insert_char); |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index cf96314770fb..ecef748f5385 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -620,7 +620,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
620 | sci_port->break_flag) | 620 | sci_port->break_flag) |
621 | count = 0; | 621 | count = 0; |
622 | else | 622 | else |
623 | tty_insert_flip_char(tty, c, TTY_NORMAL); | 623 | tty_insert_flip_char(tport, c, TTY_NORMAL); |
624 | } else { | 624 | } else { |
625 | for (i = 0; i < count; i++) { | 625 | for (i = 0; i < count; i++) { |
626 | char c = serial_port_in(port, SCxRDR); | 626 | char c = serial_port_in(port, SCxRDR); |
@@ -662,7 +662,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
662 | } else | 662 | } else |
663 | flag = TTY_NORMAL; | 663 | flag = TTY_NORMAL; |
664 | 664 | ||
665 | tty_insert_flip_char(tty, c, flag); | 665 | tty_insert_flip_char(tport, c, flag); |
666 | } | 666 | } |
667 | } | 667 | } |
668 | 668 | ||
@@ -721,7 +721,8 @@ static int sci_handle_errors(struct uart_port *port) | |||
721 | { | 721 | { |
722 | int copied = 0; | 722 | int copied = 0; |
723 | unsigned short status = serial_port_in(port, SCxSR); | 723 | unsigned short status = serial_port_in(port, SCxSR); |
724 | struct tty_struct *tty = port->state->port.tty; | 724 | struct tty_port *tport = &port->state->port; |
725 | struct tty_struct *tty = tport->tty; | ||
725 | struct sci_port *s = to_sci_port(port); | 726 | struct sci_port *s = to_sci_port(port); |
726 | 727 | ||
727 | /* | 728 | /* |
@@ -732,7 +733,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
732 | port->icount.overrun++; | 733 | port->icount.overrun++; |
733 | 734 | ||
734 | /* overrun error */ | 735 | /* overrun error */ |
735 | if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) | 736 | if (tty_insert_flip_char(tport, 0, TTY_OVERRUN)) |
736 | copied++; | 737 | copied++; |
737 | 738 | ||
738 | dev_notice(port->dev, "overrun error"); | 739 | dev_notice(port->dev, "overrun error"); |
@@ -756,7 +757,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
756 | 757 | ||
757 | dev_dbg(port->dev, "BREAK detected\n"); | 758 | dev_dbg(port->dev, "BREAK detected\n"); |
758 | 759 | ||
759 | if (tty_insert_flip_char(tty, 0, TTY_BREAK)) | 760 | if (tty_insert_flip_char(tport, 0, TTY_BREAK)) |
760 | copied++; | 761 | copied++; |
761 | } | 762 | } |
762 | 763 | ||
@@ -764,7 +765,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
764 | /* frame error */ | 765 | /* frame error */ |
765 | port->icount.frame++; | 766 | port->icount.frame++; |
766 | 767 | ||
767 | if (tty_insert_flip_char(tty, 0, TTY_FRAME)) | 768 | if (tty_insert_flip_char(tport, 0, TTY_FRAME)) |
768 | copied++; | 769 | copied++; |
769 | 770 | ||
770 | dev_notice(port->dev, "frame error\n"); | 771 | dev_notice(port->dev, "frame error\n"); |
@@ -775,7 +776,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
775 | /* parity error */ | 776 | /* parity error */ |
776 | port->icount.parity++; | 777 | port->icount.parity++; |
777 | 778 | ||
778 | if (tty_insert_flip_char(tty, 0, TTY_PARITY)) | 779 | if (tty_insert_flip_char(tport, 0, TTY_PARITY)) |
779 | copied++; | 780 | copied++; |
780 | 781 | ||
781 | dev_notice(port->dev, "parity error"); | 782 | dev_notice(port->dev, "parity error"); |
@@ -789,7 +790,8 @@ static int sci_handle_errors(struct uart_port *port) | |||
789 | 790 | ||
790 | static int sci_handle_fifo_overrun(struct uart_port *port) | 791 | static int sci_handle_fifo_overrun(struct uart_port *port) |
791 | { | 792 | { |
792 | struct tty_struct *tty = port->state->port.tty; | 793 | struct tty_port *tport = &port->state->port; |
794 | struct tty_struct *tty = tport->tty; | ||
793 | struct sci_port *s = to_sci_port(port); | 795 | struct sci_port *s = to_sci_port(port); |
794 | struct plat_sci_reg *reg; | 796 | struct plat_sci_reg *reg; |
795 | int copied = 0; | 797 | int copied = 0; |
@@ -803,7 +805,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
803 | 805 | ||
804 | port->icount.overrun++; | 806 | port->icount.overrun++; |
805 | 807 | ||
806 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 808 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
807 | tty_flip_buffer_push(tty); | 809 | tty_flip_buffer_push(tty); |
808 | 810 | ||
809 | dev_notice(port->dev, "overrun error\n"); | 811 | dev_notice(port->dev, "overrun error\n"); |
@@ -817,7 +819,8 @@ static int sci_handle_breaks(struct uart_port *port) | |||
817 | { | 819 | { |
818 | int copied = 0; | 820 | int copied = 0; |
819 | unsigned short status = serial_port_in(port, SCxSR); | 821 | unsigned short status = serial_port_in(port, SCxSR); |
820 | struct tty_struct *tty = port->state->port.tty; | 822 | struct tty_port *tport = &port->state->port; |
823 | struct tty_struct *tty = tport->tty; | ||
821 | struct sci_port *s = to_sci_port(port); | 824 | struct sci_port *s = to_sci_port(port); |
822 | 825 | ||
823 | if (uart_handle_break(port)) | 826 | if (uart_handle_break(port)) |
@@ -832,7 +835,7 @@ static int sci_handle_breaks(struct uart_port *port) | |||
832 | port->icount.brk++; | 835 | port->icount.brk++; |
833 | 836 | ||
834 | /* Notify of BREAK */ | 837 | /* Notify of BREAK */ |
835 | if (tty_insert_flip_char(tty, 0, TTY_BREAK)) | 838 | if (tty_insert_flip_char(tport, 0, TTY_BREAK)) |
836 | copied++; | 839 | copied++; |
837 | 840 | ||
838 | dev_dbg(port->dev, "BREAK detected\n"); | 841 | dev_dbg(port->dev, "BREAK detected\n"); |
@@ -1260,8 +1263,7 @@ static void sci_dma_tx_complete(void *arg) | |||
1260 | } | 1263 | } |
1261 | 1264 | ||
1262 | /* Locking: called with port lock held */ | 1265 | /* Locking: called with port lock held */ |
1263 | static int sci_dma_rx_push(struct sci_port *s, struct tty_struct *tty, | 1266 | static int sci_dma_rx_push(struct sci_port *s, size_t count) |
1264 | size_t count) | ||
1265 | { | 1267 | { |
1266 | struct uart_port *port = &s->port; | 1268 | struct uart_port *port = &s->port; |
1267 | struct tty_port *tport = &port->state->port; | 1269 | struct tty_port *tport = &port->state->port; |
@@ -1285,7 +1287,7 @@ static int sci_dma_rx_push(struct sci_port *s, struct tty_struct *tty, | |||
1285 | return room; | 1287 | return room; |
1286 | 1288 | ||
1287 | for (i = 0; i < room; i++) | 1289 | for (i = 0; i < room; i++) |
1288 | tty_insert_flip_char(tty, ((u8 *)sg_virt(&s->sg_rx[active]))[i], | 1290 | tty_insert_flip_char(tport, ((u8 *)sg_virt(&s->sg_rx[active]))[i], |
1289 | TTY_NORMAL); | 1291 | TTY_NORMAL); |
1290 | 1292 | ||
1291 | port->icount.rx += room; | 1293 | port->icount.rx += room; |
@@ -1305,7 +1307,7 @@ static void sci_dma_rx_complete(void *arg) | |||
1305 | 1307 | ||
1306 | spin_lock_irqsave(&port->lock, flags); | 1308 | spin_lock_irqsave(&port->lock, flags); |
1307 | 1309 | ||
1308 | count = sci_dma_rx_push(s, tty, s->buf_len_rx); | 1310 | count = sci_dma_rx_push(s, s->buf_len_rx); |
1309 | 1311 | ||
1310 | mod_timer(&s->rx_timer, jiffies + s->rx_timeout); | 1312 | mod_timer(&s->rx_timer, jiffies + s->rx_timeout); |
1311 | 1313 | ||
@@ -1418,7 +1420,7 @@ static void work_fn_rx(struct work_struct *work) | |||
1418 | sh_desc->partial, sh_desc->cookie); | 1420 | sh_desc->partial, sh_desc->cookie); |
1419 | 1421 | ||
1420 | spin_lock_irqsave(&port->lock, flags); | 1422 | spin_lock_irqsave(&port->lock, flags); |
1421 | count = sci_dma_rx_push(s, tty, sh_desc->partial); | 1423 | count = sci_dma_rx_push(s, sh_desc->partial); |
1422 | spin_unlock_irqrestore(&port->lock, flags); | 1424 | spin_unlock_irqrestore(&port->lock, flags); |
1423 | 1425 | ||
1424 | if (count) | 1426 | if (count) |
diff --git a/drivers/tty/serial/sn_console.c b/drivers/tty/serial/sn_console.c index 1c6de9f58699..283232c64656 100644 --- a/drivers/tty/serial/sn_console.c +++ b/drivers/tty/serial/sn_console.c | |||
@@ -457,6 +457,7 @@ static int sn_debug_printf(const char *fmt, ...) | |||
457 | static void | 457 | static void |
458 | sn_receive_chars(struct sn_cons_port *port, unsigned long flags) | 458 | sn_receive_chars(struct sn_cons_port *port, unsigned long flags) |
459 | { | 459 | { |
460 | struct tty_port *tport = NULL; | ||
460 | int ch; | 461 | int ch; |
461 | struct tty_struct *tty; | 462 | struct tty_struct *tty; |
462 | 463 | ||
@@ -472,7 +473,8 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags) | |||
472 | 473 | ||
473 | if (port->sc_port.state) { | 474 | if (port->sc_port.state) { |
474 | /* The serial_core stuffs are initialized, use them */ | 475 | /* The serial_core stuffs are initialized, use them */ |
475 | tty = port->sc_port.state->port.tty; | 476 | tport = &port->sc_port.state->port; |
477 | tty = tport->tty; | ||
476 | } | 478 | } |
477 | else { | 479 | else { |
478 | /* Not registered yet - can't pass to tty layer. */ | 480 | /* Not registered yet - can't pass to tty layer. */ |
@@ -517,7 +519,7 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags) | |||
517 | 519 | ||
518 | /* record the character to pass up to the tty layer */ | 520 | /* record the character to pass up to the tty layer */ |
519 | if (tty) { | 521 | if (tty) { |
520 | if(tty_insert_flip_char(tty, ch, TTY_NORMAL) == 0) | 522 | if (tty_insert_flip_char(tport, ch, TTY_NORMAL) == 0) |
521 | break; | 523 | break; |
522 | } | 524 | } |
523 | port->sc_port.icount.rx++; | 525 | port->sc_port.icount.rx++; |
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c index b9bf9c53f7fd..bbb102e3c035 100644 --- a/drivers/tty/serial/sunhv.c +++ b/drivers/tty/serial/sunhv.c | |||
@@ -99,7 +99,7 @@ static int receive_chars_getchar(struct uart_port *port, struct tty_struct *tty) | |||
99 | uart_handle_dcd_change(port, 1); | 99 | uart_handle_dcd_change(port, 1); |
100 | } | 100 | } |
101 | 101 | ||
102 | if (tty == NULL) { | 102 | if (port->state == NULL) { |
103 | uart_handle_sysrq_char(port, c); | 103 | uart_handle_sysrq_char(port, c); |
104 | continue; | 104 | continue; |
105 | } | 105 | } |
@@ -109,7 +109,7 @@ static int receive_chars_getchar(struct uart_port *port, struct tty_struct *tty) | |||
109 | if (uart_handle_sysrq_char(port, c)) | 109 | if (uart_handle_sysrq_char(port, c)) |
110 | continue; | 110 | continue; |
111 | 111 | ||
112 | tty_insert_flip_char(tty, c, TTY_NORMAL); | 112 | tty_insert_flip_char(&port->state->port, c, TTY_NORMAL); |
113 | } | 113 | } |
114 | 114 | ||
115 | return saw_console_brk; | 115 | return saw_console_brk; |
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index bd8b3b634103..4abc4d43a8e8 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
@@ -111,6 +111,7 @@ static struct tty_struct * | |||
111 | receive_chars(struct uart_sunsab_port *up, | 111 | receive_chars(struct uart_sunsab_port *up, |
112 | union sab82532_irq_status *stat) | 112 | union sab82532_irq_status *stat) |
113 | { | 113 | { |
114 | struct tty_port *port = NULL; | ||
114 | struct tty_struct *tty = NULL; | 115 | struct tty_struct *tty = NULL; |
115 | unsigned char buf[32]; | 116 | unsigned char buf[32]; |
116 | int saw_console_brk = 0; | 117 | int saw_console_brk = 0; |
@@ -118,8 +119,10 @@ receive_chars(struct uart_sunsab_port *up, | |||
118 | int count = 0; | 119 | int count = 0; |
119 | int i; | 120 | int i; |
120 | 121 | ||
121 | if (up->port.state != NULL) /* Unopened serial console */ | 122 | if (up->port.state != NULL) { /* Unopened serial console */ |
122 | tty = up->port.state->port.tty; | 123 | port = &up->port.state->port; |
124 | tty = port->tty; | ||
125 | } | ||
123 | 126 | ||
124 | /* Read number of BYTES (Character + Status) available. */ | 127 | /* Read number of BYTES (Character + Status) available. */ |
125 | if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { | 128 | if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { |
@@ -160,11 +163,6 @@ receive_chars(struct uart_sunsab_port *up, | |||
160 | for (i = 0; i < count; i++) { | 163 | for (i = 0; i < count; i++) { |
161 | unsigned char ch = buf[i], flag; | 164 | unsigned char ch = buf[i], flag; |
162 | 165 | ||
163 | if (tty == NULL) { | ||
164 | uart_handle_sysrq_char(&up->port, ch); | ||
165 | continue; | ||
166 | } | ||
167 | |||
168 | flag = TTY_NORMAL; | 166 | flag = TTY_NORMAL; |
169 | up->port.icount.rx++; | 167 | up->port.icount.rx++; |
170 | 168 | ||
@@ -213,9 +211,9 @@ receive_chars(struct uart_sunsab_port *up, | |||
213 | 211 | ||
214 | if ((stat->sreg.isr0 & (up->port.ignore_status_mask & 0xff)) == 0 && | 212 | if ((stat->sreg.isr0 & (up->port.ignore_status_mask & 0xff)) == 0 && |
215 | (stat->sreg.isr1 & ((up->port.ignore_status_mask >> 8) & 0xff)) == 0) | 213 | (stat->sreg.isr1 & ((up->port.ignore_status_mask >> 8) & 0xff)) == 0) |
216 | tty_insert_flip_char(tty, ch, flag); | 214 | tty_insert_flip_char(port, ch, flag); |
217 | if (stat->sreg.isr0 & SAB82532_ISR0_RFO) | 215 | if (stat->sreg.isr0 & SAB82532_ISR0_RFO) |
218 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 216 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
219 | } | 217 | } |
220 | 218 | ||
221 | if (saw_console_brk) | 219 | if (saw_console_brk) |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index 220da3f9724f..52325968b06c 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -318,7 +318,8 @@ static void sunsu_enable_ms(struct uart_port *port) | |||
318 | static struct tty_struct * | 318 | static struct tty_struct * |
319 | receive_chars(struct uart_sunsu_port *up, unsigned char *status) | 319 | receive_chars(struct uart_sunsu_port *up, unsigned char *status) |
320 | { | 320 | { |
321 | struct tty_struct *tty = up->port.state->port.tty; | 321 | struct tty_port *port = &up->port.state->port; |
322 | struct tty_struct *tty = port->tty; | ||
322 | unsigned char ch, flag; | 323 | unsigned char ch, flag; |
323 | int max_count = 256; | 324 | int max_count = 256; |
324 | int saw_console_brk = 0; | 325 | int saw_console_brk = 0; |
@@ -376,14 +377,14 @@ receive_chars(struct uart_sunsu_port *up, unsigned char *status) | |||
376 | if (uart_handle_sysrq_char(&up->port, ch)) | 377 | if (uart_handle_sysrq_char(&up->port, ch)) |
377 | goto ignore_char; | 378 | goto ignore_char; |
378 | if ((*status & up->port.ignore_status_mask) == 0) | 379 | if ((*status & up->port.ignore_status_mask) == 0) |
379 | tty_insert_flip_char(tty, ch, flag); | 380 | tty_insert_flip_char(port, ch, flag); |
380 | if (*status & UART_LSR_OE) | 381 | if (*status & UART_LSR_OE) |
381 | /* | 382 | /* |
382 | * Overrun is special, since it's reported | 383 | * Overrun is special, since it's reported |
383 | * immediately, and doesn't affect the current | 384 | * immediately, and doesn't affect the current |
384 | * character. | 385 | * character. |
385 | */ | 386 | */ |
386 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 387 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
387 | ignore_char: | 388 | ignore_char: |
388 | *status = serial_inp(up, UART_LSR); | 389 | *status = serial_inp(up, UART_LSR); |
389 | } while ((*status & UART_LSR_DR) && (max_count-- > 0)); | 390 | } while ((*status & UART_LSR_DR) && (max_count-- > 0)); |
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index aef4fab957c3..4a11be3849f6 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -327,13 +327,15 @@ static struct tty_struct * | |||
327 | sunzilog_receive_chars(struct uart_sunzilog_port *up, | 327 | sunzilog_receive_chars(struct uart_sunzilog_port *up, |
328 | struct zilog_channel __iomem *channel) | 328 | struct zilog_channel __iomem *channel) |
329 | { | 329 | { |
330 | struct tty_port *port = NULL; | ||
330 | struct tty_struct *tty; | 331 | struct tty_struct *tty; |
331 | unsigned char ch, r1, flag; | 332 | unsigned char ch, r1, flag; |
332 | 333 | ||
333 | tty = NULL; | 334 | tty = NULL; |
334 | if (up->port.state != NULL && /* Unopened serial console */ | 335 | if (up->port.state != NULL) { /* Unopened serial console */ |
335 | up->port.state->port.tty != NULL) /* Keyboard || mouse */ | 336 | port = &up->port.state->port; |
336 | tty = up->port.state->port.tty; | 337 | tty = port->tty; /* mouse => tty is NULL */ |
338 | } | ||
337 | 339 | ||
338 | for (;;) { | 340 | for (;;) { |
339 | 341 | ||
@@ -366,11 +368,6 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
366 | continue; | 368 | continue; |
367 | } | 369 | } |
368 | 370 | ||
369 | if (tty == NULL) { | ||
370 | uart_handle_sysrq_char(&up->port, ch); | ||
371 | continue; | ||
372 | } | ||
373 | |||
374 | /* A real serial line, record the character and status. */ | 371 | /* A real serial line, record the character and status. */ |
375 | flag = TTY_NORMAL; | 372 | flag = TTY_NORMAL; |
376 | up->port.icount.rx++; | 373 | up->port.icount.rx++; |
@@ -400,10 +397,10 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
400 | 397 | ||
401 | if (up->port.ignore_status_mask == 0xff || | 398 | if (up->port.ignore_status_mask == 0xff || |
402 | (r1 & up->port.ignore_status_mask) == 0) { | 399 | (r1 & up->port.ignore_status_mask) == 0) { |
403 | tty_insert_flip_char(tty, ch, flag); | 400 | tty_insert_flip_char(port, ch, flag); |
404 | } | 401 | } |
405 | if (r1 & Rx_OVR) | 402 | if (r1 & Rx_OVR) |
406 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 403 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
407 | } | 404 | } |
408 | 405 | ||
409 | return tty; | 406 | return tty; |
diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c index 5be0d68feceb..f40c634f7528 100644 --- a/drivers/tty/serial/timbuart.c +++ b/drivers/tty/serial/timbuart.c | |||
@@ -91,12 +91,12 @@ static void timbuart_flush_buffer(struct uart_port *port) | |||
91 | 91 | ||
92 | static void timbuart_rx_chars(struct uart_port *port) | 92 | static void timbuart_rx_chars(struct uart_port *port) |
93 | { | 93 | { |
94 | struct tty_struct *tty = port->state->port.tty; | 94 | struct tty_port *tport = &port->state->port; |
95 | 95 | ||
96 | while (ioread32(port->membase + TIMBUART_ISR) & RXDP) { | 96 | while (ioread32(port->membase + TIMBUART_ISR) & RXDP) { |
97 | u8 ch = ioread8(port->membase + TIMBUART_RXFIFO); | 97 | u8 ch = ioread8(port->membase + TIMBUART_RXFIFO); |
98 | port->icount.rx++; | 98 | port->icount.rx++; |
99 | tty_insert_flip_char(tty, ch, TTY_NORMAL); | 99 | tty_insert_flip_char(tport, ch, TTY_NORMAL); |
100 | } | 100 | } |
101 | 101 | ||
102 | spin_unlock(&port->lock); | 102 | spin_unlock(&port->lock); |
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index 89eee43c4e2d..5caf1f0ebc82 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c | |||
@@ -66,7 +66,7 @@ static struct uart_port ulite_ports[ULITE_NR_UARTS]; | |||
66 | 66 | ||
67 | static int ulite_receive(struct uart_port *port, int stat) | 67 | static int ulite_receive(struct uart_port *port, int stat) |
68 | { | 68 | { |
69 | struct tty_struct *tty = port->state->port.tty; | 69 | struct tty_port *tport = &port->state->port; |
70 | unsigned char ch = 0; | 70 | unsigned char ch = 0; |
71 | char flag = TTY_NORMAL; | 71 | char flag = TTY_NORMAL; |
72 | 72 | ||
@@ -103,13 +103,13 @@ static int ulite_receive(struct uart_port *port, int stat) | |||
103 | stat &= ~port->ignore_status_mask; | 103 | stat &= ~port->ignore_status_mask; |
104 | 104 | ||
105 | if (stat & ULITE_STATUS_RXVALID) | 105 | if (stat & ULITE_STATUS_RXVALID) |
106 | tty_insert_flip_char(tty, ch, flag); | 106 | tty_insert_flip_char(tport, ch, flag); |
107 | 107 | ||
108 | if (stat & ULITE_STATUS_FRAME) | 108 | if (stat & ULITE_STATUS_FRAME) |
109 | tty_insert_flip_char(tty, 0, TTY_FRAME); | 109 | tty_insert_flip_char(tport, 0, TTY_FRAME); |
110 | 110 | ||
111 | if (stat & ULITE_STATUS_OVERRUN) | 111 | if (stat & ULITE_STATUS_OVERRUN) |
112 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 112 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
113 | 113 | ||
114 | return 1; | 114 | return 1; |
115 | } | 115 | } |
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index ed047d9ab1e2..7a2378627fa5 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c | |||
@@ -513,7 +513,7 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port) | |||
513 | continue; | 513 | continue; |
514 | 514 | ||
515 | error_return: | 515 | error_return: |
516 | tty_insert_flip_char(tty, ch, flg); | 516 | tty_insert_flip_char(tport, ch, flg); |
517 | 517 | ||
518 | } | 518 | } |
519 | 519 | ||
@@ -561,7 +561,7 @@ handle_error: | |||
561 | 561 | ||
562 | /* Overrun does not affect the current character ! */ | 562 | /* Overrun does not affect the current character ! */ |
563 | if (status & BD_SC_OV) | 563 | if (status & BD_SC_OV) |
564 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 564 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
565 | #ifdef SUPPORT_SYSRQ | 565 | #ifdef SUPPORT_SYSRQ |
566 | port->sysrq = 0; | 566 | port->sysrq = 0; |
567 | #endif | 567 | #endif |
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index 8fd181436a6b..7f4112423f3d 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c | |||
@@ -136,7 +136,8 @@ static void vt8500_enable_ms(struct uart_port *port) | |||
136 | 136 | ||
137 | static void handle_rx(struct uart_port *port) | 137 | static void handle_rx(struct uart_port *port) |
138 | { | 138 | { |
139 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | 139 | struct tty_port *tport = &port->state->port; |
140 | struct tty_struct *tty = tty_port_tty_get(tport); | ||
140 | if (!tty) { | 141 | if (!tty) { |
141 | /* Discard data: no tty available */ | 142 | /* Discard data: no tty available */ |
142 | int count = (vt8500_read(port, VT8500_URFIDX) & 0x1f00) >> 8; | 143 | int count = (vt8500_read(port, VT8500_URFIDX) & 0x1f00) >> 8; |
@@ -151,7 +152,7 @@ static void handle_rx(struct uart_port *port) | |||
151 | */ | 152 | */ |
152 | if ((vt8500_read(port, VT8500_URISR) & RXOVER)) { | 153 | if ((vt8500_read(port, VT8500_URISR) & RXOVER)) { |
153 | port->icount.overrun++; | 154 | port->icount.overrun++; |
154 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 155 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
155 | } | 156 | } |
156 | 157 | ||
157 | /* and now the main RX loop */ | 158 | /* and now the main RX loop */ |
@@ -174,7 +175,7 @@ static void handle_rx(struct uart_port *port) | |||
174 | port->icount.rx++; | 175 | port->icount.rx++; |
175 | 176 | ||
176 | if (!uart_handle_sysrq_char(port, c)) | 177 | if (!uart_handle_sysrq_char(port, c)) |
177 | tty_insert_flip_char(tty, c, flag); | 178 | tty_insert_flip_char(tport, c, flag); |
178 | } | 179 | } |
179 | 180 | ||
180 | tty_flip_buffer_push(tty); | 181 | tty_flip_buffer_push(tty); |