aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mn10300/kernel/asm-offsets.c6
-rw-r--r--drivers/serial/21285.c8
-rw-r--r--drivers/serial/8250.c10
-rw-r--r--drivers/serial/amba-pl010.c6
-rw-r--r--drivers/serial/amba-pl011.c6
-rw-r--r--drivers/serial/atmel_serial.c14
-rw-r--r--drivers/serial/bfin_5xx.c20
-rw-r--r--drivers/serial/bfin_sport_uart.c6
-rw-r--r--drivers/serial/clps711x.c4
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c2
-rw-r--r--drivers/serial/dz.c6
-rw-r--r--drivers/serial/icom.c16
-rw-r--r--drivers/serial/imx.c16
-rw-r--r--drivers/serial/ioc3_serial.c52
-rw-r--r--drivers/serial/ioc4_serial.c66
-rw-r--r--drivers/serial/ip22zilog.c14
-rw-r--r--drivers/serial/jsm/jsm_neo.c2
-rw-r--r--drivers/serial/jsm/jsm_tty.c20
-rw-r--r--drivers/serial/m32r_sio.c6
-rw-r--r--drivers/serial/max3100.c16
-rw-r--r--drivers/serial/mcf.c4
-rw-r--r--drivers/serial/mpc52xx_uart.c4
-rw-r--r--drivers/serial/mpsc.c4
-rw-r--r--drivers/serial/msm_serial.c6
-rw-r--r--drivers/serial/mux.c4
-rw-r--r--drivers/serial/netx-serial.c6
-rw-r--r--drivers/serial/nwpserial.c4
-rw-r--r--drivers/serial/pmac_zilog.c12
-rw-r--r--drivers/serial/pnx8xxx_uart.c8
-rw-r--r--drivers/serial/pxa.c6
-rw-r--r--drivers/serial/sa1100.c8
-rw-r--r--drivers/serial/samsung.c8
-rw-r--r--drivers/serial/sb1250-duart.c6
-rw-r--r--drivers/serial/sc26xx.c10
-rw-r--r--drivers/serial/serial_core.c286
-rw-r--r--drivers/serial/serial_ks8695.c6
-rw-r--r--drivers/serial/serial_lh7a40x.c6
-rw-r--r--drivers/serial/serial_txx9.c4
-rw-r--r--drivers/serial/sh-sci.c10
-rw-r--r--drivers/serial/sn_console.c22
-rw-r--r--drivers/serial/sunhv.c8
-rw-r--r--drivers/serial/sunsab.c10
-rw-r--r--drivers/serial/sunsu.c6
-rw-r--r--drivers/serial/sunzilog.c14
-rw-r--r--drivers/serial/timbuart.c10
-rw-r--r--drivers/serial/uartlite.c6
-rw-r--r--drivers/serial/ucc_uart.c4
-rw-r--r--drivers/serial/vr41xx_siu.c6
-rw-r--r--drivers/serial/zs.c6
-rw-r--r--include/linux/serial_core.h64
50 files changed, 422 insertions, 432 deletions
diff --git a/arch/mn10300/kernel/asm-offsets.c b/arch/mn10300/kernel/asm-offsets.c
index 2646fcbd7d89..82b40079ad76 100644
--- a/arch/mn10300/kernel/asm-offsets.c
+++ b/arch/mn10300/kernel/asm-offsets.c
@@ -95,7 +95,7 @@ void foo(void)
95 OFFSET(__iobase, mn10300_serial_port, _iobase); 95 OFFSET(__iobase, mn10300_serial_port, _iobase);
96 96
97 DEFINE(__UART_XMIT_SIZE, UART_XMIT_SIZE); 97 DEFINE(__UART_XMIT_SIZE, UART_XMIT_SIZE);
98 OFFSET(__xmit_buffer, uart_info, xmit.buf); 98 OFFSET(__xmit_buffer, uart_state, xmit.buf);
99 OFFSET(__xmit_head, uart_info, xmit.head); 99 OFFSET(__xmit_head, uart_state, xmit.head);
100 OFFSET(__xmit_tail, uart_info, xmit.tail); 100 OFFSET(__xmit_tail, uart_state, xmit.tail);
101} 101}
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index cb6d85d7ff43..1e3d19397a59 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -86,7 +86,7 @@ static void serial21285_enable_ms(struct uart_port *port)
86static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) 86static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
87{ 87{
88 struct uart_port *port = dev_id; 88 struct uart_port *port = dev_id;
89 struct tty_struct *tty = port->info->port.tty; 89 struct tty_struct *tty = port->state->port.tty;
90 unsigned int status, ch, flag, rxs, max_count = 256; 90 unsigned int status, ch, flag, rxs, max_count = 256;
91 91
92 status = *CSR_UARTFLG; 92 status = *CSR_UARTFLG;
@@ -124,7 +124,7 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
124static irqreturn_t serial21285_tx_chars(int irq, void *dev_id) 124static irqreturn_t serial21285_tx_chars(int irq, void *dev_id)
125{ 125{
126 struct uart_port *port = dev_id; 126 struct uart_port *port = dev_id;
127 struct circ_buf *xmit = &port->info->xmit; 127 struct circ_buf *xmit = &port->state->xmit;
128 int count = 256; 128 int count = 256;
129 129
130 if (port->x_char) { 130 if (port->x_char) {
@@ -235,8 +235,8 @@ serial21285_set_termios(struct uart_port *port, struct ktermios *termios,
235 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 235 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
236 quot = uart_get_divisor(port, baud); 236 quot = uart_get_divisor(port, baud);
237 237
238 if (port->info && port->info->port.tty) { 238 if (port->state && port->state->port.tty) {
239 struct tty_struct *tty = port->info->port.tty; 239 struct tty_struct *tty = port->state->port.tty;
240 unsigned int b = port->uartclk / (16 * quot); 240 unsigned int b = port->uartclk / (16 * quot);
241 tty_encode_baud_rate(tty, b, b); 241 tty_encode_baud_rate(tty, b, b);
242 } 242 }
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 1fd4894d9b51..e415c5eca599 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1382,7 +1382,7 @@ static void serial8250_enable_ms(struct uart_port *port)
1382static void 1382static void
1383receive_chars(struct uart_8250_port *up, unsigned int *status) 1383receive_chars(struct uart_8250_port *up, unsigned int *status)
1384{ 1384{
1385 struct tty_struct *tty = up->port.info->port.tty; 1385 struct tty_struct *tty = up->port.state->port.tty;
1386 unsigned char ch, lsr = *status; 1386 unsigned char ch, lsr = *status;
1387 int max_count = 256; 1387 int max_count = 256;
1388 char flag; 1388 char flag;
@@ -1457,7 +1457,7 @@ ignore_char:
1457 1457
1458static void transmit_chars(struct uart_8250_port *up) 1458static void transmit_chars(struct uart_8250_port *up)
1459{ 1459{
1460 struct circ_buf *xmit = &up->port.info->xmit; 1460 struct circ_buf *xmit = &up->port.state->xmit;
1461 int count; 1461 int count;
1462 1462
1463 if (up->port.x_char) { 1463 if (up->port.x_char) {
@@ -1500,7 +1500,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
1500 status |= up->msr_saved_flags; 1500 status |= up->msr_saved_flags;
1501 up->msr_saved_flags = 0; 1501 up->msr_saved_flags = 0;
1502 if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI && 1502 if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI &&
1503 up->port.info != NULL) { 1503 up->port.state != NULL) {
1504 if (status & UART_MSR_TERI) 1504 if (status & UART_MSR_TERI)
1505 up->port.icount.rng++; 1505 up->port.icount.rng++;
1506 if (status & UART_MSR_DDSR) 1506 if (status & UART_MSR_DDSR)
@@ -1510,7 +1510,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
1510 if (status & UART_MSR_DCTS) 1510 if (status & UART_MSR_DCTS)
1511 uart_handle_cts_change(&up->port, status & UART_MSR_CTS); 1511 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
1512 1512
1513 wake_up_interruptible(&up->port.info->delta_msr_wait); 1513 wake_up_interruptible(&up->port.state->delta_msr_wait);
1514 } 1514 }
1515 1515
1516 return status; 1516 return status;
@@ -1764,7 +1764,7 @@ static void serial8250_backup_timeout(unsigned long data)
1764 up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; 1764 up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
1765 spin_unlock_irqrestore(&up->port.lock, flags); 1765 spin_unlock_irqrestore(&up->port.lock, flags);
1766 if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) && 1766 if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) &&
1767 (!uart_circ_empty(&up->port.info->xmit) || up->port.x_char) && 1767 (!uart_circ_empty(&up->port.state->xmit) || up->port.x_char) &&
1768 (lsr & UART_LSR_THRE)) { 1768 (lsr & UART_LSR_THRE)) {
1769 iir &= ~(UART_IIR_ID | UART_IIR_NO_INT); 1769 iir &= ~(UART_IIR_ID | UART_IIR_NO_INT);
1770 iir |= UART_IIR_THRI; 1770 iir |= UART_IIR_THRI;
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 58a4879c7e48..39032413d4a1 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -117,7 +117,7 @@ static void pl010_enable_ms(struct uart_port *port)
117 117
118static void pl010_rx_chars(struct uart_amba_port *uap) 118static void pl010_rx_chars(struct uart_amba_port *uap)
119{ 119{
120 struct tty_struct *tty = uap->port.info->port.tty; 120 struct tty_struct *tty = uap->port.state->port.tty;
121 unsigned int status, ch, flag, rsr, max_count = 256; 121 unsigned int status, ch, flag, rsr, max_count = 256;
122 122
123 status = readb(uap->port.membase + UART01x_FR); 123 status = readb(uap->port.membase + UART01x_FR);
@@ -172,7 +172,7 @@ static void pl010_rx_chars(struct uart_amba_port *uap)
172 172
173static void pl010_tx_chars(struct uart_amba_port *uap) 173static void pl010_tx_chars(struct uart_amba_port *uap)
174{ 174{
175 struct circ_buf *xmit = &uap->port.info->xmit; 175 struct circ_buf *xmit = &uap->port.state->xmit;
176 int count; 176 int count;
177 177
178 if (uap->port.x_char) { 178 if (uap->port.x_char) {
@@ -225,7 +225,7 @@ static void pl010_modem_status(struct uart_amba_port *uap)
225 if (delta & UART01x_FR_CTS) 225 if (delta & UART01x_FR_CTS)
226 uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS); 226 uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
227 227
228 wake_up_interruptible(&uap->port.info->delta_msr_wait); 228 wake_up_interruptible(&uap->port.state->delta_msr_wait);
229} 229}
230 230
231static irqreturn_t pl010_int(int irq, void *dev_id) 231static irqreturn_t pl010_int(int irq, void *dev_id)
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 72ba0c6d3551..ef82a34baf0f 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -124,7 +124,7 @@ static void pl011_enable_ms(struct uart_port *port)
124 124
125static void pl011_rx_chars(struct uart_amba_port *uap) 125static void pl011_rx_chars(struct uart_amba_port *uap)
126{ 126{
127 struct tty_struct *tty = uap->port.info->port.tty; 127 struct tty_struct *tty = uap->port.state->port.tty;
128 unsigned int status, ch, flag, max_count = 256; 128 unsigned int status, ch, flag, max_count = 256;
129 129
130 status = readw(uap->port.membase + UART01x_FR); 130 status = readw(uap->port.membase + UART01x_FR);
@@ -175,7 +175,7 @@ static void pl011_rx_chars(struct uart_amba_port *uap)
175 175
176static void pl011_tx_chars(struct uart_amba_port *uap) 176static void pl011_tx_chars(struct uart_amba_port *uap)
177{ 177{
178 struct circ_buf *xmit = &uap->port.info->xmit; 178 struct circ_buf *xmit = &uap->port.state->xmit;
179 int count; 179 int count;
180 180
181 if (uap->port.x_char) { 181 if (uap->port.x_char) {
@@ -226,7 +226,7 @@ static void pl011_modem_status(struct uart_amba_port *uap)
226 if (delta & UART01x_FR_CTS) 226 if (delta & UART01x_FR_CTS)
227 uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS); 227 uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
228 228
229 wake_up_interruptible(&uap->port.info->delta_msr_wait); 229 wake_up_interruptible(&uap->port.state->delta_msr_wait);
230} 230}
231 231
232static irqreturn_t pl011_int(int irq, void *dev_id) 232static irqreturn_t pl011_int(int irq, void *dev_id)
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 607d43a31048..963e3c12af41 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -427,7 +427,7 @@ static void atmel_rx_chars(struct uart_port *port)
427 */ 427 */
428static void atmel_tx_chars(struct uart_port *port) 428static void atmel_tx_chars(struct uart_port *port)
429{ 429{
430 struct circ_buf *xmit = &port->info->xmit; 430 struct circ_buf *xmit = &port->state->xmit;
431 431
432 if (port->x_char && UART_GET_CSR(port) & ATMEL_US_TXRDY) { 432 if (port->x_char && UART_GET_CSR(port) & ATMEL_US_TXRDY) {
433 UART_PUT_CHAR(port, port->x_char); 433 UART_PUT_CHAR(port, port->x_char);
@@ -560,7 +560,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id)
560static void atmel_tx_dma(struct uart_port *port) 560static void atmel_tx_dma(struct uart_port *port)
561{ 561{
562 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 562 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
563 struct circ_buf *xmit = &port->info->xmit; 563 struct circ_buf *xmit = &port->state->xmit;
564 struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx; 564 struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
565 int count; 565 int count;
566 566
@@ -663,14 +663,14 @@ static void atmel_rx_from_ring(struct uart_port *port)
663 * uart_start(), which takes the lock. 663 * uart_start(), which takes the lock.
664 */ 664 */
665 spin_unlock(&port->lock); 665 spin_unlock(&port->lock);
666 tty_flip_buffer_push(port->info->port.tty); 666 tty_flip_buffer_push(port->state->port.tty);
667 spin_lock(&port->lock); 667 spin_lock(&port->lock);
668} 668}
669 669
670static void atmel_rx_from_dma(struct uart_port *port) 670static void atmel_rx_from_dma(struct uart_port *port)
671{ 671{
672 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 672 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
673 struct tty_struct *tty = port->info->port.tty; 673 struct tty_struct *tty = port->state->port.tty;
674 struct atmel_dma_buffer *pdc; 674 struct atmel_dma_buffer *pdc;
675 int rx_idx = atmel_port->pdc_rx_idx; 675 int rx_idx = atmel_port->pdc_rx_idx;
676 unsigned int head; 676 unsigned int head;
@@ -776,7 +776,7 @@ static void atmel_tasklet_func(unsigned long data)
776 if (status_change & ATMEL_US_CTS) 776 if (status_change & ATMEL_US_CTS)
777 uart_handle_cts_change(port, !(status & ATMEL_US_CTS)); 777 uart_handle_cts_change(port, !(status & ATMEL_US_CTS));
778 778
779 wake_up_interruptible(&port->info->delta_msr_wait); 779 wake_up_interruptible(&port->state->delta_msr_wait);
780 780
781 atmel_port->irq_status_prev = status; 781 atmel_port->irq_status_prev = status;
782 } 782 }
@@ -795,7 +795,7 @@ static void atmel_tasklet_func(unsigned long data)
795static int atmel_startup(struct uart_port *port) 795static int atmel_startup(struct uart_port *port)
796{ 796{
797 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 797 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
798 struct tty_struct *tty = port->info->port.tty; 798 struct tty_struct *tty = port->state->port.tty;
799 int retval; 799 int retval;
800 800
801 /* 801 /*
@@ -854,7 +854,7 @@ static int atmel_startup(struct uart_port *port)
854 } 854 }
855 if (atmel_use_dma_tx(port)) { 855 if (atmel_use_dma_tx(port)) {
856 struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx; 856 struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
857 struct circ_buf *xmit = &port->info->xmit; 857 struct circ_buf *xmit = &port->state->xmit;
858 858
859 pdc->buf = xmit->buf; 859 pdc->buf = xmit->buf;
860 pdc->dma_addr = dma_map_single(port->dev, 860 pdc->dma_addr = dma_map_single(port->dev,
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 4fff4e524034..50abb7e557f4 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -144,7 +144,7 @@ static void bfin_serial_stop_tx(struct uart_port *port)
144{ 144{
145 struct bfin_serial_port *uart = (struct bfin_serial_port *)port; 145 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
146#ifdef CONFIG_SERIAL_BFIN_DMA 146#ifdef CONFIG_SERIAL_BFIN_DMA
147 struct circ_buf *xmit = &uart->port.info->xmit; 147 struct circ_buf *xmit = &uart->port.state->xmit;
148#endif 148#endif
149 149
150 while (!(UART_GET_LSR(uart) & TEMT)) 150 while (!(UART_GET_LSR(uart) & TEMT))
@@ -171,7 +171,7 @@ static void bfin_serial_stop_tx(struct uart_port *port)
171static void bfin_serial_start_tx(struct uart_port *port) 171static void bfin_serial_start_tx(struct uart_port *port)
172{ 172{
173 struct bfin_serial_port *uart = (struct bfin_serial_port *)port; 173 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
174 struct tty_struct *tty = uart->port.info->port.tty; 174 struct tty_struct *tty = uart->port.state->port.tty;
175 175
176#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS 176#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
177 if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) { 177 if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) {
@@ -243,10 +243,10 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
243 return; 243 return;
244 } 244 }
245 245
246 if (!uart->port.info || !uart->port.info->port.tty) 246 if (!uart->port.state || !uart->port.state->port.tty)
247 return; 247 return;
248#endif 248#endif
249 tty = uart->port.info->port.tty; 249 tty = uart->port.state->port.tty;
250 250
251 if (ANOMALY_05000363) { 251 if (ANOMALY_05000363) {
252 /* The BF533 (and BF561) family of processors have a nice anomaly 252 /* The BF533 (and BF561) family of processors have a nice anomaly
@@ -331,7 +331,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
331 331
332static void bfin_serial_tx_chars(struct bfin_serial_port *uart) 332static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
333{ 333{
334 struct circ_buf *xmit = &uart->port.info->xmit; 334 struct circ_buf *xmit = &uart->port.state->xmit;
335 335
336 if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) { 336 if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) {
337#ifdef CONFIG_BF54x 337#ifdef CONFIG_BF54x
@@ -398,7 +398,7 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id)
398#ifdef CONFIG_SERIAL_BFIN_DMA 398#ifdef CONFIG_SERIAL_BFIN_DMA
399static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) 399static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
400{ 400{
401 struct circ_buf *xmit = &uart->port.info->xmit; 401 struct circ_buf *xmit = &uart->port.state->xmit;
402 402
403 uart->tx_done = 0; 403 uart->tx_done = 0;
404 404
@@ -436,7 +436,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
436 436
437static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) 437static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
438{ 438{
439 struct tty_struct *tty = uart->port.info->port.tty; 439 struct tty_struct *tty = uart->port.state->port.tty;
440 int i, flg, status; 440 int i, flg, status;
441 441
442 status = UART_GET_LSR(uart); 442 status = UART_GET_LSR(uart);
@@ -529,7 +529,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
529static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) 529static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
530{ 530{
531 struct bfin_serial_port *uart = dev_id; 531 struct bfin_serial_port *uart = dev_id;
532 struct circ_buf *xmit = &uart->port.info->xmit; 532 struct circ_buf *xmit = &uart->port.state->xmit;
533 533
534#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS 534#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
535 if (uart->scts && !(bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { 535 if (uart->scts && !(bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
@@ -965,10 +965,10 @@ static void bfin_serial_set_ldisc(struct uart_port *port)
965 int line = port->line; 965 int line = port->line;
966 unsigned short val; 966 unsigned short val;
967 967
968 if (line >= port->info->port.tty->driver->num) 968 if (line >= port->state->port.tty->driver->num)
969 return; 969 return;
970 970
971 switch (port->info->port.tty->termios->c_line) { 971 switch (port->state->port.tty->termios->c_line) {
972 case N_IRDA: 972 case N_IRDA:
973 val = UART_GET_GCTL(&bfin_serial_ports[line]); 973 val = UART_GET_GCTL(&bfin_serial_ports[line]);
974 val |= (IREN | RPOLC); 974 val |= (IREN | RPOLC);
diff --git a/drivers/serial/bfin_sport_uart.c b/drivers/serial/bfin_sport_uart.c
index c108b1a0ce98..088bb35475f1 100644
--- a/drivers/serial/bfin_sport_uart.c
+++ b/drivers/serial/bfin_sport_uart.c
@@ -178,7 +178,7 @@ static int sport_uart_setup(struct sport_uart_port *up, int sclk, int baud_rate)
178static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) 178static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id)
179{ 179{
180 struct sport_uart_port *up = dev_id; 180 struct sport_uart_port *up = dev_id;
181 struct tty_struct *tty = up->port.info->port.tty; 181 struct tty_struct *tty = up->port.state->port.tty;
182 unsigned int ch; 182 unsigned int ch;
183 183
184 do { 184 do {
@@ -205,7 +205,7 @@ static irqreturn_t sport_uart_tx_irq(int irq, void *dev_id)
205static irqreturn_t sport_uart_err_irq(int irq, void *dev_id) 205static irqreturn_t sport_uart_err_irq(int irq, void *dev_id)
206{ 206{
207 struct sport_uart_port *up = dev_id; 207 struct sport_uart_port *up = dev_id;
208 struct tty_struct *tty = up->port.info->port.tty; 208 struct tty_struct *tty = up->port.state->port.tty;
209 unsigned int stat = SPORT_GET_STAT(up); 209 unsigned int stat = SPORT_GET_STAT(up);
210 210
211 /* Overflow in RX FIFO */ 211 /* Overflow in RX FIFO */
@@ -290,7 +290,7 @@ fail1:
290 290
291static void sport_uart_tx_chars(struct sport_uart_port *up) 291static void sport_uart_tx_chars(struct sport_uart_port *up)
292{ 292{
293 struct circ_buf *xmit = &up->port.info->xmit; 293 struct circ_buf *xmit = &up->port.state->xmit;
294 294
295 if (SPORT_GET_STAT(up) & TXF) 295 if (SPORT_GET_STAT(up) & TXF)
296 return; 296 return;
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c
index 80e76426131d..b6acd19b458e 100644
--- a/drivers/serial/clps711x.c
+++ b/drivers/serial/clps711x.c
@@ -93,7 +93,7 @@ static void clps711xuart_enable_ms(struct uart_port *port)
93static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id) 93static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id)
94{ 94{
95 struct uart_port *port = dev_id; 95 struct uart_port *port = dev_id;
96 struct tty_struct *tty = port->info->port.tty; 96 struct tty_struct *tty = port->state->port.tty;
97 unsigned int status, ch, flg; 97 unsigned int status, ch, flg;
98 98
99 status = clps_readl(SYSFLG(port)); 99 status = clps_readl(SYSFLG(port));
@@ -147,7 +147,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id)
147static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) 147static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
148{ 148{
149 struct uart_port *port = dev_id; 149 struct uart_port *port = dev_id;
150 struct circ_buf *xmit = &port->info->xmit; 150 struct circ_buf *xmit = &port->state->xmit;
151 int count; 151 int count;
152 152
153 if (port->x_char) { 153 if (port->x_char) {
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index f8df0681e160..8d349b23249a 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -244,7 +244,7 @@ static void cpm_uart_int_rx(struct uart_port *port)
244 int i; 244 int i;
245 unsigned char ch; 245 unsigned char ch;
246 u8 *cp; 246 u8 *cp;
247 struct tty_struct *tty = port->info->port.tty; 247 struct tty_struct *tty = port->state->port.tty;
248 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; 248 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
249 cbd_t __iomem *bdp; 249 cbd_t __iomem *bdp;
250 u16 status; 250 u16 status;
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
index 6042b87797a1..57421d776329 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -197,7 +197,7 @@ static inline void dz_receive_chars(struct dz_mux *mux)
197 while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) { 197 while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) {
198 dport = &mux->dport[LINE(status)]; 198 dport = &mux->dport[LINE(status)];
199 uport = &dport->port; 199 uport = &dport->port;
200 tty = uport->info->port.tty; /* point to the proper dev */ 200 tty = uport->state->port.tty; /* point to the proper dev */
201 201
202 ch = UCHAR(status); /* grab the char */ 202 ch = UCHAR(status); /* grab the char */
203 flag = TTY_NORMAL; 203 flag = TTY_NORMAL;
@@ -249,7 +249,7 @@ static inline void dz_receive_chars(struct dz_mux *mux)
249 } 249 }
250 for (i = 0; i < DZ_NB_PORT; i++) 250 for (i = 0; i < DZ_NB_PORT; i++)
251 if (lines_rx[i]) 251 if (lines_rx[i])
252 tty_flip_buffer_push(mux->dport[i].port.info->port.tty); 252 tty_flip_buffer_push(mux->dport[i].port.state->port.tty);
253} 253}
254 254
255/* 255/*
@@ -268,7 +268,7 @@ static inline void dz_transmit_chars(struct dz_mux *mux)
268 268
269 status = dz_in(dport, DZ_CSR); 269 status = dz_in(dport, DZ_CSR);
270 dport = &mux->dport[LINE(status)]; 270 dport = &mux->dport[LINE(status)];
271 xmit = &dport->port.info->xmit; 271 xmit = &dport->port.state->xmit;
272 272
273 if (dport->port.x_char) { /* XON/XOFF chars */ 273 if (dport->port.x_char) { /* XON/XOFF chars */
274 dz_out(dport, DZ_TDR, dport->port.x_char); 274 dz_out(dport, DZ_TDR, dport->port.x_char);
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c
index 060f4e3d54c5..f86c47e08a06 100644
--- a/drivers/serial/icom.c
+++ b/drivers/serial/icom.c
@@ -627,7 +627,7 @@ static int icom_write(struct uart_port *port)
627 unsigned long data_count; 627 unsigned long data_count;
628 unsigned char cmdReg; 628 unsigned char cmdReg;
629 unsigned long offset; 629 unsigned long offset;
630 int temp_tail = port->info->xmit.tail; 630 int temp_tail = port->state->xmit.tail;
631 631
632 trace(ICOM_PORT, "WRITE", 0); 632 trace(ICOM_PORT, "WRITE", 0);
633 633
@@ -638,11 +638,11 @@ static int icom_write(struct uart_port *port)
638 } 638 }
639 639
640 data_count = 0; 640 data_count = 0;
641 while ((port->info->xmit.head != temp_tail) && 641 while ((port->state->xmit.head != temp_tail) &&
642 (data_count <= XMIT_BUFF_SZ)) { 642 (data_count <= XMIT_BUFF_SZ)) {
643 643
644 ICOM_PORT->xmit_buf[data_count++] = 644 ICOM_PORT->xmit_buf[data_count++] =
645 port->info->xmit.buf[temp_tail]; 645 port->state->xmit.buf[temp_tail];
646 646
647 temp_tail++; 647 temp_tail++;
648 temp_tail &= (UART_XMIT_SIZE - 1); 648 temp_tail &= (UART_XMIT_SIZE - 1);
@@ -694,7 +694,7 @@ static inline void check_modem_status(struct icom_port *icom_port)
694 uart_handle_cts_change(&icom_port->uart_port, 694 uart_handle_cts_change(&icom_port->uart_port,
695 delta_status & ICOM_CTS); 695 delta_status & ICOM_CTS);
696 696
697 wake_up_interruptible(&icom_port->uart_port.info-> 697 wake_up_interruptible(&icom_port->uart_port.state->
698 delta_msr_wait); 698 delta_msr_wait);
699 old_status = status; 699 old_status = status;
700 } 700 }
@@ -718,10 +718,10 @@ static void xmit_interrupt(u16 port_int_reg, struct icom_port *icom_port)
718 icom_port->uart_port.icount.tx += count; 718 icom_port->uart_port.icount.tx += count;
719 719
720 for (i=0; i<count && 720 for (i=0; i<count &&
721 !uart_circ_empty(&icom_port->uart_port.info->xmit); i++) { 721 !uart_circ_empty(&icom_port->uart_port.state->xmit); i++) {
722 722
723 icom_port->uart_port.info->xmit.tail++; 723 icom_port->uart_port.state->xmit.tail++;
724 icom_port->uart_port.info->xmit.tail &= 724 icom_port->uart_port.state->xmit.tail &=
725 (UART_XMIT_SIZE - 1); 725 (UART_XMIT_SIZE - 1);
726 } 726 }
727 727
@@ -735,7 +735,7 @@ static void xmit_interrupt(u16 port_int_reg, struct icom_port *icom_port)
735static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) 735static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port)
736{ 736{
737 short int count, rcv_buff; 737 short int count, rcv_buff;
738 struct tty_struct *tty = icom_port->uart_port.info->port.tty; 738 struct tty_struct *tty = icom_port->uart_port.state->port.tty;
739 unsigned short int status; 739 unsigned short int status;
740 struct uart_icount *icount; 740 struct uart_icount *icount;
741 unsigned long offset; 741 unsigned long offset;
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 7485afd0df4c..1febeafcb97a 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -224,7 +224,7 @@ static void imx_mctrl_check(struct imx_port *sport)
224 if (changed & TIOCM_CTS) 224 if (changed & TIOCM_CTS)
225 uart_handle_cts_change(&sport->port, status & TIOCM_CTS); 225 uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
226 226
227 wake_up_interruptible(&sport->port.info->delta_msr_wait); 227 wake_up_interruptible(&sport->port.state->delta_msr_wait);
228} 228}
229 229
230/* 230/*
@@ -236,7 +236,7 @@ static void imx_timeout(unsigned long data)
236 struct imx_port *sport = (struct imx_port *)data; 236 struct imx_port *sport = (struct imx_port *)data;
237 unsigned long flags; 237 unsigned long flags;
238 238
239 if (sport->port.info) { 239 if (sport->port.state) {
240 spin_lock_irqsave(&sport->port.lock, flags); 240 spin_lock_irqsave(&sport->port.lock, flags);
241 imx_mctrl_check(sport); 241 imx_mctrl_check(sport);
242 spin_unlock_irqrestore(&sport->port.lock, flags); 242 spin_unlock_irqrestore(&sport->port.lock, flags);
@@ -323,7 +323,7 @@ static void imx_enable_ms(struct uart_port *port)
323 323
324static inline void imx_transmit_buffer(struct imx_port *sport) 324static inline void imx_transmit_buffer(struct imx_port *sport)
325{ 325{
326 struct circ_buf *xmit = &sport->port.info->xmit; 326 struct circ_buf *xmit = &sport->port.state->xmit;
327 327
328 while (!(readl(sport->port.membase + UTS) & UTS_TXFULL)) { 328 while (!(readl(sport->port.membase + UTS) & UTS_TXFULL)) {
329 /* send xmit->buf[xmit->tail] 329 /* send xmit->buf[xmit->tail]
@@ -388,7 +388,7 @@ static irqreturn_t imx_rtsint(int irq, void *dev_id)
388 388
389 writel(USR1_RTSD, sport->port.membase + USR1); 389 writel(USR1_RTSD, sport->port.membase + USR1);
390 uart_handle_cts_change(&sport->port, !!val); 390 uart_handle_cts_change(&sport->port, !!val);
391 wake_up_interruptible(&sport->port.info->delta_msr_wait); 391 wake_up_interruptible(&sport->port.state->delta_msr_wait);
392 392
393 spin_unlock_irqrestore(&sport->port.lock, flags); 393 spin_unlock_irqrestore(&sport->port.lock, flags);
394 return IRQ_HANDLED; 394 return IRQ_HANDLED;
@@ -397,7 +397,7 @@ static irqreturn_t imx_rtsint(int irq, void *dev_id)
397static irqreturn_t imx_txint(int irq, void *dev_id) 397static irqreturn_t imx_txint(int irq, void *dev_id)
398{ 398{
399 struct imx_port *sport = dev_id; 399 struct imx_port *sport = dev_id;
400 struct circ_buf *xmit = &sport->port.info->xmit; 400 struct circ_buf *xmit = &sport->port.state->xmit;
401 unsigned long flags; 401 unsigned long flags;
402 402
403 spin_lock_irqsave(&sport->port.lock,flags); 403 spin_lock_irqsave(&sport->port.lock,flags);
@@ -427,7 +427,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
427{ 427{
428 struct imx_port *sport = dev_id; 428 struct imx_port *sport = dev_id;
429 unsigned int rx,flg,ignored = 0; 429 unsigned int rx,flg,ignored = 0;
430 struct tty_struct *tty = sport->port.info->port.tty; 430 struct tty_struct *tty = sport->port.state->port.tty;
431 unsigned long flags, temp; 431 unsigned long flags, temp;
432 432
433 spin_lock_irqsave(&sport->port.lock,flags); 433 spin_lock_irqsave(&sport->port.lock,flags);
@@ -900,11 +900,11 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
900 rational_best_approximation(16 * div * baud, sport->port.uartclk, 900 rational_best_approximation(16 * div * baud, sport->port.uartclk,
901 1 << 16, 1 << 16, &num, &denom); 901 1 << 16, 1 << 16, &num, &denom);
902 902
903 if (port->info && port->info->port.tty) { 903 if (port->state && port->state->port.tty) {
904 tdiv64 = sport->port.uartclk; 904 tdiv64 = sport->port.uartclk;
905 tdiv64 *= num; 905 tdiv64 *= num;
906 do_div(tdiv64, denom * 16 * div); 906 do_div(tdiv64, denom * 16 * div);
907 tty_encode_baud_rate(sport->port.info->port.tty, 907 tty_encode_baud_rate(sport->port.state->port.tty,
908 (speed_t)tdiv64, (speed_t)tdiv64); 908 (speed_t)tdiv64, (speed_t)tdiv64);
909 } 909 }
910 910
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
index ae3699d77dd0..de4ab1bfee8d 100644
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -897,25 +897,25 @@ static void transmit_chars(struct uart_port *the_port)
897 char *start; 897 char *start;
898 struct tty_struct *tty; 898 struct tty_struct *tty;
899 struct ioc3_port *port = get_ioc3_port(the_port); 899 struct ioc3_port *port = get_ioc3_port(the_port);
900 struct uart_info *info; 900 struct uart_state *state;
901 901
902 if (!the_port) 902 if (!the_port)
903 return; 903 return;
904 if (!port) 904 if (!port)
905 return; 905 return;
906 906
907 info = the_port->info; 907 state = the_port->state;
908 tty = info->port.tty; 908 tty = state->port.tty;
909 909
910 if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { 910 if (uart_circ_empty(&state->xmit) || uart_tx_stopped(the_port)) {
911 /* Nothing to do or hw stopped */ 911 /* Nothing to do or hw stopped */
912 set_notification(port, N_ALL_OUTPUT, 0); 912 set_notification(port, N_ALL_OUTPUT, 0);
913 return; 913 return;
914 } 914 }
915 915
916 head = info->xmit.head; 916 head = state->xmit.head;
917 tail = info->xmit.tail; 917 tail = state->xmit.tail;
918 start = (char *)&info->xmit.buf[tail]; 918 start = (char *)&state->xmit.buf[tail];
919 919
920 /* write out all the data or until the end of the buffer */ 920 /* write out all the data or until the end of the buffer */
921 xmit_count = (head < tail) ? (UART_XMIT_SIZE - tail) : (head - tail); 921 xmit_count = (head < tail) ? (UART_XMIT_SIZE - tail) : (head - tail);
@@ -928,14 +928,14 @@ static void transmit_chars(struct uart_port *the_port)
928 /* advance the pointers */ 928 /* advance the pointers */
929 tail += result; 929 tail += result;
930 tail &= UART_XMIT_SIZE - 1; 930 tail &= UART_XMIT_SIZE - 1;
931 info->xmit.tail = tail; 931 state->xmit.tail = tail;
932 start = (char *)&info->xmit.buf[tail]; 932 start = (char *)&state->xmit.buf[tail];
933 } 933 }
934 } 934 }
935 if (uart_circ_chars_pending(&info->xmit) < WAKEUP_CHARS) 935 if (uart_circ_chars_pending(&state->xmit) < WAKEUP_CHARS)
936 uart_write_wakeup(the_port); 936 uart_write_wakeup(the_port);
937 937
938 if (uart_circ_empty(&info->xmit)) { 938 if (uart_circ_empty(&state->xmit)) {
939 set_notification(port, N_OUTPUT_LOWAT, 0); 939 set_notification(port, N_OUTPUT_LOWAT, 0);
940 } else { 940 } else {
941 set_notification(port, N_OUTPUT_LOWAT, 1); 941 set_notification(port, N_OUTPUT_LOWAT, 1);
@@ -956,7 +956,7 @@ ioc3_change_speed(struct uart_port *the_port,
956 unsigned int cflag; 956 unsigned int cflag;
957 int baud; 957 int baud;
958 int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8; 958 int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8;
959 struct uart_info *info = the_port->info; 959 struct uart_state *state = the_port->state;
960 960
961 cflag = new_termios->c_cflag; 961 cflag = new_termios->c_cflag;
962 962
@@ -997,14 +997,14 @@ ioc3_change_speed(struct uart_port *the_port,
997 997
998 the_port->ignore_status_mask = N_ALL_INPUT; 998 the_port->ignore_status_mask = N_ALL_INPUT;
999 999
1000 info->port.tty->low_latency = 1; 1000 state->port.tty->low_latency = 1;
1001 1001
1002 if (I_IGNPAR(info->port.tty)) 1002 if (I_IGNPAR(state->port.tty))
1003 the_port->ignore_status_mask &= ~(N_PARITY_ERROR 1003 the_port->ignore_status_mask &= ~(N_PARITY_ERROR
1004 | N_FRAMING_ERROR); 1004 | N_FRAMING_ERROR);
1005 if (I_IGNBRK(info->port.tty)) { 1005 if (I_IGNBRK(state->port.tty)) {
1006 the_port->ignore_status_mask &= ~N_BREAK; 1006 the_port->ignore_status_mask &= ~N_BREAK;
1007 if (I_IGNPAR(info->port.tty)) 1007 if (I_IGNPAR(state->port.tty))
1008 the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; 1008 the_port->ignore_status_mask &= ~N_OVERRUN_ERROR;
1009 } 1009 }
1010 if (!(cflag & CREAD)) { 1010 if (!(cflag & CREAD)) {
@@ -1286,7 +1286,7 @@ static inline int do_read(struct uart_port *the_port, char *buf, int len)
1286 uart_handle_dcd_change 1286 uart_handle_dcd_change
1287 (port->ip_port, 0); 1287 (port->ip_port, 0);
1288 wake_up_interruptible 1288 wake_up_interruptible
1289 (&the_port->info-> 1289 (&the_port->state->
1290 delta_msr_wait); 1290 delta_msr_wait);
1291 } 1291 }
1292 1292
@@ -1392,21 +1392,21 @@ static int receive_chars(struct uart_port *the_port)
1392 struct tty_struct *tty; 1392 struct tty_struct *tty;
1393 unsigned char ch[MAX_CHARS]; 1393 unsigned char ch[MAX_CHARS];
1394 int read_count = 0, read_room, flip = 0; 1394 int read_count = 0, read_room, flip = 0;
1395 struct uart_info *info = the_port->info; 1395 struct uart_state *state = the_port->state;
1396 struct ioc3_port *port = get_ioc3_port(the_port); 1396 struct ioc3_port *port = get_ioc3_port(the_port);
1397 unsigned long pflags; 1397 unsigned long pflags;
1398 1398
1399 /* Make sure all the pointers are "good" ones */ 1399 /* Make sure all the pointers are "good" ones */
1400 if (!info) 1400 if (!state)
1401 return 0; 1401 return 0;
1402 if (!info->port.tty) 1402 if (!state->port.tty)
1403 return 0; 1403 return 0;
1404 1404
1405 if (!(port->ip_flags & INPUT_ENABLE)) 1405 if (!(port->ip_flags & INPUT_ENABLE))
1406 return 0; 1406 return 0;
1407 1407
1408 spin_lock_irqsave(&the_port->lock, pflags); 1408 spin_lock_irqsave(&the_port->lock, pflags);
1409 tty = info->port.tty; 1409 tty = state->port.tty;
1410 1410
1411 read_count = do_read(the_port, ch, MAX_CHARS); 1411 read_count = do_read(the_port, ch, MAX_CHARS);
1412 if (read_count > 0) { 1412 if (read_count > 0) {
@@ -1491,7 +1491,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
1491 uart_handle_dcd_change(the_port, 1491 uart_handle_dcd_change(the_port,
1492 shadow & SHADOW_DCD); 1492 shadow & SHADOW_DCD);
1493 wake_up_interruptible 1493 wake_up_interruptible
1494 (&the_port->info->delta_msr_wait); 1494 (&the_port->state->delta_msr_wait);
1495 } else if ((port->ip_notify & N_DDCD) 1495 } else if ((port->ip_notify & N_DDCD)
1496 && !(shadow & SHADOW_DCD)) { 1496 && !(shadow & SHADOW_DCD)) {
1497 /* Flag delta DCD/no DCD */ 1497 /* Flag delta DCD/no DCD */
@@ -1511,7 +1511,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
1511 uart_handle_cts_change(the_port, shadow 1511 uart_handle_cts_change(the_port, shadow
1512 & SHADOW_CTS); 1512 & SHADOW_CTS);
1513 wake_up_interruptible 1513 wake_up_interruptible
1514 (&the_port->info->delta_msr_wait); 1514 (&the_port->state->delta_msr_wait);
1515 } 1515 }
1516 } 1516 }
1517 1517
@@ -1721,14 +1721,14 @@ static void ic3_shutdown(struct uart_port *the_port)
1721{ 1721{
1722 unsigned long port_flags; 1722 unsigned long port_flags;
1723 struct ioc3_port *port; 1723 struct ioc3_port *port;
1724 struct uart_info *info; 1724 struct uart_state *state;
1725 1725
1726 port = get_ioc3_port(the_port); 1726 port = get_ioc3_port(the_port);
1727 if (!port) 1727 if (!port)
1728 return; 1728 return;
1729 1729
1730 info = the_port->info; 1730 state = the_port->state;
1731 wake_up_interruptible(&info->delta_msr_wait); 1731 wake_up_interruptible(&state->delta_msr_wait);
1732 1732
1733 spin_lock_irqsave(&the_port->lock, port_flags); 1733 spin_lock_irqsave(&the_port->lock, port_flags);
1734 set_notification(port, N_ALL, 0); 1734 set_notification(port, N_ALL, 0);
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index e5c58fe7e745..2055d323f15f 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -1627,25 +1627,25 @@ static void transmit_chars(struct uart_port *the_port)
1627 char *start; 1627 char *start;
1628 struct tty_struct *tty; 1628 struct tty_struct *tty;
1629 struct ioc4_port *port = get_ioc4_port(the_port, 0); 1629 struct ioc4_port *port = get_ioc4_port(the_port, 0);
1630 struct uart_info *info; 1630 struct uart_state *state;
1631 1631
1632 if (!the_port) 1632 if (!the_port)
1633 return; 1633 return;
1634 if (!port) 1634 if (!port)
1635 return; 1635 return;
1636 1636
1637 info = the_port->info; 1637 state = the_port->state;
1638 tty = info->port.tty; 1638 tty = state->port.tty;
1639 1639
1640 if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { 1640 if (uart_circ_empty(&state->xmit) || uart_tx_stopped(the_port)) {
1641 /* Nothing to do or hw stopped */ 1641 /* Nothing to do or hw stopped */
1642 set_notification(port, N_ALL_OUTPUT, 0); 1642 set_notification(port, N_ALL_OUTPUT, 0);
1643 return; 1643 return;
1644 } 1644 }
1645 1645
1646 head = info->xmit.head; 1646 head = state->xmit.head;
1647 tail = info->xmit.tail; 1647 tail = state->xmit.tail;
1648 start = (char *)&info->xmit.buf[tail]; 1648 start = (char *)&state->xmit.buf[tail];
1649 1649
1650 /* write out all the data or until the end of the buffer */ 1650 /* write out all the data or until the end of the buffer */
1651 xmit_count = (head < tail) ? (UART_XMIT_SIZE - tail) : (head - tail); 1651 xmit_count = (head < tail) ? (UART_XMIT_SIZE - tail) : (head - tail);
@@ -1658,14 +1658,14 @@ static void transmit_chars(struct uart_port *the_port)
1658 /* advance the pointers */ 1658 /* advance the pointers */
1659 tail += result; 1659 tail += result;
1660 tail &= UART_XMIT_SIZE - 1; 1660 tail &= UART_XMIT_SIZE - 1;
1661 info->xmit.tail = tail; 1661 state->xmit.tail = tail;
1662 start = (char *)&info->xmit.buf[tail]; 1662 start = (char *)&state->xmit.buf[tail];
1663 } 1663 }
1664 } 1664 }
1665 if (uart_circ_chars_pending(&info->xmit) < WAKEUP_CHARS) 1665 if (uart_circ_chars_pending(&state->xmit) < WAKEUP_CHARS)
1666 uart_write_wakeup(the_port); 1666 uart_write_wakeup(the_port);
1667 1667
1668 if (uart_circ_empty(&info->xmit)) { 1668 if (uart_circ_empty(&state->xmit)) {
1669 set_notification(port, N_OUTPUT_LOWAT, 0); 1669 set_notification(port, N_OUTPUT_LOWAT, 0);
1670 } else { 1670 } else {
1671 set_notification(port, N_OUTPUT_LOWAT, 1); 1671 set_notification(port, N_OUTPUT_LOWAT, 1);
@@ -1686,7 +1686,7 @@ ioc4_change_speed(struct uart_port *the_port,
1686 int baud, bits; 1686 int baud, bits;
1687 unsigned cflag; 1687 unsigned cflag;
1688 int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8; 1688 int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8;
1689 struct uart_info *info = the_port->info; 1689 struct uart_state *state = the_port->state;
1690 1690
1691 cflag = new_termios->c_cflag; 1691 cflag = new_termios->c_cflag;
1692 1692
@@ -1738,14 +1738,14 @@ ioc4_change_speed(struct uart_port *the_port,
1738 1738
1739 the_port->ignore_status_mask = N_ALL_INPUT; 1739 the_port->ignore_status_mask = N_ALL_INPUT;
1740 1740
1741 info->port.tty->low_latency = 1; 1741 state->port.tty->low_latency = 1;
1742 1742
1743 if (I_IGNPAR(info->port.tty)) 1743 if (I_IGNPAR(state->port.tty))
1744 the_port->ignore_status_mask &= ~(N_PARITY_ERROR 1744 the_port->ignore_status_mask &= ~(N_PARITY_ERROR
1745 | N_FRAMING_ERROR); 1745 | N_FRAMING_ERROR);
1746 if (I_IGNBRK(info->port.tty)) { 1746 if (I_IGNBRK(state->port.tty)) {
1747 the_port->ignore_status_mask &= ~N_BREAK; 1747 the_port->ignore_status_mask &= ~N_BREAK;
1748 if (I_IGNPAR(info->port.tty)) 1748 if (I_IGNPAR(state->port.tty))
1749 the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; 1749 the_port->ignore_status_mask &= ~N_OVERRUN_ERROR;
1750 } 1750 }
1751 if (!(cflag & CREAD)) { 1751 if (!(cflag & CREAD)) {
@@ -1784,7 +1784,7 @@ ioc4_change_speed(struct uart_port *the_port,
1784static inline int ic4_startup_local(struct uart_port *the_port) 1784static inline int ic4_startup_local(struct uart_port *the_port)
1785{ 1785{
1786 struct ioc4_port *port; 1786 struct ioc4_port *port;
1787 struct uart_info *info; 1787 struct uart_state *state;
1788 1788
1789 if (!the_port) 1789 if (!the_port)
1790 return -1; 1790 return -1;
@@ -1793,7 +1793,7 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1793 if (!port) 1793 if (!port)
1794 return -1; 1794 return -1;
1795 1795
1796 info = the_port->info; 1796 state = the_port->state;
1797 1797
1798 local_open(port); 1798 local_open(port);
1799 1799
@@ -1801,7 +1801,7 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1801 ioc4_set_proto(port, the_port->mapbase); 1801 ioc4_set_proto(port, the_port->mapbase);
1802 1802
1803 /* set the speed of the serial port */ 1803 /* set the speed of the serial port */
1804 ioc4_change_speed(the_port, info->port.tty->termios, 1804 ioc4_change_speed(the_port, state->port.tty->termios,
1805 (struct ktermios *)0); 1805 (struct ktermios *)0);
1806 1806
1807 return 0; 1807 return 0;
@@ -1882,7 +1882,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
1882 the_port = port->ip_port; 1882 the_port = port->ip_port;
1883 the_port->icount.dcd = 1; 1883 the_port->icount.dcd = 1;
1884 wake_up_interruptible 1884 wake_up_interruptible
1885 (&the_port-> info->delta_msr_wait); 1885 (&the_port->state->delta_msr_wait);
1886 } else if ((port->ip_notify & N_DDCD) 1886 } else if ((port->ip_notify & N_DDCD)
1887 && !(shadow & IOC4_SHADOW_DCD)) { 1887 && !(shadow & IOC4_SHADOW_DCD)) {
1888 /* Flag delta DCD/no DCD */ 1888 /* Flag delta DCD/no DCD */
@@ -1904,7 +1904,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
1904 the_port->icount.cts = 1904 the_port->icount.cts =
1905 (shadow & IOC4_SHADOW_CTS) ? 1 : 0; 1905 (shadow & IOC4_SHADOW_CTS) ? 1 : 0;
1906 wake_up_interruptible 1906 wake_up_interruptible
1907 (&the_port->info->delta_msr_wait); 1907 (&the_port->state->delta_msr_wait);
1908 } 1908 }
1909 } 1909 }
1910 1910
@@ -2236,7 +2236,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
2236 && port->ip_port) { 2236 && port->ip_port) {
2237 the_port->icount.dcd = 0; 2237 the_port->icount.dcd = 0;
2238 wake_up_interruptible 2238 wake_up_interruptible
2239 (&the_port->info-> 2239 (&the_port->state->
2240 delta_msr_wait); 2240 delta_msr_wait);
2241 } 2241 }
2242 2242
@@ -2341,17 +2341,17 @@ static void receive_chars(struct uart_port *the_port)
2341 unsigned char ch[IOC4_MAX_CHARS]; 2341 unsigned char ch[IOC4_MAX_CHARS];
2342 int read_count, request_count = IOC4_MAX_CHARS; 2342 int read_count, request_count = IOC4_MAX_CHARS;
2343 struct uart_icount *icount; 2343 struct uart_icount *icount;
2344 struct uart_info *info = the_port->info; 2344 struct uart_state *state = the_port->state;
2345 unsigned long pflags; 2345 unsigned long pflags;
2346 2346
2347 /* Make sure all the pointers are "good" ones */ 2347 /* Make sure all the pointers are "good" ones */
2348 if (!info) 2348 if (!state)
2349 return; 2349 return;
2350 if (!info->port.tty) 2350 if (!state->port.tty)
2351 return; 2351 return;
2352 2352
2353 spin_lock_irqsave(&the_port->lock, pflags); 2353 spin_lock_irqsave(&the_port->lock, pflags);
2354 tty = info->port.tty; 2354 tty = state->port.tty;
2355 2355
2356 request_count = tty_buffer_request_room(tty, IOC4_MAX_CHARS); 2356 request_count = tty_buffer_request_room(tty, IOC4_MAX_CHARS);
2357 2357
@@ -2430,19 +2430,19 @@ static void ic4_shutdown(struct uart_port *the_port)
2430{ 2430{
2431 unsigned long port_flags; 2431 unsigned long port_flags;
2432 struct ioc4_port *port; 2432 struct ioc4_port *port;
2433 struct uart_info *info; 2433 struct uart_state *state;
2434 2434
2435 port = get_ioc4_port(the_port, 0); 2435 port = get_ioc4_port(the_port, 0);
2436 if (!port) 2436 if (!port)
2437 return; 2437 return;
2438 2438
2439 info = the_port->info; 2439 state = the_port->state;
2440 port->ip_port = NULL; 2440 port->ip_port = NULL;
2441 2441
2442 wake_up_interruptible(&info->delta_msr_wait); 2442 wake_up_interruptible(&state->delta_msr_wait);
2443 2443
2444 if (info->port.tty) 2444 if (state->port.tty)
2445 set_bit(TTY_IO_ERROR, &info->port.tty->flags); 2445 set_bit(TTY_IO_ERROR, &state->port.tty->flags);
2446 2446
2447 spin_lock_irqsave(&the_port->lock, port_flags); 2447 spin_lock_irqsave(&the_port->lock, port_flags);
2448 set_notification(port, N_ALL, 0); 2448 set_notification(port, N_ALL, 0);
@@ -2538,7 +2538,7 @@ static int ic4_startup(struct uart_port *the_port)
2538 int retval; 2538 int retval;
2539 struct ioc4_port *port; 2539 struct ioc4_port *port;
2540 struct ioc4_control *control; 2540 struct ioc4_control *control;
2541 struct uart_info *info; 2541 struct uart_state *state;
2542 unsigned long port_flags; 2542 unsigned long port_flags;
2543 2543
2544 if (!the_port) 2544 if (!the_port)
@@ -2546,7 +2546,7 @@ static int ic4_startup(struct uart_port *the_port)
2546 port = get_ioc4_port(the_port, 1); 2546 port = get_ioc4_port(the_port, 1);
2547 if (!port) 2547 if (!port)
2548 return -ENODEV; 2548 return -ENODEV;
2549 info = the_port->info; 2549 state = the_port->state;
2550 2550
2551 control = port->ip_control; 2551 control = port->ip_control;
2552 if (!control) { 2552 if (!control) {
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 0d9acbd0bb70..2e847deb41dc 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -256,9 +256,9 @@ static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up
256 unsigned int r1; 256 unsigned int r1;
257 257
258 tty = NULL; 258 tty = NULL;
259 if (up->port.info != NULL && 259 if (up->port.state != NULL &&
260 up->port.info->port.tty != NULL) 260 up->port.state->port.tty != NULL)
261 tty = up->port.info->port.tty; 261 tty = up->port.state->port.tty;
262 262
263 for (;;) { 263 for (;;) {
264 ch = readb(&channel->control); 264 ch = readb(&channel->control);
@@ -354,7 +354,7 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
354 uart_handle_cts_change(&up->port, 354 uart_handle_cts_change(&up->port,
355 (status & CTS)); 355 (status & CTS));
356 356
357 wake_up_interruptible(&up->port.info->delta_msr_wait); 357 wake_up_interruptible(&up->port.state->delta_msr_wait);
358 } 358 }
359 359
360 up->prev_status = status; 360 up->prev_status = status;
@@ -404,9 +404,9 @@ static void ip22zilog_transmit_chars(struct uart_ip22zilog_port *up,
404 return; 404 return;
405 } 405 }
406 406
407 if (up->port.info == NULL) 407 if (up->port.state == NULL)
408 goto ack_tx_int; 408 goto ack_tx_int;
409 xmit = &up->port.info->xmit; 409 xmit = &up->port.state->xmit;
410 if (uart_circ_empty(xmit)) 410 if (uart_circ_empty(xmit))
411 goto ack_tx_int; 411 goto ack_tx_int;
412 if (uart_tx_stopped(&up->port)) 412 if (uart_tx_stopped(&up->port))
@@ -607,7 +607,7 @@ static void ip22zilog_start_tx(struct uart_port *port)
607 port->icount.tx++; 607 port->icount.tx++;
608 port->x_char = 0; 608 port->x_char = 0;
609 } else { 609 } else {
610 struct circ_buf *xmit = &port->info->xmit; 610 struct circ_buf *xmit = &port->state->xmit;
611 611
612 writeb(xmit->buf[xmit->tail], &channel->data); 612 writeb(xmit->buf[xmit->tail], &channel->data);
613 ZSDELAY(); 613 ZSDELAY();
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c
index 9dadaa11d266..b4b124e4828f 100644
--- a/drivers/serial/jsm/jsm_neo.c
+++ b/drivers/serial/jsm/jsm_neo.c
@@ -989,7 +989,7 @@ static void neo_param(struct jsm_channel *ch)
989 { 50, B50 }, 989 { 50, B50 },
990 }; 990 };
991 991
992 cflag = C_BAUD(ch->uart_port.info->port.tty); 992 cflag = C_BAUD(ch->uart_port.state->port.tty);
993 baud = 9600; 993 baud = 9600;
994 for (i = 0; i < ARRAY_SIZE(baud_rates); i++) { 994 for (i = 0; i < ARRAY_SIZE(baud_rates); i++) {
995 if (baud_rates[i].cflag == cflag) { 995 if (baud_rates[i].cflag == cflag) {
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 00f4577d2f7f..7439c0373620 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -147,7 +147,7 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch)
147 struct ktermios *termios; 147 struct ktermios *termios;
148 148
149 spin_lock_irqsave(&port->lock, lock_flags); 149 spin_lock_irqsave(&port->lock, lock_flags);
150 termios = port->info->port.tty->termios; 150 termios = port->state->port.tty->termios;
151 if (ch == termios->c_cc[VSTART]) 151 if (ch == termios->c_cc[VSTART])
152 channel->ch_bd->bd_ops->send_start_character(channel); 152 channel->ch_bd->bd_ops->send_start_character(channel);
153 153
@@ -245,7 +245,7 @@ static int jsm_tty_open(struct uart_port *port)
245 channel->ch_cached_lsr = 0; 245 channel->ch_cached_lsr = 0;
246 channel->ch_stops_sent = 0; 246 channel->ch_stops_sent = 0;
247 247
248 termios = port->info->port.tty->termios; 248 termios = port->state->port.tty->termios;
249 channel->ch_c_cflag = termios->c_cflag; 249 channel->ch_c_cflag = termios->c_cflag;
250 channel->ch_c_iflag = termios->c_iflag; 250 channel->ch_c_iflag = termios->c_iflag;
251 channel->ch_c_oflag = termios->c_oflag; 251 channel->ch_c_oflag = termios->c_oflag;
@@ -278,7 +278,7 @@ static void jsm_tty_close(struct uart_port *port)
278 jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n"); 278 jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n");
279 279
280 bd = channel->ch_bd; 280 bd = channel->ch_bd;
281 ts = port->info->port.tty->termios; 281 ts = port->state->port.tty->termios;
282 282
283 channel->ch_flags &= ~(CH_STOPI); 283 channel->ch_flags &= ~(CH_STOPI);
284 284
@@ -530,7 +530,7 @@ void jsm_input(struct jsm_channel *ch)
530 if (!ch) 530 if (!ch)
531 return; 531 return;
532 532
533 tp = ch->uart_port.info->port.tty; 533 tp = ch->uart_port.state->port.tty;
534 534
535 bd = ch->ch_bd; 535 bd = ch->ch_bd;
536 if(!bd) 536 if(!bd)
@@ -849,7 +849,7 @@ int jsm_tty_write(struct uart_port *port)
849 u16 tail; 849 u16 tail;
850 u16 tmask; 850 u16 tmask;
851 u32 remain; 851 u32 remain;
852 int temp_tail = port->info->xmit.tail; 852 int temp_tail = port->state->xmit.tail;
853 struct jsm_channel *channel = (struct jsm_channel *)port; 853 struct jsm_channel *channel = (struct jsm_channel *)port;
854 854
855 tmask = WQUEUEMASK; 855 tmask = WQUEUEMASK;
@@ -865,10 +865,10 @@ int jsm_tty_write(struct uart_port *port)
865 data_count = 0; 865 data_count = 0;
866 if (bufcount >= remain) { 866 if (bufcount >= remain) {
867 bufcount -= remain; 867 bufcount -= remain;
868 while ((port->info->xmit.head != temp_tail) && 868 while ((port->state->xmit.head != temp_tail) &&
869 (data_count < remain)) { 869 (data_count < remain)) {
870 channel->ch_wqueue[head++] = 870 channel->ch_wqueue[head++] =
871 port->info->xmit.buf[temp_tail]; 871 port->state->xmit.buf[temp_tail];
872 872
873 temp_tail++; 873 temp_tail++;
874 temp_tail &= (UART_XMIT_SIZE - 1); 874 temp_tail &= (UART_XMIT_SIZE - 1);
@@ -880,10 +880,10 @@ int jsm_tty_write(struct uart_port *port)
880 data_count1 = 0; 880 data_count1 = 0;
881 if (bufcount > 0) { 881 if (bufcount > 0) {
882 remain = bufcount; 882 remain = bufcount;
883 while ((port->info->xmit.head != temp_tail) && 883 while ((port->state->xmit.head != temp_tail) &&
884 (data_count1 < remain)) { 884 (data_count1 < remain)) {
885 channel->ch_wqueue[head++] = 885 channel->ch_wqueue[head++] =
886 port->info->xmit.buf[temp_tail]; 886 port->state->xmit.buf[temp_tail];
887 887
888 temp_tail++; 888 temp_tail++;
889 temp_tail &= (UART_XMIT_SIZE - 1); 889 temp_tail &= (UART_XMIT_SIZE - 1);
@@ -892,7 +892,7 @@ int jsm_tty_write(struct uart_port *port)
892 } 892 }
893 } 893 }
894 894
895 port->info->xmit.tail = temp_tail; 895 port->state->xmit.tail = temp_tail;
896 896
897 data_count += data_count1; 897 data_count += data_count1;
898 if (data_count) { 898 if (data_count) {
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index 611c97a15654..bea5c215460c 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -286,7 +286,7 @@ static void m32r_sio_start_tx(struct uart_port *port)
286{ 286{
287#ifdef CONFIG_SERIAL_M32R_PLDSIO 287#ifdef CONFIG_SERIAL_M32R_PLDSIO
288 struct uart_sio_port *up = (struct uart_sio_port *)port; 288 struct uart_sio_port *up = (struct uart_sio_port *)port;
289 struct circ_buf *xmit = &up->port.info->xmit; 289 struct circ_buf *xmit = &up->port.state->xmit;
290 290
291 if (!(up->ier & UART_IER_THRI)) { 291 if (!(up->ier & UART_IER_THRI)) {
292 up->ier |= UART_IER_THRI; 292 up->ier |= UART_IER_THRI;
@@ -325,7 +325,7 @@ static void m32r_sio_enable_ms(struct uart_port *port)
325 325
326static void receive_chars(struct uart_sio_port *up, int *status) 326static void receive_chars(struct uart_sio_port *up, int *status)
327{ 327{
328 struct tty_struct *tty = up->port.info->port.tty; 328 struct tty_struct *tty = up->port.state->port.tty;
329 unsigned char ch; 329 unsigned char ch;
330 unsigned char flag; 330 unsigned char flag;
331 int max_count = 256; 331 int max_count = 256;
@@ -398,7 +398,7 @@ static void receive_chars(struct uart_sio_port *up, int *status)
398 398
399static void transmit_chars(struct uart_sio_port *up) 399static void transmit_chars(struct uart_sio_port *up)
400{ 400{
401 struct circ_buf *xmit = &up->port.info->xmit; 401 struct circ_buf *xmit = &up->port.state->xmit;
402 int count; 402 int count;
403 403
404 if (up->port.x_char) { 404 if (up->port.x_char) {
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 9fd33e5622bd..75ab00631c41 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -184,7 +184,7 @@ static void max3100_timeout(unsigned long data)
184{ 184{
185 struct max3100_port *s = (struct max3100_port *)data; 185 struct max3100_port *s = (struct max3100_port *)data;
186 186
187 if (s->port.info) { 187 if (s->port.state) {
188 max3100_dowork(s); 188 max3100_dowork(s);
189 mod_timer(&s->timer, jiffies + s->poll_time); 189 mod_timer(&s->timer, jiffies + s->poll_time);
190 } 190 }
@@ -261,7 +261,7 @@ static void max3100_work(struct work_struct *w)
261 int rxchars; 261 int rxchars;
262 u16 tx, rx; 262 u16 tx, rx;
263 int conf, cconf, rts, crts; 263 int conf, cconf, rts, crts;
264 struct circ_buf *xmit = &s->port.info->xmit; 264 struct circ_buf *xmit = &s->port.state->xmit;
265 265
266 dev_dbg(&s->spi->dev, "%s\n", __func__); 266 dev_dbg(&s->spi->dev, "%s\n", __func__);
267 267
@@ -307,8 +307,8 @@ static void max3100_work(struct work_struct *w)
307 } 307 }
308 } 308 }
309 309
310 if (rxchars > 16 && s->port.info->port.tty != NULL) { 310 if (rxchars > 16 && s->port.state->port.tty != NULL) {
311 tty_flip_buffer_push(s->port.info->port.tty); 311 tty_flip_buffer_push(s->port.state->port.tty);
312 rxchars = 0; 312 rxchars = 0;
313 } 313 }
314 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 314 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -320,8 +320,8 @@ static void max3100_work(struct work_struct *w)
320 (!uart_circ_empty(xmit) && 320 (!uart_circ_empty(xmit) &&
321 !uart_tx_stopped(&s->port)))); 321 !uart_tx_stopped(&s->port))));
322 322
323 if (rxchars > 0 && s->port.info->port.tty != NULL) 323 if (rxchars > 0 && s->port.state->port.tty != NULL)
324 tty_flip_buffer_push(s->port.info->port.tty); 324 tty_flip_buffer_push(s->port.state->port.tty);
325} 325}
326 326
327static irqreturn_t max3100_irq(int irqno, void *dev_id) 327static irqreturn_t max3100_irq(int irqno, void *dev_id)
@@ -429,7 +429,7 @@ max3100_set_termios(struct uart_port *port, struct ktermios *termios,
429 int baud = 0; 429 int baud = 0;
430 unsigned cflag; 430 unsigned cflag;
431 u32 param_new, param_mask, parity = 0; 431 u32 param_new, param_mask, parity = 0;
432 struct tty_struct *tty = s->port.info->port.tty; 432 struct tty_struct *tty = s->port.state->port.tty;
433 433
434 dev_dbg(&s->spi->dev, "%s\n", __func__); 434 dev_dbg(&s->spi->dev, "%s\n", __func__);
435 if (!tty) 435 if (!tty)
@@ -529,7 +529,7 @@ max3100_set_termios(struct uart_port *port, struct ktermios *termios,
529 MAX3100_STATUS_OE; 529 MAX3100_STATUS_OE;
530 530
531 /* we are sending char from a workqueue so enable */ 531 /* we are sending char from a workqueue so enable */
532 s->port.info->port.tty->low_latency = 1; 532 s->port.state->port.tty->low_latency = 1;
533 533
534 if (s->poll_time > 0) 534 if (s->poll_time > 0)
535 del_timer_sync(&s->timer); 535 del_timer_sync(&s->timer);
diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c
index 0eefb07bebaf..b44382442bf1 100644
--- a/drivers/serial/mcf.c
+++ b/drivers/serial/mcf.c
@@ -323,7 +323,7 @@ static void mcf_rx_chars(struct mcf_uart *pp)
323 uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag); 323 uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag);
324 } 324 }
325 325
326 tty_flip_buffer_push(port->info->port.tty); 326 tty_flip_buffer_push(port->state->port.tty);
327} 327}
328 328
329/****************************************************************************/ 329/****************************************************************************/
@@ -331,7 +331,7 @@ static void mcf_rx_chars(struct mcf_uart *pp)
331static void mcf_tx_chars(struct mcf_uart *pp) 331static void mcf_tx_chars(struct mcf_uart *pp)
332{ 332{
333 struct uart_port *port = &pp->port; 333 struct uart_port *port = &pp->port;
334 struct circ_buf *xmit = &port->info->xmit; 334 struct circ_buf *xmit = &port->state->xmit;
335 335
336 if (port->x_char) { 336 if (port->x_char) {
337 /* Send special char - probably flow control */ 337 /* Send special char - probably flow control */
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index abbd146c50d9..d7bcd074d383 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -745,7 +745,7 @@ static struct uart_ops mpc52xx_uart_ops = {
745static inline int 745static inline int
746mpc52xx_uart_int_rx_chars(struct uart_port *port) 746mpc52xx_uart_int_rx_chars(struct uart_port *port)
747{ 747{
748 struct tty_struct *tty = port->info->port.tty; 748 struct tty_struct *tty = port->state->port.tty;
749 unsigned char ch, flag; 749 unsigned char ch, flag;
750 unsigned short status; 750 unsigned short status;
751 751
@@ -812,7 +812,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
812static inline int 812static inline int
813mpc52xx_uart_int_tx_chars(struct uart_port *port) 813mpc52xx_uart_int_tx_chars(struct uart_port *port)
814{ 814{
815 struct circ_buf *xmit = &port->info->xmit; 815 struct circ_buf *xmit = &port->state->xmit;
816 816
817 /* Process out of band chars */ 817 /* Process out of band chars */
818 if (port->x_char) { 818 if (port->x_char) {
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index 61d3ade5286c..b5496c28e60b 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -936,7 +936,7 @@ static int serial_polled;
936static int mpsc_rx_intr(struct mpsc_port_info *pi) 936static int mpsc_rx_intr(struct mpsc_port_info *pi)
937{ 937{
938 struct mpsc_rx_desc *rxre; 938 struct mpsc_rx_desc *rxre;
939 struct tty_struct *tty = pi->port.info->port.tty; 939 struct tty_struct *tty = pi->port.state->port.tty;
940 u32 cmdstat, bytes_in, i; 940 u32 cmdstat, bytes_in, i;
941 int rc = 0; 941 int rc = 0;
942 u8 *bp; 942 u8 *bp;
@@ -1109,7 +1109,7 @@ static void mpsc_setup_tx_desc(struct mpsc_port_info *pi, u32 count, u32 intr)
1109 1109
1110static void mpsc_copy_tx_data(struct mpsc_port_info *pi) 1110static void mpsc_copy_tx_data(struct mpsc_port_info *pi)
1111{ 1111{
1112 struct circ_buf *xmit = &pi->port.info->xmit; 1112 struct circ_buf *xmit = &pi->port.state->xmit;
1113 u8 *bp; 1113 u8 *bp;
1114 u32 i; 1114 u32 i;
1115 1115
diff --git a/drivers/serial/msm_serial.c b/drivers/serial/msm_serial.c
index f7c24baa1416..ff18d50c99c1 100644
--- a/drivers/serial/msm_serial.c
+++ b/drivers/serial/msm_serial.c
@@ -88,7 +88,7 @@ static void msm_enable_ms(struct uart_port *port)
88 88
89static void handle_rx(struct uart_port *port) 89static void handle_rx(struct uart_port *port)
90{ 90{
91 struct tty_struct *tty = port->info->port.tty; 91 struct tty_struct *tty = port->state->port.tty;
92 unsigned int sr; 92 unsigned int sr;
93 93
94 /* 94 /*
@@ -136,7 +136,7 @@ static void handle_rx(struct uart_port *port)
136 136
137static void handle_tx(struct uart_port *port) 137static void handle_tx(struct uart_port *port)
138{ 138{
139 struct circ_buf *xmit = &port->info->xmit; 139 struct circ_buf *xmit = &port->state->xmit;
140 struct msm_port *msm_port = UART_TO_MSM(port); 140 struct msm_port *msm_port = UART_TO_MSM(port);
141 int sent_tx; 141 int sent_tx;
142 142
@@ -169,7 +169,7 @@ static void handle_delta_cts(struct uart_port *port)
169{ 169{
170 msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR); 170 msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR);
171 port->icount.cts++; 171 port->icount.cts++;
172 wake_up_interruptible(&port->info->delta_msr_wait); 172 wake_up_interruptible(&port->state->delta_msr_wait);
173} 173}
174 174
175static irqreturn_t msm_irq(int irq, void *dev_id) 175static irqreturn_t msm_irq(int irq, void *dev_id)
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index 953a5ffa9b44..7571aaa138b0 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -199,7 +199,7 @@ static void mux_break_ctl(struct uart_port *port, int break_state)
199static void mux_write(struct uart_port *port) 199static void mux_write(struct uart_port *port)
200{ 200{
201 int count; 201 int count;
202 struct circ_buf *xmit = &port->info->xmit; 202 struct circ_buf *xmit = &port->state->xmit;
203 203
204 if(port->x_char) { 204 if(port->x_char) {
205 UART_PUT_CHAR(port, port->x_char); 205 UART_PUT_CHAR(port, port->x_char);
@@ -243,7 +243,7 @@ static void mux_write(struct uart_port *port)
243static void mux_read(struct uart_port *port) 243static void mux_read(struct uart_port *port)
244{ 244{
245 int data; 245 int data;
246 struct tty_struct *tty = port->info->port.tty; 246 struct tty_struct *tty = port->state->port.tty;
247 __u32 start_count = port->icount.rx; 247 __u32 start_count = port->icount.rx;
248 248
249 while(1) { 249 while(1) {
diff --git a/drivers/serial/netx-serial.c b/drivers/serial/netx-serial.c
index 3e5dda8518b7..7735c9f35fa0 100644
--- a/drivers/serial/netx-serial.c
+++ b/drivers/serial/netx-serial.c
@@ -140,7 +140,7 @@ static void netx_enable_ms(struct uart_port *port)
140 140
141static inline void netx_transmit_buffer(struct uart_port *port) 141static inline void netx_transmit_buffer(struct uart_port *port)
142{ 142{
143 struct circ_buf *xmit = &port->info->xmit; 143 struct circ_buf *xmit = &port->state->xmit;
144 144
145 if (port->x_char) { 145 if (port->x_char) {
146 writel(port->x_char, port->membase + UART_DR); 146 writel(port->x_char, port->membase + UART_DR);
@@ -185,7 +185,7 @@ static unsigned int netx_tx_empty(struct uart_port *port)
185 185
186static void netx_txint(struct uart_port *port) 186static void netx_txint(struct uart_port *port)
187{ 187{
188 struct circ_buf *xmit = &port->info->xmit; 188 struct circ_buf *xmit = &port->state->xmit;
189 189
190 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { 190 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
191 netx_stop_tx(port); 191 netx_stop_tx(port);
@@ -201,7 +201,7 @@ static void netx_txint(struct uart_port *port)
201static void netx_rxint(struct uart_port *port) 201static void netx_rxint(struct uart_port *port)
202{ 202{
203 unsigned char rx, flg, status; 203 unsigned char rx, flg, status;
204 struct tty_struct *tty = port->info->port.tty; 204 struct tty_struct *tty = port->state->port.tty;
205 205
206 while (!(readl(port->membase + UART_FR) & FR_RXFE)) { 206 while (!(readl(port->membase + UART_FR) & FR_RXFE)) {
207 rx = readl(port->membase + UART_DR); 207 rx = readl(port->membase + UART_DR);
diff --git a/drivers/serial/nwpserial.c b/drivers/serial/nwpserial.c
index 9e150b19d726..e1ab8ec0a4a6 100644
--- a/drivers/serial/nwpserial.c
+++ b/drivers/serial/nwpserial.c
@@ -126,7 +126,7 @@ static void nwpserial_config_port(struct uart_port *port, int flags)
126static irqreturn_t nwpserial_interrupt(int irq, void *dev_id) 126static irqreturn_t nwpserial_interrupt(int irq, void *dev_id)
127{ 127{
128 struct nwpserial_port *up = dev_id; 128 struct nwpserial_port *up = dev_id;
129 struct tty_struct *tty = up->port.info->port.tty; 129 struct tty_struct *tty = up->port.state->port.tty;
130 irqreturn_t ret; 130 irqreturn_t ret;
131 unsigned int iir; 131 unsigned int iir;
132 unsigned char ch; 132 unsigned char ch;
@@ -261,7 +261,7 @@ static void nwpserial_start_tx(struct uart_port *port)
261 struct nwpserial_port *up; 261 struct nwpserial_port *up;
262 struct circ_buf *xmit; 262 struct circ_buf *xmit;
263 up = container_of(port, struct nwpserial_port, port); 263 up = container_of(port, struct nwpserial_port, port);
264 xmit = &up->port.info->xmit; 264 xmit = &up->port.state->xmit;
265 265
266 if (port->x_char) { 266 if (port->x_char) {
267 nwpserial_putchar(up, up->port.x_char); 267 nwpserial_putchar(up, up->port.x_char);
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 9c1243fbd512..ab4c85ba3549 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -242,12 +242,12 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)
242 } 242 }
243 243
244 /* Sanity check, make sure the old bug is no longer happening */ 244 /* Sanity check, make sure the old bug is no longer happening */
245 if (uap->port.info == NULL || uap->port.info->port.tty == NULL) { 245 if (uap->port.state == NULL || uap->port.state->port.tty == NULL) {
246 WARN_ON(1); 246 WARN_ON(1);
247 (void)read_zsdata(uap); 247 (void)read_zsdata(uap);
248 return NULL; 248 return NULL;
249 } 249 }
250 tty = uap->port.info->port.tty; 250 tty = uap->port.state->port.tty;
251 251
252 while (1) { 252 while (1) {
253 error = 0; 253 error = 0;
@@ -369,7 +369,7 @@ static void pmz_status_handle(struct uart_pmac_port *uap)
369 uart_handle_cts_change(&uap->port, 369 uart_handle_cts_change(&uap->port,
370 !(status & CTS)); 370 !(status & CTS));
371 371
372 wake_up_interruptible(&uap->port.info->delta_msr_wait); 372 wake_up_interruptible(&uap->port.state->delta_msr_wait);
373 } 373 }
374 374
375 if (status & BRK_ABRT) 375 if (status & BRK_ABRT)
@@ -420,9 +420,9 @@ static void pmz_transmit_chars(struct uart_pmac_port *uap)
420 return; 420 return;
421 } 421 }
422 422
423 if (uap->port.info == NULL) 423 if (uap->port.state == NULL)
424 goto ack_tx_int; 424 goto ack_tx_int;
425 xmit = &uap->port.info->xmit; 425 xmit = &uap->port.state->xmit;
426 if (uart_circ_empty(xmit)) { 426 if (uart_circ_empty(xmit)) {
427 uart_write_wakeup(&uap->port); 427 uart_write_wakeup(&uap->port);
428 goto ack_tx_int; 428 goto ack_tx_int;
@@ -655,7 +655,7 @@ static void pmz_start_tx(struct uart_port *port)
655 port->icount.tx++; 655 port->icount.tx++;
656 port->x_char = 0; 656 port->x_char = 0;
657 } else { 657 } else {
658 struct circ_buf *xmit = &port->info->xmit; 658 struct circ_buf *xmit = &port->state->xmit;
659 659
660 write_zsdata(uap, xmit->buf[xmit->tail]); 660 write_zsdata(uap, xmit->buf[xmit->tail]);
661 zssync(uap); 661 zssync(uap);
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index 1bb8f1b45767..2da747635275 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -100,7 +100,7 @@ static void pnx8xxx_mctrl_check(struct pnx8xxx_port *sport)
100 if (changed & TIOCM_CTS) 100 if (changed & TIOCM_CTS)
101 uart_handle_cts_change(&sport->port, status & TIOCM_CTS); 101 uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
102 102
103 wake_up_interruptible(&sport->port.info->delta_msr_wait); 103 wake_up_interruptible(&sport->port.state->delta_msr_wait);
104} 104}
105 105
106/* 106/*
@@ -112,7 +112,7 @@ static void pnx8xxx_timeout(unsigned long data)
112 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)data; 112 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)data;
113 unsigned long flags; 113 unsigned long flags;
114 114
115 if (sport->port.info) { 115 if (sport->port.state) {
116 spin_lock_irqsave(&sport->port.lock, flags); 116 spin_lock_irqsave(&sport->port.lock, flags);
117 pnx8xxx_mctrl_check(sport); 117 pnx8xxx_mctrl_check(sport);
118 spin_unlock_irqrestore(&sport->port.lock, flags); 118 spin_unlock_irqrestore(&sport->port.lock, flags);
@@ -181,7 +181,7 @@ static void pnx8xxx_enable_ms(struct uart_port *port)
181 181
182static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) 182static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
183{ 183{
184 struct tty_struct *tty = sport->port.info->port.tty; 184 struct tty_struct *tty = sport->port.state->port.tty;
185 unsigned int status, ch, flg; 185 unsigned int status, ch, flg;
186 186
187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | 187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
@@ -243,7 +243,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
243 243
244static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport) 244static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport)
245{ 245{
246 struct circ_buf *xmit = &sport->port.info->xmit; 246 struct circ_buf *xmit = &sport->port.state->xmit;
247 247
248 if (sport->port.x_char) { 248 if (sport->port.x_char) {
249 serial_out(sport, PNX8XXX_FIFO, sport->port.x_char); 249 serial_out(sport, PNX8XXX_FIFO, sport->port.x_char);
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index a48a8a13d87b..ad48919c0415 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -96,7 +96,7 @@ static void serial_pxa_stop_rx(struct uart_port *port)
96 96
97static inline void receive_chars(struct uart_pxa_port *up, int *status) 97static inline void receive_chars(struct uart_pxa_port *up, int *status)
98{ 98{
99 struct tty_struct *tty = up->port.info->port.tty; 99 struct tty_struct *tty = up->port.state->port.tty;
100 unsigned int ch, flag; 100 unsigned int ch, flag;
101 int max_count = 256; 101 int max_count = 256;
102 102
@@ -161,7 +161,7 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status)
161 161
162static void transmit_chars(struct uart_pxa_port *up) 162static void transmit_chars(struct uart_pxa_port *up)
163{ 163{
164 struct circ_buf *xmit = &up->port.info->xmit; 164 struct circ_buf *xmit = &up->port.state->xmit;
165 int count; 165 int count;
166 166
167 if (up->port.x_char) { 167 if (up->port.x_char) {
@@ -220,7 +220,7 @@ static inline void check_modem_status(struct uart_pxa_port *up)
220 if (status & UART_MSR_DCTS) 220 if (status & UART_MSR_DCTS)
221 uart_handle_cts_change(&up->port, status & UART_MSR_CTS); 221 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
222 222
223 wake_up_interruptible(&up->port.info->delta_msr_wait); 223 wake_up_interruptible(&up->port.state->delta_msr_wait);
224} 224}
225 225
226/* 226/*
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 94530f01521e..61ef3ae24927 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -117,7 +117,7 @@ static void sa1100_mctrl_check(struct sa1100_port *sport)
117 if (changed & TIOCM_CTS) 117 if (changed & TIOCM_CTS)
118 uart_handle_cts_change(&sport->port, status & TIOCM_CTS); 118 uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
119 119
120 wake_up_interruptible(&sport->port.info->delta_msr_wait); 120 wake_up_interruptible(&sport->port.state->delta_msr_wait);
121} 121}
122 122
123/* 123/*
@@ -129,7 +129,7 @@ static void sa1100_timeout(unsigned long data)
129 struct sa1100_port *sport = (struct sa1100_port *)data; 129 struct sa1100_port *sport = (struct sa1100_port *)data;
130 unsigned long flags; 130 unsigned long flags;
131 131
132 if (sport->port.info) { 132 if (sport->port.state) {
133 spin_lock_irqsave(&sport->port.lock, flags); 133 spin_lock_irqsave(&sport->port.lock, flags);
134 sa1100_mctrl_check(sport); 134 sa1100_mctrl_check(sport);
135 spin_unlock_irqrestore(&sport->port.lock, flags); 135 spin_unlock_irqrestore(&sport->port.lock, flags);
@@ -189,7 +189,7 @@ static void sa1100_enable_ms(struct uart_port *port)
189static void 189static void
190sa1100_rx_chars(struct sa1100_port *sport) 190sa1100_rx_chars(struct sa1100_port *sport)
191{ 191{
192 struct tty_struct *tty = sport->port.info->port.tty; 192 struct tty_struct *tty = sport->port.state->port.tty;
193 unsigned int status, ch, flg; 193 unsigned int status, ch, flg;
194 194
195 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | 195 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
@@ -239,7 +239,7 @@ sa1100_rx_chars(struct sa1100_port *sport)
239 239
240static void sa1100_tx_chars(struct sa1100_port *sport) 240static void sa1100_tx_chars(struct sa1100_port *sport)
241{ 241{
242 struct circ_buf *xmit = &sport->port.info->xmit; 242 struct circ_buf *xmit = &sport->port.state->xmit;
243 243
244 if (sport->port.x_char) { 244 if (sport->port.x_char) {
245 UART_PUT_CHAR(sport, sport->port.x_char); 245 UART_PUT_CHAR(sport, sport->port.x_char);
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c
index c8851a0db63a..1523e8d9ae77 100644
--- a/drivers/serial/samsung.c
+++ b/drivers/serial/samsung.c
@@ -196,7 +196,7 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
196{ 196{
197 struct s3c24xx_uart_port *ourport = dev_id; 197 struct s3c24xx_uart_port *ourport = dev_id;
198 struct uart_port *port = &ourport->port; 198 struct uart_port *port = &ourport->port;
199 struct tty_struct *tty = port->info->port.tty; 199 struct tty_struct *tty = port->state->port.tty;
200 unsigned int ufcon, ch, flag, ufstat, uerstat; 200 unsigned int ufcon, ch, flag, ufstat, uerstat;
201 int max_count = 64; 201 int max_count = 64;
202 202
@@ -281,7 +281,7 @@ static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
281{ 281{
282 struct s3c24xx_uart_port *ourport = id; 282 struct s3c24xx_uart_port *ourport = id;
283 struct uart_port *port = &ourport->port; 283 struct uart_port *port = &ourport->port;
284 struct circ_buf *xmit = &port->info->xmit; 284 struct circ_buf *xmit = &port->state->xmit;
285 int count = 256; 285 int count = 256;
286 286
287 if (port->x_char) { 287 if (port->x_char) {
@@ -992,10 +992,10 @@ static int s3c24xx_serial_cpufreq_transition(struct notifier_block *nb,
992 struct ktermios *termios; 992 struct ktermios *termios;
993 struct tty_struct *tty; 993 struct tty_struct *tty;
994 994
995 if (uport->info == NULL) 995 if (uport->state == NULL)
996 goto exit; 996 goto exit;
997 997
998 tty = uport->info->port.tty; 998 tty = uport->state->port.tty;
999 999
1000 if (tty == NULL) 1000 if (tty == NULL)
1001 goto exit; 1001 goto exit;
diff --git a/drivers/serial/sb1250-duart.c b/drivers/serial/sb1250-duart.c
index 319e8b83f6be..fa5f303b36d3 100644
--- a/drivers/serial/sb1250-duart.c
+++ b/drivers/serial/sb1250-duart.c
@@ -384,13 +384,13 @@ static void sbd_receive_chars(struct sbd_port *sport)
384 uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag); 384 uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag);
385 } 385 }
386 386
387 tty_flip_buffer_push(uport->info->port.tty); 387 tty_flip_buffer_push(uport->state->port.tty);
388} 388}
389 389
390static void sbd_transmit_chars(struct sbd_port *sport) 390static void sbd_transmit_chars(struct sbd_port *sport)
391{ 391{
392 struct uart_port *uport = &sport->port; 392 struct uart_port *uport = &sport->port;
393 struct circ_buf *xmit = &sport->port.info->xmit; 393 struct circ_buf *xmit = &sport->port.state->xmit;
394 unsigned int mask; 394 unsigned int mask;
395 int stop_tx; 395 int stop_tx;
396 396
@@ -440,7 +440,7 @@ static void sbd_status_handle(struct sbd_port *sport)
440 440
441 if (delta & ((M_DUART_IN_PIN2_VAL | M_DUART_IN_PIN0_VAL) << 441 if (delta & ((M_DUART_IN_PIN2_VAL | M_DUART_IN_PIN0_VAL) <<
442 S_DUART_IN_PIN_CHNG)) 442 S_DUART_IN_PIN_CHNG))
443 wake_up_interruptible(&uport->info->delta_msr_wait); 443 wake_up_interruptible(&uport->state->delta_msr_wait);
444} 444}
445 445
446static irqreturn_t sbd_interrupt(int irq, void *dev_id) 446static irqreturn_t sbd_interrupt(int irq, void *dev_id)
diff --git a/drivers/serial/sc26xx.c b/drivers/serial/sc26xx.c
index e0be11ceaa25..75038ad2b242 100644
--- a/drivers/serial/sc26xx.c
+++ b/drivers/serial/sc26xx.c
@@ -140,8 +140,8 @@ static struct tty_struct *receive_chars(struct uart_port *port)
140 char flag; 140 char flag;
141 u8 status; 141 u8 status;
142 142
143 if (port->info != NULL) /* Unopened serial console */ 143 if (port->state != NULL) /* Unopened serial console */
144 tty = port->info->port.tty; 144 tty = port->state->port.tty;
145 145
146 while (limit-- > 0) { 146 while (limit-- > 0) {
147 status = READ_SC_PORT(port, SR); 147 status = READ_SC_PORT(port, SR);
@@ -190,10 +190,10 @@ static void transmit_chars(struct uart_port *port)
190{ 190{
191 struct circ_buf *xmit; 191 struct circ_buf *xmit;
192 192
193 if (!port->info) 193 if (!port->state)
194 return; 194 return;
195 195
196 xmit = &port->info->xmit; 196 xmit = &port->state->xmit;
197 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { 197 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
198 sc26xx_disable_irq(port, IMR_TXRDY); 198 sc26xx_disable_irq(port, IMR_TXRDY);
199 return; 199 return;
@@ -316,7 +316,7 @@ static void sc26xx_stop_tx(struct uart_port *port)
316/* port->lock held by caller. */ 316/* port->lock held by caller. */
317static void sc26xx_start_tx(struct uart_port *port) 317static void sc26xx_start_tx(struct uart_port *port)
318{ 318{
319 struct circ_buf *xmit = &port->info->xmit; 319 struct circ_buf *xmit = &port->state->xmit;
320 320
321 while (!uart_circ_empty(xmit)) { 321 while (!uart_circ_empty(xmit)) {
322 if (!(READ_SC_PORT(port, SR) & SR_TXRDY)) { 322 if (!(READ_SC_PORT(port, SR) & SR_TXRDY)) {
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index b0bb29d804ae..ea53b6f224b0 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -52,7 +52,7 @@ static struct lock_class_key port_lock_key;
52 52
53#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) 53#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
54 54
55#define uart_users(state) ((state)->count + (state)->info.port.blocked_open) 55#define uart_users(state) ((state)->count + (state)->port.blocked_open)
56 56
57#ifdef CONFIG_SERIAL_CORE_CONSOLE 57#ifdef CONFIG_SERIAL_CORE_CONSOLE
58#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line) 58#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line)
@@ -71,19 +71,19 @@ static void uart_change_pm(struct uart_state *state, int pm_state);
71 */ 71 */
72void uart_write_wakeup(struct uart_port *port) 72void uart_write_wakeup(struct uart_port *port)
73{ 73{
74 struct uart_info *info = port->info; 74 struct uart_state *state = port->state;
75 /* 75 /*
76 * This means you called this function _after_ the port was 76 * This means you called this function _after_ the port was
77 * closed. No cookie for you. 77 * closed. No cookie for you.
78 */ 78 */
79 BUG_ON(!info); 79 BUG_ON(!state);
80 tasklet_schedule(&info->tlet); 80 tasklet_schedule(&state->tlet);
81} 81}
82 82
83static void uart_stop(struct tty_struct *tty) 83static void uart_stop(struct tty_struct *tty)
84{ 84{
85 struct uart_state *state = tty->driver_data; 85 struct uart_state *state = tty->driver_data;
86 struct uart_port *port = state->port; 86 struct uart_port *port = state->uart_port;
87 unsigned long flags; 87 unsigned long flags;
88 88
89 spin_lock_irqsave(&port->lock, flags); 89 spin_lock_irqsave(&port->lock, flags);
@@ -94,9 +94,9 @@ static void uart_stop(struct tty_struct *tty)
94static void __uart_start(struct tty_struct *tty) 94static void __uart_start(struct tty_struct *tty)
95{ 95{
96 struct uart_state *state = tty->driver_data; 96 struct uart_state *state = tty->driver_data;
97 struct uart_port *port = state->port; 97 struct uart_port *port = state->uart_port;
98 98
99 if (!uart_circ_empty(&state->info.xmit) && state->info.xmit.buf && 99 if (!uart_circ_empty(&state->xmit) && state->xmit.buf &&
100 !tty->stopped && !tty->hw_stopped) 100 !tty->stopped && !tty->hw_stopped)
101 port->ops->start_tx(port); 101 port->ops->start_tx(port);
102} 102}
@@ -104,7 +104,7 @@ static void __uart_start(struct tty_struct *tty)
104static void uart_start(struct tty_struct *tty) 104static void uart_start(struct tty_struct *tty)
105{ 105{
106 struct uart_state *state = tty->driver_data; 106 struct uart_state *state = tty->driver_data;
107 struct uart_port *port = state->port; 107 struct uart_port *port = state->uart_port;
108 unsigned long flags; 108 unsigned long flags;
109 109
110 spin_lock_irqsave(&port->lock, flags); 110 spin_lock_irqsave(&port->lock, flags);
@@ -115,7 +115,7 @@ static void uart_start(struct tty_struct *tty)
115static void uart_tasklet_action(unsigned long data) 115static void uart_tasklet_action(unsigned long data)
116{ 116{
117 struct uart_state *state = (struct uart_state *)data; 117 struct uart_state *state = (struct uart_state *)data;
118 tty_wakeup(state->info.port.tty); 118 tty_wakeup(state->port.tty);
119} 119}
120 120
121static inline void 121static inline void
@@ -141,12 +141,11 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
141 */ 141 */
142static int uart_startup(struct uart_state *state, int init_hw) 142static int uart_startup(struct uart_state *state, int init_hw)
143{ 143{
144 struct uart_info *info = &state->info; 144 struct uart_port *port = state->uart_port;
145 struct uart_port *port = state->port;
146 unsigned long page; 145 unsigned long page;
147 int retval = 0; 146 int retval = 0;
148 147
149 if (info->flags & UIF_INITIALIZED) 148 if (state->flags & UIF_INITIALIZED)
150 return 0; 149 return 0;
151 150
152 /* 151 /*
@@ -154,7 +153,7 @@ static int uart_startup(struct uart_state *state, int init_hw)
154 * once we have successfully opened the port. Also set 153 * once we have successfully opened the port. Also set
155 * up the tty->alt_speed kludge 154 * up the tty->alt_speed kludge
156 */ 155 */
157 set_bit(TTY_IO_ERROR, &info->port.tty->flags); 156 set_bit(TTY_IO_ERROR, &state->port.tty->flags);
158 157
159 if (port->type == PORT_UNKNOWN) 158 if (port->type == PORT_UNKNOWN)
160 return 0; 159 return 0;
@@ -163,14 +162,14 @@ static int uart_startup(struct uart_state *state, int init_hw)
163 * Initialise and allocate the transmit and temporary 162 * Initialise and allocate the transmit and temporary
164 * buffer. 163 * buffer.
165 */ 164 */
166 if (!info->xmit.buf) { 165 if (!state->xmit.buf) {
167 /* This is protected by the per port mutex */ 166 /* This is protected by the per port mutex */
168 page = get_zeroed_page(GFP_KERNEL); 167 page = get_zeroed_page(GFP_KERNEL);
169 if (!page) 168 if (!page)
170 return -ENOMEM; 169 return -ENOMEM;
171 170
172 info->xmit.buf = (unsigned char *) page; 171 state->xmit.buf = (unsigned char *) page;
173 uart_circ_clear(&info->xmit); 172 uart_circ_clear(&state->xmit);
174 } 173 }
175 174
176 retval = port->ops->startup(port); 175 retval = port->ops->startup(port);
@@ -185,20 +184,20 @@ static int uart_startup(struct uart_state *state, int init_hw)
185 * Setup the RTS and DTR signals once the 184 * Setup the RTS and DTR signals once the
186 * port is open and ready to respond. 185 * port is open and ready to respond.
187 */ 186 */
188 if (info->port.tty->termios->c_cflag & CBAUD) 187 if (state->port.tty->termios->c_cflag & CBAUD)
189 uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); 188 uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);
190 } 189 }
191 190
192 if (info->flags & UIF_CTS_FLOW) { 191 if (state->flags & UIF_CTS_FLOW) {
193 spin_lock_irq(&port->lock); 192 spin_lock_irq(&port->lock);
194 if (!(port->ops->get_mctrl(port) & TIOCM_CTS)) 193 if (!(port->ops->get_mctrl(port) & TIOCM_CTS))
195 info->port.tty->hw_stopped = 1; 194 state->port.tty->hw_stopped = 1;
196 spin_unlock_irq(&port->lock); 195 spin_unlock_irq(&port->lock);
197 } 196 }
198 197
199 info->flags |= UIF_INITIALIZED; 198 state->flags |= UIF_INITIALIZED;
200 199
201 clear_bit(TTY_IO_ERROR, &info->port.tty->flags); 200 clear_bit(TTY_IO_ERROR, &state->port.tty->flags);
202 } 201 }
203 202
204 if (retval && capable(CAP_SYS_ADMIN)) 203 if (retval && capable(CAP_SYS_ADMIN))
@@ -214,9 +213,8 @@ static int uart_startup(struct uart_state *state, int init_hw)
214 */ 213 */
215static void uart_shutdown(struct uart_state *state) 214static void uart_shutdown(struct uart_state *state)
216{ 215{
217 struct uart_info *info = &state->info; 216 struct uart_port *port = state->uart_port;
218 struct uart_port *port = state->port; 217 struct tty_struct *tty = state->port.tty;
219 struct tty_struct *tty = info->port.tty;
220 218
221 /* 219 /*
222 * Set the TTY IO error marker 220 * Set the TTY IO error marker
@@ -224,8 +222,8 @@ static void uart_shutdown(struct uart_state *state)
224 if (tty) 222 if (tty)
225 set_bit(TTY_IO_ERROR, &tty->flags); 223 set_bit(TTY_IO_ERROR, &tty->flags);
226 224
227 if (info->flags & UIF_INITIALIZED) { 225 if (state->flags & UIF_INITIALIZED) {
228 info->flags &= ~UIF_INITIALIZED; 226 state->flags &= ~UIF_INITIALIZED;
229 227
230 /* 228 /*
231 * Turn off DTR and RTS early. 229 * Turn off DTR and RTS early.
@@ -240,7 +238,7 @@ static void uart_shutdown(struct uart_state *state)
240 * any outstanding file descriptors should be pointing at 238 * any outstanding file descriptors should be pointing at
241 * hung_up_tty_fops now. 239 * hung_up_tty_fops now.
242 */ 240 */
243 wake_up_interruptible(&info->delta_msr_wait); 241 wake_up_interruptible(&state->delta_msr_wait);
244 242
245 /* 243 /*
246 * Free the IRQ and disable the port. 244 * Free the IRQ and disable the port.
@@ -256,14 +254,14 @@ static void uart_shutdown(struct uart_state *state)
256 /* 254 /*
257 * kill off our tasklet 255 * kill off our tasklet
258 */ 256 */
259 tasklet_kill(&info->tlet); 257 tasklet_kill(&state->tlet);
260 258
261 /* 259 /*
262 * Free the transmit buffer page. 260 * Free the transmit buffer page.
263 */ 261 */
264 if (info->xmit.buf) { 262 if (state->xmit.buf) {
265 free_page((unsigned long)info->xmit.buf); 263 free_page((unsigned long)state->xmit.buf);
266 info->xmit.buf = NULL; 264 state->xmit.buf = NULL;
267 } 265 }
268} 266}
269 267
@@ -430,8 +428,8 @@ EXPORT_SYMBOL(uart_get_divisor);
430static void 428static void
431uart_change_speed(struct uart_state *state, struct ktermios *old_termios) 429uart_change_speed(struct uart_state *state, struct ktermios *old_termios)
432{ 430{
433 struct tty_struct *tty = state->info.port.tty; 431 struct tty_struct *tty = state->port.tty;
434 struct uart_port *port = state->port; 432 struct uart_port *port = state->uart_port;
435 struct ktermios *termios; 433 struct ktermios *termios;
436 434
437 /* 435 /*
@@ -447,14 +445,14 @@ uart_change_speed(struct uart_state *state, struct ktermios *old_termios)
447 * Set flags based on termios cflag 445 * Set flags based on termios cflag
448 */ 446 */
449 if (termios->c_cflag & CRTSCTS) 447 if (termios->c_cflag & CRTSCTS)
450 state->info.flags |= UIF_CTS_FLOW; 448 state->flags |= UIF_CTS_FLOW;
451 else 449 else
452 state->info.flags &= ~UIF_CTS_FLOW; 450 state->flags &= ~UIF_CTS_FLOW;
453 451
454 if (termios->c_cflag & CLOCAL) 452 if (termios->c_cflag & CLOCAL)
455 state->info.flags &= ~UIF_CHECK_CD; 453 state->flags &= ~UIF_CHECK_CD;
456 else 454 else
457 state->info.flags |= UIF_CHECK_CD; 455 state->flags |= UIF_CHECK_CD;
458 456
459 port->ops->set_termios(port, termios, old_termios); 457 port->ops->set_termios(port, termios, old_termios);
460} 458}
@@ -482,7 +480,7 @@ static int uart_put_char(struct tty_struct *tty, unsigned char ch)
482{ 480{
483 struct uart_state *state = tty->driver_data; 481 struct uart_state *state = tty->driver_data;
484 482
485 return __uart_put_char(state->port, &state->info.xmit, ch); 483 return __uart_put_char(state->uart_port, &state->xmit, ch);
486} 484}
487 485
488static void uart_flush_chars(struct tty_struct *tty) 486static void uart_flush_chars(struct tty_struct *tty)
@@ -508,8 +506,8 @@ uart_write(struct tty_struct *tty, const unsigned char *buf, int count)
508 return -EL3HLT; 506 return -EL3HLT;
509 } 507 }
510 508
511 port = state->port; 509 port = state->uart_port;
512 circ = &state->info.xmit; 510 circ = &state->xmit;
513 511
514 if (!circ->buf) 512 if (!circ->buf)
515 return 0; 513 return 0;
@@ -539,9 +537,9 @@ static int uart_write_room(struct tty_struct *tty)
539 unsigned long flags; 537 unsigned long flags;
540 int ret; 538 int ret;
541 539
542 spin_lock_irqsave(&state->port->lock, flags); 540 spin_lock_irqsave(&state->uart_port->lock, flags);
543 ret = uart_circ_chars_free(&state->info.xmit); 541 ret = uart_circ_chars_free(&state->xmit);
544 spin_unlock_irqrestore(&state->port->lock, flags); 542 spin_unlock_irqrestore(&state->uart_port->lock, flags);
545 return ret; 543 return ret;
546} 544}
547 545
@@ -551,9 +549,9 @@ static int uart_chars_in_buffer(struct tty_struct *tty)
551 unsigned long flags; 549 unsigned long flags;
552 int ret; 550 int ret;
553 551
554 spin_lock_irqsave(&state->port->lock, flags); 552 spin_lock_irqsave(&state->uart_port->lock, flags);
555 ret = uart_circ_chars_pending(&state->info.xmit); 553 ret = uart_circ_chars_pending(&state->xmit);
556 spin_unlock_irqrestore(&state->port->lock, flags); 554 spin_unlock_irqrestore(&state->uart_port->lock, flags);
557 return ret; 555 return ret;
558} 556}
559 557
@@ -572,11 +570,11 @@ static void uart_flush_buffer(struct tty_struct *tty)
572 return; 570 return;
573 } 571 }
574 572
575 port = state->port; 573 port = state->uart_port;
576 pr_debug("uart_flush_buffer(%d) called\n", tty->index); 574 pr_debug("uart_flush_buffer(%d) called\n", tty->index);
577 575
578 spin_lock_irqsave(&port->lock, flags); 576 spin_lock_irqsave(&port->lock, flags);
579 uart_circ_clear(&state->info.xmit); 577 uart_circ_clear(&state->xmit);
580 if (port->ops->flush_buffer) 578 if (port->ops->flush_buffer)
581 port->ops->flush_buffer(port); 579 port->ops->flush_buffer(port);
582 spin_unlock_irqrestore(&port->lock, flags); 580 spin_unlock_irqrestore(&port->lock, flags);
@@ -590,7 +588,7 @@ static void uart_flush_buffer(struct tty_struct *tty)
590static void uart_send_xchar(struct tty_struct *tty, char ch) 588static void uart_send_xchar(struct tty_struct *tty, char ch)
591{ 589{
592 struct uart_state *state = tty->driver_data; 590 struct uart_state *state = tty->driver_data;
593 struct uart_port *port = state->port; 591 struct uart_port *port = state->uart_port;
594 unsigned long flags; 592 unsigned long flags;
595 593
596 if (port->ops->send_xchar) 594 if (port->ops->send_xchar)
@@ -613,13 +611,13 @@ static void uart_throttle(struct tty_struct *tty)
613 uart_send_xchar(tty, STOP_CHAR(tty)); 611 uart_send_xchar(tty, STOP_CHAR(tty));
614 612
615 if (tty->termios->c_cflag & CRTSCTS) 613 if (tty->termios->c_cflag & CRTSCTS)
616 uart_clear_mctrl(state->port, TIOCM_RTS); 614 uart_clear_mctrl(state->uart_port, TIOCM_RTS);
617} 615}
618 616
619static void uart_unthrottle(struct tty_struct *tty) 617static void uart_unthrottle(struct tty_struct *tty)
620{ 618{
621 struct uart_state *state = tty->driver_data; 619 struct uart_state *state = tty->driver_data;
622 struct uart_port *port = state->port; 620 struct uart_port *port = state->uart_port;
623 621
624 if (I_IXOFF(tty)) { 622 if (I_IXOFF(tty)) {
625 if (port->x_char) 623 if (port->x_char)
@@ -635,7 +633,7 @@ static void uart_unthrottle(struct tty_struct *tty)
635static int uart_get_info(struct uart_state *state, 633static int uart_get_info(struct uart_state *state,
636 struct serial_struct __user *retinfo) 634 struct serial_struct __user *retinfo)
637{ 635{
638 struct uart_port *port = state->port; 636 struct uart_port *port = state->uart_port;
639 struct serial_struct tmp; 637 struct serial_struct tmp;
640 638
641 memset(&tmp, 0, sizeof(tmp)); 639 memset(&tmp, 0, sizeof(tmp));
@@ -674,7 +672,7 @@ static int uart_set_info(struct uart_state *state,
674 struct serial_struct __user *newinfo) 672 struct serial_struct __user *newinfo)
675{ 673{
676 struct serial_struct new_serial; 674 struct serial_struct new_serial;
677 struct uart_port *port = state->port; 675 struct uart_port *port = state->uart_port;
678 unsigned long new_port; 676 unsigned long new_port;
679 unsigned int change_irq, change_port, closing_wait; 677 unsigned int change_irq, change_port, closing_wait;
680 unsigned int old_custom_divisor, close_delay; 678 unsigned int old_custom_divisor, close_delay;
@@ -840,15 +838,15 @@ static int uart_set_info(struct uart_state *state,
840 state->closing_wait = closing_wait; 838 state->closing_wait = closing_wait;
841 if (new_serial.xmit_fifo_size) 839 if (new_serial.xmit_fifo_size)
842 port->fifosize = new_serial.xmit_fifo_size; 840 port->fifosize = new_serial.xmit_fifo_size;
843 if (state->info.port.tty) 841 if (state->port.tty)
844 state->info.port.tty->low_latency = 842 state->port.tty->low_latency =
845 (port->flags & UPF_LOW_LATENCY) ? 1 : 0; 843 (port->flags & UPF_LOW_LATENCY) ? 1 : 0;
846 844
847 check_and_exit: 845 check_and_exit:
848 retval = 0; 846 retval = 0;
849 if (port->type == PORT_UNKNOWN) 847 if (port->type == PORT_UNKNOWN)
850 goto exit; 848 goto exit;
851 if (state->info.flags & UIF_INITIALIZED) { 849 if (state->flags & UIF_INITIALIZED) {
852 if (((old_flags ^ port->flags) & UPF_SPD_MASK) || 850 if (((old_flags ^ port->flags) & UPF_SPD_MASK) ||
853 old_custom_divisor != port->custom_divisor) { 851 old_custom_divisor != port->custom_divisor) {
854 /* 852 /*
@@ -861,7 +859,7 @@ static int uart_set_info(struct uart_state *state,
861 printk(KERN_NOTICE 859 printk(KERN_NOTICE
862 "%s sets custom speed on %s. This " 860 "%s sets custom speed on %s. This "
863 "is deprecated.\n", current->comm, 861 "is deprecated.\n", current->comm,
864 tty_name(state->info.port.tty, buf)); 862 tty_name(state->port.tty, buf));
865 } 863 }
866 uart_change_speed(state, NULL); 864 uart_change_speed(state, NULL);
867 } 865 }
@@ -880,7 +878,7 @@ static int uart_set_info(struct uart_state *state,
880static int uart_get_lsr_info(struct uart_state *state, 878static int uart_get_lsr_info(struct uart_state *state,
881 unsigned int __user *value) 879 unsigned int __user *value)
882{ 880{
883 struct uart_port *port = state->port; 881 struct uart_port *port = state->uart_port;
884 unsigned int result; 882 unsigned int result;
885 883
886 result = port->ops->tx_empty(port); 884 result = port->ops->tx_empty(port);
@@ -892,8 +890,8 @@ static int uart_get_lsr_info(struct uart_state *state,
892 * interrupt happens). 890 * interrupt happens).
893 */ 891 */
894 if (port->x_char || 892 if (port->x_char ||
895 ((uart_circ_chars_pending(&state->info.xmit) > 0) && 893 ((uart_circ_chars_pending(&state->xmit) > 0) &&
896 !state->info.port.tty->stopped && !state->info.port.tty->hw_stopped)) 894 !state->port.tty->stopped && !state->port.tty->hw_stopped))
897 result &= ~TIOCSER_TEMT; 895 result &= ~TIOCSER_TEMT;
898 896
899 return put_user(result, value); 897 return put_user(result, value);
@@ -902,7 +900,7 @@ static int uart_get_lsr_info(struct uart_state *state,
902static int uart_tiocmget(struct tty_struct *tty, struct file *file) 900static int uart_tiocmget(struct tty_struct *tty, struct file *file)
903{ 901{
904 struct uart_state *state = tty->driver_data; 902 struct uart_state *state = tty->driver_data;
905 struct uart_port *port = state->port; 903 struct uart_port *port = state->uart_port;
906 int result = -EIO; 904 int result = -EIO;
907 905
908 mutex_lock(&state->mutex); 906 mutex_lock(&state->mutex);
@@ -924,7 +922,7 @@ uart_tiocmset(struct tty_struct *tty, struct file *file,
924 unsigned int set, unsigned int clear) 922 unsigned int set, unsigned int clear)
925{ 923{
926 struct uart_state *state = tty->driver_data; 924 struct uart_state *state = tty->driver_data;
927 struct uart_port *port = state->port; 925 struct uart_port *port = state->uart_port;
928 int ret = -EIO; 926 int ret = -EIO;
929 927
930 mutex_lock(&state->mutex); 928 mutex_lock(&state->mutex);
@@ -940,7 +938,7 @@ uart_tiocmset(struct tty_struct *tty, struct file *file,
940static int uart_break_ctl(struct tty_struct *tty, int break_state) 938static int uart_break_ctl(struct tty_struct *tty, int break_state)
941{ 939{
942 struct uart_state *state = tty->driver_data; 940 struct uart_state *state = tty->driver_data;
943 struct uart_port *port = state->port; 941 struct uart_port *port = state->uart_port;
944 942
945 mutex_lock(&state->mutex); 943 mutex_lock(&state->mutex);
946 944
@@ -953,7 +951,7 @@ static int uart_break_ctl(struct tty_struct *tty, int break_state)
953 951
954static int uart_do_autoconfig(struct uart_state *state) 952static int uart_do_autoconfig(struct uart_state *state)
955{ 953{
956 struct uart_port *port = state->port; 954 struct uart_port *port = state->uart_port;
957 int flags, ret; 955 int flags, ret;
958 956
959 if (!capable(CAP_SYS_ADMIN)) 957 if (!capable(CAP_SYS_ADMIN))
@@ -1003,7 +1001,7 @@ static int uart_do_autoconfig(struct uart_state *state)
1003static int 1001static int
1004uart_wait_modem_status(struct uart_state *state, unsigned long arg) 1002uart_wait_modem_status(struct uart_state *state, unsigned long arg)
1005{ 1003{
1006 struct uart_port *port = state->port; 1004 struct uart_port *port = state->uart_port;
1007 DECLARE_WAITQUEUE(wait, current); 1005 DECLARE_WAITQUEUE(wait, current);
1008 struct uart_icount cprev, cnow; 1006 struct uart_icount cprev, cnow;
1009 int ret; 1007 int ret;
@@ -1020,7 +1018,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
1020 port->ops->enable_ms(port); 1018 port->ops->enable_ms(port);
1021 spin_unlock_irq(&port->lock); 1019 spin_unlock_irq(&port->lock);
1022 1020
1023 add_wait_queue(&state->info.delta_msr_wait, &wait); 1021 add_wait_queue(&state->delta_msr_wait, &wait);
1024 for (;;) { 1022 for (;;) {
1025 spin_lock_irq(&port->lock); 1023 spin_lock_irq(&port->lock);
1026 memcpy(&cnow, &port->icount, sizeof(struct uart_icount)); 1024 memcpy(&cnow, &port->icount, sizeof(struct uart_icount));
@@ -1048,7 +1046,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
1048 } 1046 }
1049 1047
1050 current->state = TASK_RUNNING; 1048 current->state = TASK_RUNNING;
1051 remove_wait_queue(&state->info.delta_msr_wait, &wait); 1049 remove_wait_queue(&state->delta_msr_wait, &wait);
1052 1050
1053 return ret; 1051 return ret;
1054} 1052}
@@ -1064,7 +1062,7 @@ static int uart_get_count(struct uart_state *state,
1064{ 1062{
1065 struct serial_icounter_struct icount; 1063 struct serial_icounter_struct icount;
1066 struct uart_icount cnow; 1064 struct uart_icount cnow;
1067 struct uart_port *port = state->port; 1065 struct uart_port *port = state->uart_port;
1068 1066
1069 spin_lock_irq(&port->lock); 1067 spin_lock_irq(&port->lock);
1070 memcpy(&cnow, &port->icount, sizeof(struct uart_icount)); 1068 memcpy(&cnow, &port->icount, sizeof(struct uart_icount));
@@ -1160,7 +1158,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1160 break; 1158 break;
1161 1159
1162 default: { 1160 default: {
1163 struct uart_port *port = state->port; 1161 struct uart_port *port = state->uart_port;
1164 if (port->ops->ioctl) 1162 if (port->ops->ioctl)
1165 ret = port->ops->ioctl(port, cmd, arg); 1163 ret = port->ops->ioctl(port, cmd, arg);
1166 break; 1164 break;
@@ -1175,7 +1173,7 @@ out:
1175static void uart_set_ldisc(struct tty_struct *tty) 1173static void uart_set_ldisc(struct tty_struct *tty)
1176{ 1174{
1177 struct uart_state *state = tty->driver_data; 1175 struct uart_state *state = tty->driver_data;
1178 struct uart_port *port = state->port; 1176 struct uart_port *port = state->uart_port;
1179 1177
1180 if (port->ops->set_ldisc) 1178 if (port->ops->set_ldisc)
1181 port->ops->set_ldisc(port); 1179 port->ops->set_ldisc(port);
@@ -1207,7 +1205,7 @@ static void uart_set_termios(struct tty_struct *tty,
1207 1205
1208 /* Handle transition to B0 status */ 1206 /* Handle transition to B0 status */
1209 if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) 1207 if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD))
1210 uart_clear_mctrl(state->port, TIOCM_RTS | TIOCM_DTR); 1208 uart_clear_mctrl(state->uart_port, TIOCM_RTS | TIOCM_DTR);
1211 1209
1212 /* Handle transition away from B0 status */ 1210 /* Handle transition away from B0 status */
1213 if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { 1211 if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
@@ -1215,25 +1213,25 @@ static void uart_set_termios(struct tty_struct *tty,
1215 if (!(cflag & CRTSCTS) || 1213 if (!(cflag & CRTSCTS) ||
1216 !test_bit(TTY_THROTTLED, &tty->flags)) 1214 !test_bit(TTY_THROTTLED, &tty->flags))
1217 mask |= TIOCM_RTS; 1215 mask |= TIOCM_RTS;
1218 uart_set_mctrl(state->port, mask); 1216 uart_set_mctrl(state->uart_port, mask);
1219 } 1217 }
1220 1218
1221 /* Handle turning off CRTSCTS */ 1219 /* Handle turning off CRTSCTS */
1222 if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) { 1220 if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) {
1223 spin_lock_irqsave(&state->port->lock, flags); 1221 spin_lock_irqsave(&state->uart_port->lock, flags);
1224 tty->hw_stopped = 0; 1222 tty->hw_stopped = 0;
1225 __uart_start(tty); 1223 __uart_start(tty);
1226 spin_unlock_irqrestore(&state->port->lock, flags); 1224 spin_unlock_irqrestore(&state->uart_port->lock, flags);
1227 } 1225 }
1228 1226
1229 /* Handle turning on CRTSCTS */ 1227 /* Handle turning on CRTSCTS */
1230 if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) { 1228 if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) {
1231 spin_lock_irqsave(&state->port->lock, flags); 1229 spin_lock_irqsave(&state->uart_port->lock, flags);
1232 if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) { 1230 if (!(state->uart_port->ops->get_mctrl(state->uart_port) & TIOCM_CTS)) {
1233 tty->hw_stopped = 1; 1231 tty->hw_stopped = 1;
1234 state->port->ops->stop_tx(state->port); 1232 state->uart_port->ops->stop_tx(state->uart_port);
1235 } 1233 }
1236 spin_unlock_irqrestore(&state->port->lock, flags); 1234 spin_unlock_irqrestore(&state->uart_port->lock, flags);
1237 } 1235 }
1238#if 0 1236#if 0
1239 /* 1237 /*
@@ -1244,7 +1242,7 @@ static void uart_set_termios(struct tty_struct *tty,
1244 */ 1242 */
1245 if (!(old_termios->c_cflag & CLOCAL) && 1243 if (!(old_termios->c_cflag & CLOCAL) &&
1246 (tty->termios->c_cflag & CLOCAL)) 1244 (tty->termios->c_cflag & CLOCAL))
1247 wake_up_interruptible(&info->port.open_wait); 1245 wake_up_interruptible(&state->uart_port.open_wait);
1248#endif 1246#endif
1249} 1247}
1250 1248
@@ -1260,10 +1258,10 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1260 1258
1261 BUG_ON(!kernel_locked()); 1259 BUG_ON(!kernel_locked());
1262 1260
1263 if (!state || !state->port) 1261 if (!state || !state->uart_port)
1264 return; 1262 return;
1265 1263
1266 port = state->port; 1264 port = state->uart_port;
1267 1265
1268 pr_debug("uart_close(%d) called\n", port->line); 1266 pr_debug("uart_close(%d) called\n", port->line);
1269 1267
@@ -1306,7 +1304,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1306 * At this point, we stop accepting input. To do this, we 1304 * At this point, we stop accepting input. To do this, we
1307 * disable the receive line status interrupts. 1305 * disable the receive line status interrupts.
1308 */ 1306 */
1309 if (state->info.flags & UIF_INITIALIZED) { 1307 if (state->flags & UIF_INITIALIZED) {
1310 unsigned long flags; 1308 unsigned long flags;
1311 spin_lock_irqsave(&port->lock, flags); 1309 spin_lock_irqsave(&port->lock, flags);
1312 port->ops->stop_rx(port); 1310 port->ops->stop_rx(port);
@@ -1325,9 +1323,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1325 tty_ldisc_flush(tty); 1323 tty_ldisc_flush(tty);
1326 1324
1327 tty->closing = 0; 1325 tty->closing = 0;
1328 state->info.port.tty = NULL; 1326 state->port.tty = NULL;
1329 1327
1330 if (state->info.port.blocked_open) { 1328 if (state->port.blocked_open) {
1331 if (state->close_delay) 1329 if (state->close_delay)
1332 msleep_interruptible(state->close_delay); 1330 msleep_interruptible(state->close_delay);
1333 } else if (!uart_console(port)) { 1331 } else if (!uart_console(port)) {
@@ -1337,8 +1335,8 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1337 /* 1335 /*
1338 * Wake up anyone trying to open this port. 1336 * Wake up anyone trying to open this port.
1339 */ 1337 */
1340 state->info.flags &= ~UIF_NORMAL_ACTIVE; 1338 state->flags &= ~UIF_NORMAL_ACTIVE;
1341 wake_up_interruptible(&state->info.port.open_wait); 1339 wake_up_interruptible(&state->port.open_wait);
1342 1340
1343 done: 1341 done:
1344 mutex_unlock(&state->mutex); 1342 mutex_unlock(&state->mutex);
@@ -1347,7 +1345,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1347static void uart_wait_until_sent(struct tty_struct *tty, int timeout) 1345static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
1348{ 1346{
1349 struct uart_state *state = tty->driver_data; 1347 struct uart_state *state = tty->driver_data;
1350 struct uart_port *port = state->port; 1348 struct uart_port *port = state->uart_port;
1351 unsigned long char_time, expire; 1349 unsigned long char_time, expire;
1352 1350
1353 if (port->type == PORT_UNKNOWN || port->fifosize == 0) 1351 if (port->type == PORT_UNKNOWN || port->fifosize == 0)
@@ -1412,20 +1410,19 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
1412static void uart_hangup(struct tty_struct *tty) 1410static void uart_hangup(struct tty_struct *tty)
1413{ 1411{
1414 struct uart_state *state = tty->driver_data; 1412 struct uart_state *state = tty->driver_data;
1415 struct uart_info *info = &state->info;
1416 1413
1417 BUG_ON(!kernel_locked()); 1414 BUG_ON(!kernel_locked());
1418 pr_debug("uart_hangup(%d)\n", state->port->line); 1415 pr_debug("uart_hangup(%d)\n", state->uart_port->line);
1419 1416
1420 mutex_lock(&state->mutex); 1417 mutex_lock(&state->mutex);
1421 if (info->flags & UIF_NORMAL_ACTIVE) { 1418 if (state->flags & UIF_NORMAL_ACTIVE) {
1422 uart_flush_buffer(tty); 1419 uart_flush_buffer(tty);
1423 uart_shutdown(state); 1420 uart_shutdown(state);
1424 state->count = 0; 1421 state->count = 0;
1425 info->flags &= ~UIF_NORMAL_ACTIVE; 1422 state->flags &= ~UIF_NORMAL_ACTIVE;
1426 info->port.tty = NULL; 1423 state->port.tty = NULL;
1427 wake_up_interruptible(&info->port.open_wait); 1424 wake_up_interruptible(&state->port.open_wait);
1428 wake_up_interruptible(&info->delta_msr_wait); 1425 wake_up_interruptible(&state->delta_msr_wait);
1429 } 1426 }
1430 mutex_unlock(&state->mutex); 1427 mutex_unlock(&state->mutex);
1431} 1428}
@@ -1438,8 +1435,8 @@ static void uart_hangup(struct tty_struct *tty)
1438 */ 1435 */
1439static void uart_update_termios(struct uart_state *state) 1436static void uart_update_termios(struct uart_state *state)
1440{ 1437{
1441 struct tty_struct *tty = state->info.port.tty; 1438 struct tty_struct *tty = state->port.tty;
1442 struct uart_port *port = state->port; 1439 struct uart_port *port = state->uart_port;
1443 1440
1444 if (uart_console(port) && port->cons->cflag) { 1441 if (uart_console(port) && port->cons->cflag) {
1445 tty->termios->c_cflag = port->cons->cflag; 1442 tty->termios->c_cflag = port->cons->cflag;
@@ -1473,27 +1470,26 @@ static int
1473uart_block_til_ready(struct file *filp, struct uart_state *state) 1470uart_block_til_ready(struct file *filp, struct uart_state *state)
1474{ 1471{
1475 DECLARE_WAITQUEUE(wait, current); 1472 DECLARE_WAITQUEUE(wait, current);
1476 struct uart_info *info = &state->info; 1473 struct uart_port *port = state->uart_port;
1477 struct uart_port *port = state->port;
1478 unsigned int mctrl; 1474 unsigned int mctrl;
1479 1475
1480 info->port.blocked_open++; 1476 state->port.blocked_open++;
1481 state->count--; 1477 state->count--;
1482 1478
1483 add_wait_queue(&info->port.open_wait, &wait); 1479 add_wait_queue(&state->port.open_wait, &wait);
1484 while (1) { 1480 while (1) {
1485 set_current_state(TASK_INTERRUPTIBLE); 1481 set_current_state(TASK_INTERRUPTIBLE);
1486 1482
1487 /* 1483 /*
1488 * If we have been hung up, tell userspace/restart open. 1484 * If we have been hung up, tell userspace/restart open.
1489 */ 1485 */
1490 if (tty_hung_up_p(filp) || info->port.tty == NULL) 1486 if (tty_hung_up_p(filp) || state->port.tty == NULL)
1491 break; 1487 break;
1492 1488
1493 /* 1489 /*
1494 * If the port has been closed, tell userspace/restart open. 1490 * If the port has been closed, tell userspace/restart open.
1495 */ 1491 */
1496 if (!(info->flags & UIF_INITIALIZED)) 1492 if (!(state->flags & UIF_INITIALIZED))
1497 break; 1493 break;
1498 1494
1499 /* 1495 /*
@@ -1506,8 +1502,8 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1506 * have set TTY_IO_ERROR for a non-existant port. 1502 * have set TTY_IO_ERROR for a non-existant port.
1507 */ 1503 */
1508 if ((filp->f_flags & O_NONBLOCK) || 1504 if ((filp->f_flags & O_NONBLOCK) ||
1509 (info->port.tty->termios->c_cflag & CLOCAL) || 1505 (state->port.tty->termios->c_cflag & CLOCAL) ||
1510 (info->port.tty->flags & (1 << TTY_IO_ERROR))) 1506 (state->port.tty->flags & (1 << TTY_IO_ERROR)))
1511 break; 1507 break;
1512 1508
1513 /* 1509 /*
@@ -1515,7 +1511,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1515 * not set RTS here - we want to make sure we catch 1511 * not set RTS here - we want to make sure we catch
1516 * the data from the modem. 1512 * the data from the modem.
1517 */ 1513 */
1518 if (info->port.tty->termios->c_cflag & CBAUD) 1514 if (state->port.tty->termios->c_cflag & CBAUD)
1519 uart_set_mctrl(port, TIOCM_DTR); 1515 uart_set_mctrl(port, TIOCM_DTR);
1520 1516
1521 /* 1517 /*
@@ -1537,15 +1533,15 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1537 break; 1533 break;
1538 } 1534 }
1539 set_current_state(TASK_RUNNING); 1535 set_current_state(TASK_RUNNING);
1540 remove_wait_queue(&info->port.open_wait, &wait); 1536 remove_wait_queue(&state->port.open_wait, &wait);
1541 1537
1542 state->count++; 1538 state->count++;
1543 info->port.blocked_open--; 1539 state->port.blocked_open--;
1544 1540
1545 if (signal_pending(current)) 1541 if (signal_pending(current))
1546 return -ERESTARTSYS; 1542 return -ERESTARTSYS;
1547 1543
1548 if (!info->port.tty || tty_hung_up_p(filp)) 1544 if (!state->port.tty || tty_hung_up_p(filp))
1549 return -EAGAIN; 1545 return -EAGAIN;
1550 1546
1551 return 0; 1547 return 0;
@@ -1563,7 +1559,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
1563 } 1559 }
1564 1560
1565 state->count++; 1561 state->count++;
1566 if (!state->port || state->port->flags & UPF_DEAD) { 1562 if (!state->uart_port || state->uart_port->flags & UPF_DEAD) {
1567 ret = -ENXIO; 1563 ret = -ENXIO;
1568 goto err_unlock; 1564 goto err_unlock;
1569 } 1565 }
@@ -1606,10 +1602,11 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1606 1602
1607 /* 1603 /*
1608 * We take the semaphore inside uart_get to guarantee that we won't 1604 * We take the semaphore inside uart_get to guarantee that we won't
1609 * be re-entered while allocating the info structure, or while we 1605 * be re-entered while allocating the state structure, or while we
1610 * request any IRQs that the driver may need. This also has the nice 1606 * request any IRQs that the driver may need. This also has the nice
1611 * side-effect that it delays the action of uart_hangup, so we can 1607 * side-effect that it delays the action of uart_hangup, so we can
1612 * guarantee that info->port.tty will always contain something reasonable. 1608 * guarantee that state->port.tty will always contain something
1609 * reasonable.
1613 */ 1610 */
1614 state = uart_get(drv, line); 1611 state = uart_get(drv, line);
1615 if (IS_ERR(state)) { 1612 if (IS_ERR(state)) {
@@ -1623,10 +1620,10 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1623 * Any failures from here onwards should not touch the count. 1620 * Any failures from here onwards should not touch the count.
1624 */ 1621 */
1625 tty->driver_data = state; 1622 tty->driver_data = state;
1626 state->port->info = &state->info; 1623 state->uart_port->state = state;
1627 tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0; 1624 tty->low_latency = (state->uart_port->flags & UPF_LOW_LATENCY) ? 1 : 0;
1628 tty->alt_speed = 0; 1625 tty->alt_speed = 0;
1629 state->info.port.tty = tty; 1626 state->port.tty = tty;
1630 1627
1631 /* 1628 /*
1632 * If the port is in the middle of closing, bail out now. 1629 * If the port is in the middle of closing, bail out now.
@@ -1659,8 +1656,8 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1659 /* 1656 /*
1660 * If this is the first open to succeed, adjust things to suit. 1657 * If this is the first open to succeed, adjust things to suit.
1661 */ 1658 */
1662 if (retval == 0 && !(state->info.flags & UIF_NORMAL_ACTIVE)) { 1659 if (retval == 0 && !(state->flags & UIF_NORMAL_ACTIVE)) {
1663 state->info.flags |= UIF_NORMAL_ACTIVE; 1660 state->flags |= UIF_NORMAL_ACTIVE;
1664 1661
1665 uart_update_termios(state); 1662 uart_update_termios(state);
1666 } 1663 }
@@ -1688,7 +1685,7 @@ static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
1688{ 1685{
1689 struct uart_state *state = drv->state + i; 1686 struct uart_state *state = drv->state + i;
1690 int pm_state; 1687 int pm_state;
1691 struct uart_port *port = state->port; 1688 struct uart_port *port = state->uart_port;
1692 char stat_buf[32]; 1689 char stat_buf[32];
1693 unsigned int status; 1690 unsigned int status;
1694 int mmio; 1691 int mmio;
@@ -1958,7 +1955,7 @@ EXPORT_SYMBOL_GPL(uart_set_options);
1958 1955
1959static void uart_change_pm(struct uart_state *state, int pm_state) 1956static void uart_change_pm(struct uart_state *state, int pm_state)
1960{ 1957{
1961 struct uart_port *port = state->port; 1958 struct uart_port *port = state->uart_port;
1962 1959
1963 if (state->pm_state != pm_state) { 1960 if (state->pm_state != pm_state) {
1964 if (port->ops->pm) 1961 if (port->ops->pm)
@@ -2005,11 +2002,11 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
2005 } 2002 }
2006 port->suspended = 1; 2003 port->suspended = 1;
2007 2004
2008 if (state->info.flags & UIF_INITIALIZED) { 2005 if (state->flags & UIF_INITIALIZED) {
2009 const struct uart_ops *ops = port->ops; 2006 const struct uart_ops *ops = port->ops;
2010 int tries; 2007 int tries;
2011 2008
2012 state->info.flags = (state->info.flags & ~UIF_INITIALIZED) 2009 state->flags = (state->flags & ~UIF_INITIALIZED)
2013 | UIF_SUSPENDED; 2010 | UIF_SUSPENDED;
2014 2011
2015 spin_lock_irq(&port->lock); 2012 spin_lock_irq(&port->lock);
@@ -2084,15 +2081,15 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2084 /* 2081 /*
2085 * If that's unset, use the tty termios setting. 2082 * If that's unset, use the tty termios setting.
2086 */ 2083 */
2087 if (state->info.port.tty && termios.c_cflag == 0) 2084 if (state->port.tty && termios.c_cflag == 0)
2088 termios = *state->info.port.tty->termios; 2085 termios = *state->port.tty->termios;
2089 2086
2090 uart_change_pm(state, 0); 2087 uart_change_pm(state, 0);
2091 port->ops->set_termios(port, &termios, NULL); 2088 port->ops->set_termios(port, &termios, NULL);
2092 console_start(port->cons); 2089 console_start(port->cons);
2093 } 2090 }
2094 2091
2095 if (state->info.flags & UIF_SUSPENDED) { 2092 if (state->flags & UIF_SUSPENDED) {
2096 const struct uart_ops *ops = port->ops; 2093 const struct uart_ops *ops = port->ops;
2097 int ret; 2094 int ret;
2098 2095
@@ -2107,7 +2104,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2107 ops->set_mctrl(port, port->mctrl); 2104 ops->set_mctrl(port, port->mctrl);
2108 ops->start_tx(port); 2105 ops->start_tx(port);
2109 spin_unlock_irq(&port->lock); 2106 spin_unlock_irq(&port->lock);
2110 state->info.flags |= UIF_INITIALIZED; 2107 state->flags |= UIF_INITIALIZED;
2111 } else { 2108 } else {
2112 /* 2109 /*
2113 * Failed to resume - maybe hardware went away? 2110 * Failed to resume - maybe hardware went away?
@@ -2117,7 +2114,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2117 uart_shutdown(state); 2114 uart_shutdown(state);
2118 } 2115 }
2119 2116
2120 state->info.flags &= ~UIF_SUSPENDED; 2117 state->flags &= ~UIF_SUSPENDED;
2121 } 2118 }
2122 2119
2123 mutex_unlock(&state->mutex); 2120 mutex_unlock(&state->mutex);
@@ -2232,10 +2229,10 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options)
2232 int parity = 'n'; 2229 int parity = 'n';
2233 int flow = 'n'; 2230 int flow = 'n';
2234 2231
2235 if (!state || !state->port) 2232 if (!state || !state->uart_port)
2236 return -1; 2233 return -1;
2237 2234
2238 port = state->port; 2235 port = state->uart_port;
2239 if (!(port->ops->poll_get_char && port->ops->poll_put_char)) 2236 if (!(port->ops->poll_get_char && port->ops->poll_put_char))
2240 return -1; 2237 return -1;
2241 2238
@@ -2253,10 +2250,10 @@ static int uart_poll_get_char(struct tty_driver *driver, int line)
2253 struct uart_state *state = drv->state + line; 2250 struct uart_state *state = drv->state + line;
2254 struct uart_port *port; 2251 struct uart_port *port;
2255 2252
2256 if (!state || !state->port) 2253 if (!state || !state->uart_port)
2257 return -1; 2254 return -1;
2258 2255
2259 port = state->port; 2256 port = state->uart_port;
2260 return port->ops->poll_get_char(port); 2257 return port->ops->poll_get_char(port);
2261} 2258}
2262 2259
@@ -2266,10 +2263,10 @@ static void uart_poll_put_char(struct tty_driver *driver, int line, char ch)
2266 struct uart_state *state = drv->state + line; 2263 struct uart_state *state = drv->state + line;
2267 struct uart_port *port; 2264 struct uart_port *port;
2268 2265
2269 if (!state || !state->port) 2266 if (!state || !state->uart_port)
2270 return; 2267 return;
2271 2268
2272 port = state->port; 2269 port = state->uart_port;
2273 port->ops->poll_put_char(port, ch); 2270 port->ops->poll_put_char(port, ch);
2274} 2271}
2275#endif 2272#endif
@@ -2365,9 +2362,9 @@ int uart_register_driver(struct uart_driver *drv)
2365 state->closing_wait = 30000; /* 30 seconds */ 2362 state->closing_wait = 30000; /* 30 seconds */
2366 mutex_init(&state->mutex); 2363 mutex_init(&state->mutex);
2367 2364
2368 tty_port_init(&state->info.port); 2365 tty_port_init(&state->port);
2369 init_waitqueue_head(&state->info.delta_msr_wait); 2366 init_waitqueue_head(&state->delta_msr_wait);
2370 tasklet_init(&state->info.tlet, uart_tasklet_action, 2367 tasklet_init(&state->tlet, uart_tasklet_action,
2371 (unsigned long)state); 2368 (unsigned long)state);
2372 } 2369 }
2373 2370
@@ -2430,16 +2427,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
2430 2427
2431 mutex_lock(&port_mutex); 2428 mutex_lock(&port_mutex);
2432 mutex_lock(&state->mutex); 2429 mutex_lock(&state->mutex);
2433 if (state->port) { 2430 if (state->uart_port) {
2434 ret = -EINVAL; 2431 ret = -EINVAL;
2435 goto out; 2432 goto out;
2436 } 2433 }
2437 2434
2438 state->port = port; 2435 state->uart_port = port;
2439 state->pm_state = -1; 2436 state->pm_state = -1;
2440 2437
2441 port->cons = drv->cons; 2438 port->cons = drv->cons;
2442 port->info = &state->info; 2439 port->state = state;
2443 2440
2444 /* 2441 /*
2445 * If this port is a console, then the spinlock is already 2442 * If this port is a console, then the spinlock is already
@@ -2488,13 +2485,12 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
2488int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) 2485int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
2489{ 2486{
2490 struct uart_state *state = drv->state + port->line; 2487 struct uart_state *state = drv->state + port->line;
2491 struct uart_info *info;
2492 2488
2493 BUG_ON(in_interrupt()); 2489 BUG_ON(in_interrupt());
2494 2490
2495 if (state->port != port) 2491 if (state->uart_port != port)
2496 printk(KERN_ALERT "Removing wrong port: %p != %p\n", 2492 printk(KERN_ALERT "Removing wrong port: %p != %p\n",
2497 state->port, port); 2493 state->uart_port, port);
2498 2494
2499 mutex_lock(&port_mutex); 2495 mutex_lock(&port_mutex);
2500 2496
@@ -2511,9 +2507,8 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
2511 */ 2507 */
2512 tty_unregister_device(drv->tty_driver, port->line); 2508 tty_unregister_device(drv->tty_driver, port->line);
2513 2509
2514 info = &state->info; 2510 if (state->port.tty)
2515 if (info && info->port.tty) 2511 tty_vhangup(state->port.tty);
2516 tty_vhangup(info->port.tty);
2517 2512
2518 /* 2513 /*
2519 * Free the port IO and memory resources, if any. 2514 * Free the port IO and memory resources, if any.
@@ -2529,10 +2524,9 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
2529 /* 2524 /*
2530 * Kill the tasklet, and free resources. 2525 * Kill the tasklet, and free resources.
2531 */ 2526 */
2532 if (info) 2527 tasklet_kill(&state->tlet);
2533 tasklet_kill(&info->tlet);
2534 2528
2535 state->port = NULL; 2529 state->uart_port = NULL;
2536 mutex_unlock(&port_mutex); 2530 mutex_unlock(&port_mutex);
2537 2531
2538 return 0; 2532 return 0;
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index 52db5cc3f900..4560b2e70685 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -154,7 +154,7 @@ static void ks8695uart_disable_ms(struct uart_port *port)
154static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) 154static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id)
155{ 155{
156 struct uart_port *port = dev_id; 156 struct uart_port *port = dev_id;
157 struct tty_struct *tty = port->info->port.tty; 157 struct tty_struct *tty = port->state->port.tty;
158 unsigned int status, ch, lsr, flg, max_count = 256; 158 unsigned int status, ch, lsr, flg, max_count = 256;
159 159
160 status = UART_GET_LSR(port); /* clears pending LSR interrupts */ 160 status = UART_GET_LSR(port); /* clears pending LSR interrupts */
@@ -210,7 +210,7 @@ ignore_char:
210static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id) 210static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id)
211{ 211{
212 struct uart_port *port = dev_id; 212 struct uart_port *port = dev_id;
213 struct circ_buf *xmit = &port->info->xmit; 213 struct circ_buf *xmit = &port->state->xmit;
214 unsigned int count; 214 unsigned int count;
215 215
216 if (port->x_char) { 216 if (port->x_char) {
@@ -266,7 +266,7 @@ static irqreturn_t ks8695uart_modem_status(int irq, void *dev_id)
266 if (status & URMS_URTERI) 266 if (status & URMS_URTERI)
267 port->icount.rng++; 267 port->icount.rng++;
268 268
269 wake_up_interruptible(&port->info->delta_msr_wait); 269 wake_up_interruptible(&port->state->delta_msr_wait);
270 270
271 return IRQ_HANDLED; 271 return IRQ_HANDLED;
272} 272}
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index a7bf024a8286..057fc5e8cc8d 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -138,7 +138,7 @@ static void lh7a40xuart_enable_ms (struct uart_port* port)
138 138
139static void lh7a40xuart_rx_chars (struct uart_port* port) 139static void lh7a40xuart_rx_chars (struct uart_port* port)
140{ 140{
141 struct tty_struct* tty = port->info->port.tty; 141 struct tty_struct* tty = port->state->port.tty;
142 int cbRxMax = 256; /* (Gross) limit on receive */ 142 int cbRxMax = 256; /* (Gross) limit on receive */
143 unsigned int data; /* Received data and status */ 143 unsigned int data; /* Received data and status */
144 unsigned int flag; 144 unsigned int flag;
@@ -184,7 +184,7 @@ static void lh7a40xuart_rx_chars (struct uart_port* port)
184 184
185static void lh7a40xuart_tx_chars (struct uart_port* port) 185static void lh7a40xuart_tx_chars (struct uart_port* port)
186{ 186{
187 struct circ_buf* xmit = &port->info->xmit; 187 struct circ_buf* xmit = &port->state->xmit;
188 int cbTxMax = port->fifosize; 188 int cbTxMax = port->fifosize;
189 189
190 if (port->x_char) { 190 if (port->x_char) {
@@ -241,7 +241,7 @@ static void lh7a40xuart_modem_status (struct uart_port* port)
241 if (delta & CTS) 241 if (delta & CTS)
242 uart_handle_cts_change (port, status & CTS); 242 uart_handle_cts_change (port, status & CTS);
243 243
244 wake_up_interruptible (&port->info->delta_msr_wait); 244 wake_up_interruptible (&port->state->delta_msr_wait);
245} 245}
246 246
247static irqreturn_t lh7a40xuart_int (int irq, void* dev_id) 247static irqreturn_t lh7a40xuart_int (int irq, void* dev_id)
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index 54dd16d66a4b..0f7cf4c453e6 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -272,7 +272,7 @@ static void serial_txx9_initialize(struct uart_port *port)
272static inline void 272static inline void
273receive_chars(struct uart_txx9_port *up, unsigned int *status) 273receive_chars(struct uart_txx9_port *up, unsigned int *status)
274{ 274{
275 struct tty_struct *tty = up->port.info->port.tty; 275 struct tty_struct *tty = up->port.state->port.tty;
276 unsigned char ch; 276 unsigned char ch;
277 unsigned int disr = *status; 277 unsigned int disr = *status;
278 int max_count = 256; 278 int max_count = 256;
@@ -348,7 +348,7 @@ receive_chars(struct uart_txx9_port *up, unsigned int *status)
348 348
349static inline void transmit_chars(struct uart_txx9_port *up) 349static inline void transmit_chars(struct uart_txx9_port *up)
350{ 350{
351 struct circ_buf *xmit = &up->port.info->xmit; 351 struct circ_buf *xmit = &up->port.state->xmit;
352 int count; 352 int count;
353 353
354 if (up->port.x_char) { 354 if (up->port.x_char) {
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 32dc2fc50e6b..85119fb7cb50 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -361,7 +361,7 @@ static inline int sci_rxroom(struct uart_port *port)
361 361
362static void sci_transmit_chars(struct uart_port *port) 362static void sci_transmit_chars(struct uart_port *port)
363{ 363{
364 struct circ_buf *xmit = &port->info->xmit; 364 struct circ_buf *xmit = &port->state->xmit;
365 unsigned int stopped = uart_tx_stopped(port); 365 unsigned int stopped = uart_tx_stopped(port);
366 unsigned short status; 366 unsigned short status;
367 unsigned short ctrl; 367 unsigned short ctrl;
@@ -426,7 +426,7 @@ static void sci_transmit_chars(struct uart_port *port)
426static inline void sci_receive_chars(struct uart_port *port) 426static inline void sci_receive_chars(struct uart_port *port)
427{ 427{
428 struct sci_port *sci_port = to_sci_port(port); 428 struct sci_port *sci_port = to_sci_port(port);
429 struct tty_struct *tty = port->info->port.tty; 429 struct tty_struct *tty = port->state->port.tty;
430 int i, count, copied = 0; 430 int i, count, copied = 0;
431 unsigned short status; 431 unsigned short status;
432 unsigned char flag; 432 unsigned char flag;
@@ -546,7 +546,7 @@ static inline int sci_handle_errors(struct uart_port *port)
546{ 546{
547 int copied = 0; 547 int copied = 0;
548 unsigned short status = sci_in(port, SCxSR); 548 unsigned short status = sci_in(port, SCxSR);
549 struct tty_struct *tty = port->info->port.tty; 549 struct tty_struct *tty = port->state->port.tty;
550 550
551 if (status & SCxSR_ORER(port)) { 551 if (status & SCxSR_ORER(port)) {
552 /* overrun error */ 552 /* overrun error */
@@ -600,7 +600,7 @@ static inline int sci_handle_errors(struct uart_port *port)
600 600
601static inline int sci_handle_fifo_overrun(struct uart_port *port) 601static inline int sci_handle_fifo_overrun(struct uart_port *port)
602{ 602{
603 struct tty_struct *tty = port->info->port.tty; 603 struct tty_struct *tty = port->state->port.tty;
604 int copied = 0; 604 int copied = 0;
605 605
606 if (port->type != PORT_SCIF) 606 if (port->type != PORT_SCIF)
@@ -623,7 +623,7 @@ static inline int sci_handle_breaks(struct uart_port *port)
623{ 623{
624 int copied = 0; 624 int copied = 0;
625 unsigned short status = sci_in(port, SCxSR); 625 unsigned short status = sci_in(port, SCxSR);
626 struct tty_struct *tty = port->info->port.tty; 626 struct tty_struct *tty = port->state->port.tty;
627 struct sci_port *s = to_sci_port(port); 627 struct sci_port *s = to_sci_port(port);
628 628
629 if (uart_handle_break(port)) 629 if (uart_handle_break(port))
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index d5276c012f78..9794e0cd3dcc 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -469,9 +469,9 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags)
469 return; 469 return;
470 } 470 }
471 471
472 if (port->sc_port.info) { 472 if (port->sc_port.state) {
473 /* The serial_core stuffs are initilized, use them */ 473 /* The serial_core stuffs are initilized, use them */
474 tty = port->sc_port.info->port.tty; 474 tty = port->sc_port.state->port.tty;
475 } 475 }
476 else { 476 else {
477 /* Not registered yet - can't pass to tty layer. */ 477 /* Not registered yet - can't pass to tty layer. */
@@ -550,9 +550,9 @@ static void sn_transmit_chars(struct sn_cons_port *port, int raw)
550 550
551 BUG_ON(!port->sc_is_asynch); 551 BUG_ON(!port->sc_is_asynch);
552 552
553 if (port->sc_port.info) { 553 if (port->sc_port.state) {
554 /* We're initilized, using serial core infrastructure */ 554 /* We're initilized, using serial core infrastructure */
555 xmit = &port->sc_port.info->xmit; 555 xmit = &port->sc_port.state->xmit;
556 } else { 556 } else {
557 /* Probably sn_sal_switch_to_asynch has been run but serial core isn't 557 /* Probably sn_sal_switch_to_asynch has been run but serial core isn't
558 * initilized yet. Just return. Writes are going through 558 * initilized yet. Just return. Writes are going through
@@ -927,7 +927,7 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
927 /* We can't look at the xmit buffer if we're not registered with serial core 927 /* We can't look at the xmit buffer if we're not registered with serial core
928 * yet. So only do the fancy recovery after registering 928 * yet. So only do the fancy recovery after registering
929 */ 929 */
930 if (!port->sc_port.info) { 930 if (!port->sc_port.state) {
931 /* Not yet registered with serial core - simple case */ 931 /* Not yet registered with serial core - simple case */
932 puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count); 932 puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
933 return; 933 return;
@@ -936,8 +936,8 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
936 /* somebody really wants this output, might be an 936 /* somebody really wants this output, might be an
937 * oops, kdb, panic, etc. make sure they get it. */ 937 * oops, kdb, panic, etc. make sure they get it. */
938 if (spin_is_locked(&port->sc_port.lock)) { 938 if (spin_is_locked(&port->sc_port.lock)) {
939 int lhead = port->sc_port.info->xmit.head; 939 int lhead = port->sc_port.state->xmit.head;
940 int ltail = port->sc_port.info->xmit.tail; 940 int ltail = port->sc_port.state->xmit.tail;
941 int counter, got_lock = 0; 941 int counter, got_lock = 0;
942 942
943 /* 943 /*
@@ -962,13 +962,13 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
962 break; 962 break;
963 } else { 963 } else {
964 /* still locked */ 964 /* still locked */
965 if ((lhead != port->sc_port.info->xmit.head) 965 if ((lhead != port->sc_port.state->xmit.head)
966 || (ltail != 966 || (ltail !=
967 port->sc_port.info->xmit.tail)) { 967 port->sc_port.state->xmit.tail)) {
968 lhead = 968 lhead =
969 port->sc_port.info->xmit.head; 969 port->sc_port.state->xmit.head;
970 ltail = 970 ltail =
971 port->sc_port.info->xmit.tail; 971 port->sc_port.state->xmit.tail;
972 counter = 0; 972 counter = 0;
973 } 973 }
974 } 974 }
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index 1df5325faab2..d548652dee50 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -184,8 +184,8 @@ static struct tty_struct *receive_chars(struct uart_port *port)
184{ 184{
185 struct tty_struct *tty = NULL; 185 struct tty_struct *tty = NULL;
186 186
187 if (port->info != NULL) /* Unopened serial console */ 187 if (port->state != NULL) /* Unopened serial console */
188 tty = port->info->port.tty; 188 tty = port->state->port.tty;
189 189
190 if (sunhv_ops->receive_chars(port, tty)) 190 if (sunhv_ops->receive_chars(port, tty))
191 sun_do_break(); 191 sun_do_break();
@@ -197,10 +197,10 @@ static void transmit_chars(struct uart_port *port)
197{ 197{
198 struct circ_buf *xmit; 198 struct circ_buf *xmit;
199 199
200 if (!port->info) 200 if (!port->state)
201 return; 201 return;
202 202
203 xmit = &port->info->xmit; 203 xmit = &port->state->xmit;
204 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) 204 if (uart_circ_empty(xmit) || uart_tx_stopped(port))
205 return; 205 return;
206 206
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 0355efe115d9..7c4f2fe8e246 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -117,8 +117,8 @@ receive_chars(struct uart_sunsab_port *up,
117 int count = 0; 117 int count = 0;
118 int i; 118 int i;
119 119
120 if (up->port.info != NULL) /* Unopened serial console */ 120 if (up->port.state != NULL) /* Unopened serial console */
121 tty = up->port.info->port.tty; 121 tty = up->port.state->port.tty;
122 122
123 /* Read number of BYTES (Character + Status) available. */ 123 /* Read number of BYTES (Character + Status) available. */
124 if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { 124 if (stat->sreg.isr0 & SAB82532_ISR0_RPF) {
@@ -229,7 +229,7 @@ static void sunsab_tx_idle(struct uart_sunsab_port *);
229static void transmit_chars(struct uart_sunsab_port *up, 229static void transmit_chars(struct uart_sunsab_port *up,
230 union sab82532_irq_status *stat) 230 union sab82532_irq_status *stat)
231{ 231{
232 struct circ_buf *xmit = &up->port.info->xmit; 232 struct circ_buf *xmit = &up->port.state->xmit;
233 int i; 233 int i;
234 234
235 if (stat->sreg.isr1 & SAB82532_ISR1_ALLS) { 235 if (stat->sreg.isr1 & SAB82532_ISR1_ALLS) {
@@ -297,7 +297,7 @@ static void check_status(struct uart_sunsab_port *up,
297 up->port.icount.dsr++; 297 up->port.icount.dsr++;
298 } 298 }
299 299
300 wake_up_interruptible(&up->port.info->delta_msr_wait); 300 wake_up_interruptible(&up->port.state->delta_msr_wait);
301} 301}
302 302
303static irqreturn_t sunsab_interrupt(int irq, void *dev_id) 303static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
@@ -429,7 +429,7 @@ static void sunsab_tx_idle(struct uart_sunsab_port *up)
429static void sunsab_start_tx(struct uart_port *port) 429static void sunsab_start_tx(struct uart_port *port)
430{ 430{
431 struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; 431 struct uart_sunsab_port *up = (struct uart_sunsab_port *) port;
432 struct circ_buf *xmit = &up->port.info->xmit; 432 struct circ_buf *xmit = &up->port.state->xmit;
433 int i; 433 int i;
434 434
435 up->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS|SAB82532_IMR1_XPR); 435 up->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS|SAB82532_IMR1_XPR);
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 47c6837850b1..5a32365b58ad 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -311,7 +311,7 @@ static void sunsu_enable_ms(struct uart_port *port)
311static struct tty_struct * 311static struct tty_struct *
312receive_chars(struct uart_sunsu_port *up, unsigned char *status) 312receive_chars(struct uart_sunsu_port *up, unsigned char *status)
313{ 313{
314 struct tty_struct *tty = up->port.info->port.tty; 314 struct tty_struct *tty = up->port.state->port.tty;
315 unsigned char ch, flag; 315 unsigned char ch, flag;
316 int max_count = 256; 316 int max_count = 256;
317 int saw_console_brk = 0; 317 int saw_console_brk = 0;
@@ -389,7 +389,7 @@ receive_chars(struct uart_sunsu_port *up, unsigned char *status)
389 389
390static void transmit_chars(struct uart_sunsu_port *up) 390static void transmit_chars(struct uart_sunsu_port *up)
391{ 391{
392 struct circ_buf *xmit = &up->port.info->xmit; 392 struct circ_buf *xmit = &up->port.state->xmit;
393 int count; 393 int count;
394 394
395 if (up->port.x_char) { 395 if (up->port.x_char) {
@@ -441,7 +441,7 @@ static void check_modem_status(struct uart_sunsu_port *up)
441 if (status & UART_MSR_DCTS) 441 if (status & UART_MSR_DCTS)
442 uart_handle_cts_change(&up->port, status & UART_MSR_CTS); 442 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
443 443
444 wake_up_interruptible(&up->port.info->delta_msr_wait); 444 wake_up_interruptible(&up->port.state->delta_msr_wait);
445} 445}
446 446
447static irqreturn_t sunsu_serial_interrupt(int irq, void *dev_id) 447static irqreturn_t sunsu_serial_interrupt(int irq, void *dev_id)
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index e09d3cebb4fb..055034d12b1c 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -328,9 +328,9 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
328 unsigned char ch, r1, flag; 328 unsigned char ch, r1, flag;
329 329
330 tty = NULL; 330 tty = NULL;
331 if (up->port.info != NULL && /* Unopened serial console */ 331 if (up->port.state != NULL && /* Unopened serial console */
332 up->port.info->port.tty != NULL) /* Keyboard || mouse */ 332 up->port.state->port.tty != NULL) /* Keyboard || mouse */
333 tty = up->port.info->port.tty; 333 tty = up->port.state->port.tty;
334 334
335 for (;;) { 335 for (;;) {
336 336
@@ -451,7 +451,7 @@ static void sunzilog_status_handle(struct uart_sunzilog_port *up,
451 uart_handle_cts_change(&up->port, 451 uart_handle_cts_change(&up->port,
452 (status & CTS)); 452 (status & CTS));
453 453
454 wake_up_interruptible(&up->port.info->delta_msr_wait); 454 wake_up_interruptible(&up->port.state->delta_msr_wait);
455 } 455 }
456 456
457 up->prev_status = status; 457 up->prev_status = status;
@@ -501,9 +501,9 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up,
501 return; 501 return;
502 } 502 }
503 503
504 if (up->port.info == NULL) 504 if (up->port.state == NULL)
505 goto ack_tx_int; 505 goto ack_tx_int;
506 xmit = &up->port.info->xmit; 506 xmit = &up->port.state->xmit;
507 if (uart_circ_empty(xmit)) 507 if (uart_circ_empty(xmit))
508 goto ack_tx_int; 508 goto ack_tx_int;
509 509
@@ -705,7 +705,7 @@ static void sunzilog_start_tx(struct uart_port *port)
705 port->icount.tx++; 705 port->icount.tx++;
706 port->x_char = 0; 706 port->x_char = 0;
707 } else { 707 } else {
708 struct circ_buf *xmit = &port->info->xmit; 708 struct circ_buf *xmit = &port->state->xmit;
709 709
710 writeb(xmit->buf[xmit->tail], &channel->data); 710 writeb(xmit->buf[xmit->tail], &channel->data);
711 ZSDELAY(); 711 ZSDELAY();
diff --git a/drivers/serial/timbuart.c b/drivers/serial/timbuart.c
index 063a313b755c..3d40be6f389f 100644
--- a/drivers/serial/timbuart.c
+++ b/drivers/serial/timbuart.c
@@ -77,7 +77,7 @@ static void timbuart_flush_buffer(struct uart_port *port)
77 77
78static void timbuart_rx_chars(struct uart_port *port) 78static void timbuart_rx_chars(struct uart_port *port)
79{ 79{
80 struct tty_struct *tty = port->info->port.tty; 80 struct tty_struct *tty = port->state->port.tty;
81 81
82 while (ioread32(port->membase + TIMBUART_ISR) & RXDP) { 82 while (ioread32(port->membase + TIMBUART_ISR) & RXDP) {
83 u8 ch = ioread8(port->membase + TIMBUART_RXFIFO); 83 u8 ch = ioread8(port->membase + TIMBUART_RXFIFO);
@@ -86,7 +86,7 @@ static void timbuart_rx_chars(struct uart_port *port)
86 } 86 }
87 87
88 spin_unlock(&port->lock); 88 spin_unlock(&port->lock);
89 tty_flip_buffer_push(port->info->port.tty); 89 tty_flip_buffer_push(port->state->port.tty);
90 spin_lock(&port->lock); 90 spin_lock(&port->lock);
91 91
92 dev_dbg(port->dev, "%s - total read %d bytes\n", 92 dev_dbg(port->dev, "%s - total read %d bytes\n",
@@ -95,7 +95,7 @@ static void timbuart_rx_chars(struct uart_port *port)
95 95
96static void timbuart_tx_chars(struct uart_port *port) 96static void timbuart_tx_chars(struct uart_port *port)
97{ 97{
98 struct circ_buf *xmit = &port->info->xmit; 98 struct circ_buf *xmit = &port->state->xmit;
99 99
100 while (!(ioread32(port->membase + TIMBUART_ISR) & TXBF) && 100 while (!(ioread32(port->membase + TIMBUART_ISR) & TXBF) &&
101 !uart_circ_empty(xmit)) { 101 !uart_circ_empty(xmit)) {
@@ -118,7 +118,7 @@ static void timbuart_handle_tx_port(struct uart_port *port, u32 isr, u32 *ier)
118{ 118{
119 struct timbuart_port *uart = 119 struct timbuart_port *uart =
120 container_of(port, struct timbuart_port, port); 120 container_of(port, struct timbuart_port, port);
121 struct circ_buf *xmit = &port->info->xmit; 121 struct circ_buf *xmit = &port->state->xmit;
122 122
123 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) 123 if (uart_circ_empty(xmit) || uart_tx_stopped(port))
124 return; 124 return;
@@ -231,7 +231,7 @@ static void timbuart_mctrl_check(struct uart_port *port, u32 isr, u32 *ier)
231 iowrite32(CTS_DELTA, port->membase + TIMBUART_ISR); 231 iowrite32(CTS_DELTA, port->membase + TIMBUART_ISR);
232 cts = timbuart_get_mctrl(port); 232 cts = timbuart_get_mctrl(port);
233 uart_handle_cts_change(port, cts & TIOCM_CTS); 233 uart_handle_cts_change(port, cts & TIOCM_CTS);
234 wake_up_interruptible(&port->info->delta_msr_wait); 234 wake_up_interruptible(&port->state->delta_msr_wait);
235 } 235 }
236 236
237 *ier |= CTS_DELTA; 237 *ier |= CTS_DELTA;
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index 3317148a4b93..5d3a573d6994 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -75,7 +75,7 @@ static struct uart_port ulite_ports[ULITE_NR_UARTS];
75 75
76static int ulite_receive(struct uart_port *port, int stat) 76static int ulite_receive(struct uart_port *port, int stat)
77{ 77{
78 struct tty_struct *tty = port->info->port.tty; 78 struct tty_struct *tty = port->state->port.tty;
79 unsigned char ch = 0; 79 unsigned char ch = 0;
80 char flag = TTY_NORMAL; 80 char flag = TTY_NORMAL;
81 81
@@ -125,7 +125,7 @@ static int ulite_receive(struct uart_port *port, int stat)
125 125
126static int ulite_transmit(struct uart_port *port, int stat) 126static int ulite_transmit(struct uart_port *port, int stat)
127{ 127{
128 struct circ_buf *xmit = &port->info->xmit; 128 struct circ_buf *xmit = &port->state->xmit;
129 129
130 if (stat & ULITE_STATUS_TXFULL) 130 if (stat & ULITE_STATUS_TXFULL)
131 return 0; 131 return 0;
@@ -162,7 +162,7 @@ static irqreturn_t ulite_isr(int irq, void *dev_id)
162 busy |= ulite_transmit(port, stat); 162 busy |= ulite_transmit(port, stat);
163 } while (busy); 163 } while (busy);
164 164
165 tty_flip_buffer_push(port->info->port.tty); 165 tty_flip_buffer_push(port->state->port.tty);
166 166
167 return IRQ_HANDLED; 167 return IRQ_HANDLED;
168} 168}
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c
index e945e780b5c9..0c08f286a2ef 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/serial/ucc_uart.c
@@ -327,7 +327,7 @@ static int qe_uart_tx_pump(struct uart_qe_port *qe_port)
327 unsigned char *p; 327 unsigned char *p;
328 unsigned int count; 328 unsigned int count;
329 struct uart_port *port = &qe_port->port; 329 struct uart_port *port = &qe_port->port;
330 struct circ_buf *xmit = &port->info->xmit; 330 struct circ_buf *xmit = &port->state->xmit;
331 331
332 bdp = qe_port->rx_cur; 332 bdp = qe_port->rx_cur;
333 333
@@ -466,7 +466,7 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port)
466 int i; 466 int i;
467 unsigned char ch, *cp; 467 unsigned char ch, *cp;
468 struct uart_port *port = &qe_port->port; 468 struct uart_port *port = &qe_port->port;
469 struct tty_struct *tty = port->info->port.tty; 469 struct tty_struct *tty = port->state->port.tty;
470 struct qe_bd *bdp; 470 struct qe_bd *bdp;
471 u16 status; 471 u16 status;
472 unsigned int flg; 472 unsigned int flg;
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index dac550e57c29..cf4410e6d53b 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -318,7 +318,7 @@ static inline void receive_chars(struct uart_port *port, uint8_t *status)
318 char flag; 318 char flag;
319 int max_count = RX_MAX_COUNT; 319 int max_count = RX_MAX_COUNT;
320 320
321 tty = port->info->port.tty; 321 tty = port->state->port.tty;
322 lsr = *status; 322 lsr = *status;
323 323
324 do { 324 do {
@@ -386,7 +386,7 @@ static inline void check_modem_status(struct uart_port *port)
386 if (msr & UART_MSR_DCTS) 386 if (msr & UART_MSR_DCTS)
387 uart_handle_cts_change(port, msr & UART_MSR_CTS); 387 uart_handle_cts_change(port, msr & UART_MSR_CTS);
388 388
389 wake_up_interruptible(&port->info->delta_msr_wait); 389 wake_up_interruptible(&port->state->delta_msr_wait);
390} 390}
391 391
392static inline void transmit_chars(struct uart_port *port) 392static inline void transmit_chars(struct uart_port *port)
@@ -394,7 +394,7 @@ static inline void transmit_chars(struct uart_port *port)
394 struct circ_buf *xmit; 394 struct circ_buf *xmit;
395 int max_count = TX_MAX_COUNT; 395 int max_count = TX_MAX_COUNT;
396 396
397 xmit = &port->info->xmit; 397 xmit = &port->state->xmit;
398 398
399 if (port->x_char) { 399 if (port->x_char) {
400 siu_write(port, UART_TX, port->x_char); 400 siu_write(port, UART_TX, port->x_char);
diff --git a/drivers/serial/zs.c b/drivers/serial/zs.c
index d8c2809b1ab6..b9c9fb9198d6 100644
--- a/drivers/serial/zs.c
+++ b/drivers/serial/zs.c
@@ -602,12 +602,12 @@ static void zs_receive_chars(struct zs_port *zport)
602 uart_insert_char(uport, status, Rx_OVR, ch, flag); 602 uart_insert_char(uport, status, Rx_OVR, ch, flag);
603 } 603 }
604 604
605 tty_flip_buffer_push(uport->info->port.tty); 605 tty_flip_buffer_push(uport->state->port.tty);
606} 606}
607 607
608static void zs_raw_transmit_chars(struct zs_port *zport) 608static void zs_raw_transmit_chars(struct zs_port *zport)
609{ 609{
610 struct circ_buf *xmit = &zport->port.info->xmit; 610 struct circ_buf *xmit = &zport->port.state->xmit;
611 611
612 /* XON/XOFF chars. */ 612 /* XON/XOFF chars. */
613 if (zport->port.x_char) { 613 if (zport->port.x_char) {
@@ -686,7 +686,7 @@ static void zs_status_handle(struct zs_port *zport, struct zs_port *zport_a)
686 uport->icount.rng++; 686 uport->icount.rng++;
687 687
688 if (delta) 688 if (delta)
689 wake_up_interruptible(&uport->info->delta_msr_wait); 689 wake_up_interruptible(&uport->state->delta_msr_wait);
690 690
691 spin_lock(&scc->zlock); 691 spin_lock(&scc->zlock);
692 } 692 }
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 3cd255f0b211..c1542703fbab 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -186,7 +186,6 @@
186#include <linux/sysrq.h> 186#include <linux/sysrq.h>
187 187
188struct uart_port; 188struct uart_port;
189struct uart_info;
190struct serial_struct; 189struct serial_struct;
191struct device; 190struct device;
192 191
@@ -284,7 +283,7 @@ struct uart_port {
284 283
285 unsigned int read_status_mask; /* driver specific */ 284 unsigned int read_status_mask; /* driver specific */
286 unsigned int ignore_status_mask; /* driver specific */ 285 unsigned int ignore_status_mask; /* driver specific */
287 struct uart_info *info; /* pointer to parent info */ 286 struct uart_state *state; /* pointer to parent state */
288 struct uart_icount icount; /* statistics */ 287 struct uart_icount icount; /* statistics */
289 288
290 struct console *cons; /* struct console, if any */ 289 struct console *cons; /* struct console, if any */
@@ -343,8 +342,22 @@ struct uart_port {
343 */ 342 */
344typedef unsigned int __bitwise__ uif_t; 343typedef unsigned int __bitwise__ uif_t;
345 344
346struct uart_info { 345
346/*
347 * This is the state information which is persistent across opens.
348 * The low level driver must not to touch any elements contained
349 * within.
350 */
351struct uart_state {
347 struct tty_port port; 352 struct tty_port port;
353 unsigned int close_delay; /* msec */
354 unsigned int closing_wait; /* msec */
355
356#define USF_CLOSING_WAIT_INF (0)
357#define USF_CLOSING_WAIT_NONE (~0U)
358
359 int count;
360 int pm_state;
348 struct circ_buf xmit; 361 struct circ_buf xmit;
349 uif_t flags; 362 uif_t flags;
350 363
@@ -362,24 +375,7 @@ struct uart_info {
362 375
363 struct tasklet_struct tlet; 376 struct tasklet_struct tlet;
364 wait_queue_head_t delta_msr_wait; 377 wait_queue_head_t delta_msr_wait;
365}; 378 struct uart_port *uart_port;
366
367/*
368 * This is the state information which is persistent across opens.
369 * The low level driver must not to touch any elements contained
370 * within.
371 */
372struct uart_state {
373 unsigned int close_delay; /* msec */
374 unsigned int closing_wait; /* msec */
375
376#define USF_CLOSING_WAIT_INF (0)
377#define USF_CLOSING_WAIT_NONE (~0U)
378
379 int count;
380 int pm_state;
381 struct uart_info info;
382 struct uart_port *port;
383 379
384 struct mutex mutex; 380 struct mutex mutex;
385}; 381};
@@ -462,7 +458,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
462 458
463static inline int uart_tx_stopped(struct uart_port *port) 459static inline int uart_tx_stopped(struct uart_port *port)
464{ 460{
465 struct tty_struct *tty = port->info->port.tty; 461 struct tty_struct *tty = port->state->port.tty;
466 if(tty->stopped || tty->hw_stopped) 462 if(tty->stopped || tty->hw_stopped)
467 return 1; 463 return 1;
468 return 0; 464 return 0;
@@ -477,7 +473,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
477#ifdef SUPPORT_SYSRQ 473#ifdef SUPPORT_SYSRQ
478 if (port->sysrq) { 474 if (port->sysrq) {
479 if (ch && time_before(jiffies, port->sysrq)) { 475 if (ch && time_before(jiffies, port->sysrq)) {
480 handle_sysrq(ch, port->info->port.tty); 476 handle_sysrq(ch, port->state->port.tty);
481 port->sysrq = 0; 477 port->sysrq = 0;
482 return 1; 478 return 1;
483 } 479 }
@@ -495,7 +491,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
495 */ 491 */
496static inline int uart_handle_break(struct uart_port *port) 492static inline int uart_handle_break(struct uart_port *port)
497{ 493{
498 struct uart_info *info = port->info; 494 struct uart_state *state = port->state;
499#ifdef SUPPORT_SYSRQ 495#ifdef SUPPORT_SYSRQ
500 if (port->cons && port->cons->index == port->line) { 496 if (port->cons && port->cons->index == port->line) {
501 if (!port->sysrq) { 497 if (!port->sysrq) {
@@ -506,7 +502,7 @@ static inline int uart_handle_break(struct uart_port *port)
506 } 502 }
507#endif 503#endif
508 if (port->flags & UPF_SAK) 504 if (port->flags & UPF_SAK)
509 do_SAK(info->port.tty); 505 do_SAK(state->port.tty);
510 return 0; 506 return 0;
511} 507}
512 508
@@ -518,7 +514,7 @@ static inline int uart_handle_break(struct uart_port *port)
518static inline void 514static inline void
519uart_handle_dcd_change(struct uart_port *port, unsigned int status) 515uart_handle_dcd_change(struct uart_port *port, unsigned int status)
520{ 516{
521 struct uart_info *info = port->info; 517 struct uart_state *state = port->state;
522 518
523 port->icount.dcd++; 519 port->icount.dcd++;
524 520
@@ -527,11 +523,11 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status)
527 hardpps(); 523 hardpps();
528#endif 524#endif
529 525
530 if (info->flags & UIF_CHECK_CD) { 526 if (state->flags & UIF_CHECK_CD) {
531 if (status) 527 if (status)
532 wake_up_interruptible(&info->port.open_wait); 528 wake_up_interruptible(&state->port.open_wait);
533 else if (info->port.tty) 529 else if (state->port.tty)
534 tty_hangup(info->port.tty); 530 tty_hangup(state->port.tty);
535 } 531 }
536} 532}
537 533
@@ -543,12 +539,12 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status)
543static inline void 539static inline void
544uart_handle_cts_change(struct uart_port *port, unsigned int status) 540uart_handle_cts_change(struct uart_port *port, unsigned int status)
545{ 541{
546 struct uart_info *info = port->info; 542 struct uart_state *state = port->state;
547 struct tty_struct *tty = info->port.tty; 543 struct tty_struct *tty = state->port.tty;
548 544
549 port->icount.cts++; 545 port->icount.cts++;
550 546
551 if (info->flags & UIF_CTS_FLOW) { 547 if (state->flags & UIF_CTS_FLOW) {
552 if (tty->hw_stopped) { 548 if (tty->hw_stopped) {
553 if (status) { 549 if (status) {
554 tty->hw_stopped = 0; 550 tty->hw_stopped = 0;
@@ -570,7 +566,7 @@ static inline void
570uart_insert_char(struct uart_port *port, unsigned int status, 566uart_insert_char(struct uart_port *port, unsigned int status,
571 unsigned int overrun, unsigned int ch, unsigned int flag) 567 unsigned int overrun, unsigned int ch, unsigned int flag)
572{ 568{
573 struct tty_struct *tty = port->info->port.tty; 569 struct tty_struct *tty = port->state->port.tty;
574 570
575 if ((status & port->ignore_status_mask & ~overrun) == 0) 571 if ((status & port->ignore_status_mask & ~overrun) == 0)
576 tty_insert_flip_char(tty, ch, flag); 572 tty_insert_flip_char(tty, ch, flag);