aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/amiserial.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 08:52:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 15:30:51 -0500
commit01bd730d92bd002adc3f3317d8e3328c629b436c (patch)
treeff7d9a72c32437616834ff6bb6f092e0bd91dbf6 /drivers/tty/amiserial.c
parent12c8035435fa16e3f6b18049bb1d7815c00a7a58 (diff)
TTY: amiserial/simserial, use flags from tty_port
This changes flags' type to ulong which is appropriate for all the set/clear_bits performed in the drivers.. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/amiserial.c')
-rw-r--r--drivers/tty/amiserial.c129
1 files changed, 66 insertions, 63 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 8ad64a0f1251..7d798262d0c2 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -45,7 +45,7 @@
45 45
46#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) 46#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
47#define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ 47#define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
48 tty->name, (info->flags), serial_driver->refcount,info->count,tty->count,s) 48 tty->name, (info->tport.flags), serial_driver->refcount,info->count,tty->count,s)
49#else 49#else
50#define DBG_CNT(s) 50#define DBG_CNT(s)
51#endif 51#endif
@@ -296,7 +296,7 @@ static void receive_chars(struct serial_state *info)
296 printk("handling break...."); 296 printk("handling break....");
297#endif 297#endif
298 flag = TTY_BREAK; 298 flag = TTY_BREAK;
299 if (info->flags & ASYNC_SAK) 299 if (info->tport.flags & ASYNC_SAK)
300 do_SAK(tty); 300 do_SAK(tty);
301 } else if (status & UART_LSR_PE) 301 } else if (status & UART_LSR_PE)
302 flag = TTY_PARITY; 302 flag = TTY_PARITY;
@@ -377,7 +377,7 @@ static void check_modem_status(struct serial_state *info)
377 if (dstatus & SER_DCD) { 377 if (dstatus & SER_DCD) {
378 icount->dcd++; 378 icount->dcd++;
379#ifdef CONFIG_HARD_PPS 379#ifdef CONFIG_HARD_PPS
380 if ((info->flags & ASYNC_HARDPPS_CD) && 380 if ((info->tport.flags & ASYNC_HARDPPS_CD) &&
381 !(status & SER_DCD)) 381 !(status & SER_DCD))
382 hardpps(); 382 hardpps();
383#endif 383#endif
@@ -387,7 +387,7 @@ static void check_modem_status(struct serial_state *info)
387 wake_up_interruptible(&info->tport.delta_msr_wait); 387 wake_up_interruptible(&info->tport.delta_msr_wait);
388 } 388 }
389 389
390 if ((info->flags & ASYNC_CHECK_CD) && (dstatus & SER_DCD)) { 390 if ((info->tport.flags & ASYNC_CHECK_CD) && (dstatus & SER_DCD)) {
391#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) 391#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
392 printk("ttyS%d CD now %s...", info->line, 392 printk("ttyS%d CD now %s...", info->line,
393 (!(status & SER_DCD)) ? "on" : "off"); 393 (!(status & SER_DCD)) ? "on" : "off");
@@ -402,7 +402,7 @@ static void check_modem_status(struct serial_state *info)
402 tty_hangup(info->tport.tty); 402 tty_hangup(info->tport.tty);
403 } 403 }
404 } 404 }
405 if (info->flags & ASYNC_CTS_FLOW) { 405 if (info->tport.flags & ASYNC_CTS_FLOW) {
406 if (info->tport.tty->hw_stopped) { 406 if (info->tport.tty->hw_stopped) {
407 if (!(status & SER_CTS)) { 407 if (!(status & SER_CTS)) {
408#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) 408#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
@@ -503,6 +503,7 @@ static irqreturn_t ser_tx_int(int irq, void *dev_id)
503 503
504static int startup(struct tty_struct *tty, struct serial_state *info) 504static int startup(struct tty_struct *tty, struct serial_state *info)
505{ 505{
506 struct tty_port *port = &info->tport;
506 unsigned long flags; 507 unsigned long flags;
507 int retval=0; 508 int retval=0;
508 unsigned long page; 509 unsigned long page;
@@ -513,7 +514,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
513 514
514 local_irq_save(flags); 515 local_irq_save(flags);
515 516
516 if (info->flags & ASYNC_INITIALIZED) { 517 if (port->flags & ASYNC_INITIALIZED) {
517 free_page(page); 518 free_page(page);
518 goto errout; 519 goto errout;
519 } 520 }
@@ -560,13 +561,13 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
560 /* 561 /*
561 * Set up the tty->alt_speed kludge 562 * Set up the tty->alt_speed kludge
562 */ 563 */
563 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 564 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
564 tty->alt_speed = 57600; 565 tty->alt_speed = 57600;
565 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 566 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
566 tty->alt_speed = 115200; 567 tty->alt_speed = 115200;
567 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 568 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
568 tty->alt_speed = 230400; 569 tty->alt_speed = 230400;
569 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 570 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
570 tty->alt_speed = 460800; 571 tty->alt_speed = 460800;
571 572
572 /* 573 /*
@@ -574,7 +575,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
574 */ 575 */
575 change_speed(tty, info, NULL); 576 change_speed(tty, info, NULL);
576 577
577 info->flags |= ASYNC_INITIALIZED; 578 port->flags |= ASYNC_INITIALIZED;
578 local_irq_restore(flags); 579 local_irq_restore(flags);
579 return 0; 580 return 0;
580 581
@@ -592,7 +593,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
592 unsigned long flags; 593 unsigned long flags;
593 struct serial_state *state; 594 struct serial_state *state;
594 595
595 if (!(info->flags & ASYNC_INITIALIZED)) 596 if (!(info->tport.flags & ASYNC_INITIALIZED))
596 return; 597 return;
597 598
598 state = info; 599 state = info;
@@ -633,7 +634,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
633 634
634 set_bit(TTY_IO_ERROR, &tty->flags); 635 set_bit(TTY_IO_ERROR, &tty->flags);
635 636
636 info->flags &= ~ASYNC_INITIALIZED; 637 info->tport.flags &= ~ASYNC_INITIALIZED;
637 local_irq_restore(flags); 638 local_irq_restore(flags);
638} 639}
639 640
@@ -645,6 +646,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
645static void change_speed(struct tty_struct *tty, struct serial_state *info, 646static void change_speed(struct tty_struct *tty, struct serial_state *info,
646 struct ktermios *old_termios) 647 struct ktermios *old_termios)
647{ 648{
649 struct tty_port *port = &info->tport;
648 int quot = 0, baud_base, baud; 650 int quot = 0, baud_base, baud;
649 unsigned cflag, cval = 0; 651 unsigned cflag, cval = 0;
650 int bits; 652 int bits;
@@ -675,8 +677,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
675 if (!baud) 677 if (!baud)
676 baud = 9600; /* B0 transition handled in rs_set_termios */ 678 baud = 9600; /* B0 transition handled in rs_set_termios */
677 baud_base = info->baud_base; 679 baud_base = info->baud_base;
678 if (baud == 38400 && 680 if (baud == 38400 && (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
679 ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))
680 quot = info->custom_divisor; 681 quot = info->custom_divisor;
681 else { 682 else {
682 if (baud == 134) 683 if (baud == 134)
@@ -694,7 +695,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
694 if (!baud) 695 if (!baud)
695 baud = 9600; 696 baud = 9600;
696 if (baud == 38400 && 697 if (baud == 38400 &&
697 ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) 698 (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
698 quot = info->custom_divisor; 699 quot = info->custom_divisor;
699 else { 700 else {
700 if (baud == 134) 701 if (baud == 134)
@@ -713,17 +714,17 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
713 714
714 /* CTS flow control flag and modem status interrupts */ 715 /* CTS flow control flag and modem status interrupts */
715 info->IER &= ~UART_IER_MSI; 716 info->IER &= ~UART_IER_MSI;
716 if (info->flags & ASYNC_HARDPPS_CD) 717 if (port->flags & ASYNC_HARDPPS_CD)
717 info->IER |= UART_IER_MSI; 718 info->IER |= UART_IER_MSI;
718 if (cflag & CRTSCTS) { 719 if (cflag & CRTSCTS) {
719 info->flags |= ASYNC_CTS_FLOW; 720 port->flags |= ASYNC_CTS_FLOW;
720 info->IER |= UART_IER_MSI; 721 info->IER |= UART_IER_MSI;
721 } else 722 } else
722 info->flags &= ~ASYNC_CTS_FLOW; 723 port->flags &= ~ASYNC_CTS_FLOW;
723 if (cflag & CLOCAL) 724 if (cflag & CLOCAL)
724 info->flags &= ~ASYNC_CHECK_CD; 725 port->flags &= ~ASYNC_CHECK_CD;
725 else { 726 else {
726 info->flags |= ASYNC_CHECK_CD; 727 port->flags |= ASYNC_CHECK_CD;
727 info->IER |= UART_IER_MSI; 728 info->IER |= UART_IER_MSI;
728 } 729 }
729 /* TBD: 730 /* TBD:
@@ -1019,7 +1020,7 @@ static int get_serial_info(struct serial_state *state,
1019 tmp.line = state->line; 1020 tmp.line = state->line;
1020 tmp.port = state->port; 1021 tmp.port = state->port;
1021 tmp.irq = state->irq; 1022 tmp.irq = state->irq;
1022 tmp.flags = state->flags; 1023 tmp.flags = state->tport.flags;
1023 tmp.xmit_fifo_size = state->xmit_fifo_size; 1024 tmp.xmit_fifo_size = state->xmit_fifo_size;
1024 tmp.baud_base = state->baud_base; 1025 tmp.baud_base = state->baud_base;
1025 tmp.close_delay = state->tport.close_delay; 1026 tmp.close_delay = state->tport.close_delay;
@@ -1034,6 +1035,7 @@ static int get_serial_info(struct serial_state *state,
1034static int set_serial_info(struct tty_struct *tty, struct serial_state *state, 1035static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
1035 struct serial_struct __user * new_info) 1036 struct serial_struct __user * new_info)
1036{ 1037{
1038 struct tty_port *port = &state->tport;
1037 struct serial_struct new_serial; 1039 struct serial_struct new_serial;
1038 bool change_spd; 1040 bool change_spd;
1039 int retval = 0; 1041 int retval = 0;
@@ -1042,7 +1044,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
1042 return -EFAULT; 1044 return -EFAULT;
1043 1045
1044 tty_lock(); 1046 tty_lock();
1045 change_spd = ((new_serial.flags ^ state->flags) & ASYNC_SPD_MASK) || 1047 change_spd = ((new_serial.flags ^ port->flags) & ASYNC_SPD_MASK) ||
1046 new_serial.custom_divisor != state->custom_divisor; 1048 new_serial.custom_divisor != state->custom_divisor;
1047 if (new_serial.irq != state->irq || new_serial.port != state->port || 1049 if (new_serial.irq != state->irq || new_serial.port != state->port ||
1048 new_serial.xmit_fifo_size != state->xmit_fifo_size) { 1050 new_serial.xmit_fifo_size != state->xmit_fifo_size) {
@@ -1052,12 +1054,12 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
1052 1054
1053 if (!serial_isroot()) { 1055 if (!serial_isroot()) {
1054 if ((new_serial.baud_base != state->baud_base) || 1056 if ((new_serial.baud_base != state->baud_base) ||
1055 (new_serial.close_delay != state->tport.close_delay) || 1057 (new_serial.close_delay != port->close_delay) ||
1056 (new_serial.xmit_fifo_size != state->xmit_fifo_size) || 1058 (new_serial.xmit_fifo_size != state->xmit_fifo_size) ||
1057 ((new_serial.flags & ~ASYNC_USR_MASK) != 1059 ((new_serial.flags & ~ASYNC_USR_MASK) !=
1058 (state->flags & ~ASYNC_USR_MASK))) 1060 (port->flags & ~ASYNC_USR_MASK)))
1059 return -EPERM; 1061 return -EPERM;
1060 state->flags = ((state->flags & ~ASYNC_USR_MASK) | 1062 port->flags = ((port->flags & ~ASYNC_USR_MASK) |
1061 (new_serial.flags & ASYNC_USR_MASK)); 1063 (new_serial.flags & ASYNC_USR_MASK));
1062 state->custom_divisor = new_serial.custom_divisor; 1064 state->custom_divisor = new_serial.custom_divisor;
1063 goto check_and_exit; 1065 goto check_and_exit;
@@ -1074,23 +1076,23 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
1074 */ 1076 */
1075 1077
1076 state->baud_base = new_serial.baud_base; 1078 state->baud_base = new_serial.baud_base;
1077 state->flags = ((state->flags & ~ASYNC_FLAGS) | 1079 port->flags = ((port->flags & ~ASYNC_FLAGS) |
1078 (new_serial.flags & ASYNC_FLAGS)); 1080 (new_serial.flags & ASYNC_FLAGS));
1079 state->custom_divisor = new_serial.custom_divisor; 1081 state->custom_divisor = new_serial.custom_divisor;
1080 state->tport.close_delay = new_serial.close_delay * HZ/100; 1082 port->close_delay = new_serial.close_delay * HZ/100;
1081 state->tport.closing_wait = new_serial.closing_wait * HZ/100; 1083 port->closing_wait = new_serial.closing_wait * HZ/100;
1082 tty->low_latency = (state->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1084 tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1083 1085
1084check_and_exit: 1086check_and_exit:
1085 if (state->flags & ASYNC_INITIALIZED) { 1087 if (port->flags & ASYNC_INITIALIZED) {
1086 if (change_spd) { 1088 if (change_spd) {
1087 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 1089 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1088 tty->alt_speed = 57600; 1090 tty->alt_speed = 57600;
1089 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 1091 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1090 tty->alt_speed = 115200; 1092 tty->alt_speed = 115200;
1091 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 1093 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
1092 tty->alt_speed = 230400; 1094 tty->alt_speed = 230400;
1093 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 1095 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
1094 tty->alt_speed = 460800; 1096 tty->alt_speed = 460800;
1095 change_speed(tty, state, NULL); 1097 change_speed(tty, state, NULL);
1096 } 1098 }
@@ -1407,7 +1409,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1407 local_irq_restore(flags); 1409 local_irq_restore(flags);
1408 return; 1410 return;
1409 } 1411 }
1410 state->flags |= ASYNC_CLOSING; 1412 state->tport.flags |= ASYNC_CLOSING;
1411 /* 1413 /*
1412 * Now we wait for the transmit buffer to clear; and we notify 1414 * Now we wait for the transmit buffer to clear; and we notify
1413 * the line discipline to only process XON/XOFF characters. 1415 * the line discipline to only process XON/XOFF characters.
@@ -1422,7 +1424,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1422 * line status register. 1424 * line status register.
1423 */ 1425 */
1424 state->read_status_mask &= ~UART_LSR_DR; 1426 state->read_status_mask &= ~UART_LSR_DR;
1425 if (state->flags & ASYNC_INITIALIZED) { 1427 if (state->tport.flags & ASYNC_INITIALIZED) {
1426 /* disable receive interrupts */ 1428 /* disable receive interrupts */
1427 custom.intena = IF_RBF; 1429 custom.intena = IF_RBF;
1428 mb(); 1430 mb();
@@ -1449,7 +1451,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1449 } 1451 }
1450 wake_up_interruptible(&state->tport.open_wait); 1452 wake_up_interruptible(&state->tport.open_wait);
1451 } 1453 }
1452 state->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1454 state->tport.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1453 wake_up_interruptible(&state->tport.close_wait); 1455 wake_up_interruptible(&state->tport.close_wait);
1454 local_irq_restore(flags); 1456 local_irq_restore(flags);
1455} 1457}
@@ -1530,7 +1532,7 @@ static void rs_hangup(struct tty_struct *tty)
1530 rs_flush_buffer(tty); 1532 rs_flush_buffer(tty);
1531 shutdown(tty, info); 1533 shutdown(tty, info);
1532 info->tport.count = 0; 1534 info->tport.count = 0;
1533 info->flags &= ~ASYNC_NORMAL_ACTIVE; 1535 info->tport.flags &= ~ASYNC_NORMAL_ACTIVE;
1534 info->tport.tty = NULL; 1536 info->tport.tty = NULL;
1535 wake_up_interruptible(&info->tport.open_wait); 1537 wake_up_interruptible(&info->tport.open_wait);
1536} 1538}
@@ -1548,6 +1550,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1548#else 1550#else
1549 struct wait_queue wait = { current, NULL }; 1551 struct wait_queue wait = { current, NULL };
1550#endif 1552#endif
1553 struct tty_port *port = &info->tport;
1551 int retval; 1554 int retval;
1552 int do_clocal = 0, extra_count = 0; 1555 int do_clocal = 0, extra_count = 0;
1553 unsigned long flags; 1556 unsigned long flags;
@@ -1557,11 +1560,11 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1557 * until it's done, and then try again. 1560 * until it's done, and then try again.
1558 */ 1561 */
1559 if (tty_hung_up_p(filp) || 1562 if (tty_hung_up_p(filp) ||
1560 (info->flags & ASYNC_CLOSING)) { 1563 (port->flags & ASYNC_CLOSING)) {
1561 if (info->flags & ASYNC_CLOSING) 1564 if (port->flags & ASYNC_CLOSING)
1562 interruptible_sleep_on(&info->tport.close_wait); 1565 interruptible_sleep_on(&port->close_wait);
1563#ifdef SERIAL_DO_RESTART 1566#ifdef SERIAL_DO_RESTART
1564 return ((info->flags & ASYNC_HUP_NOTIFY) ? 1567 return ((port->flags & ASYNC_HUP_NOTIFY) ?
1565 -EAGAIN : -ERESTARTSYS); 1568 -EAGAIN : -ERESTARTSYS);
1566#else 1569#else
1567 return -EAGAIN; 1570 return -EAGAIN;
@@ -1574,7 +1577,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1574 */ 1577 */
1575 if ((filp->f_flags & O_NONBLOCK) || 1578 if ((filp->f_flags & O_NONBLOCK) ||
1576 (tty->flags & (1 << TTY_IO_ERROR))) { 1579 (tty->flags & (1 << TTY_IO_ERROR))) {
1577 info->flags |= ASYNC_NORMAL_ACTIVE; 1580 port->flags |= ASYNC_NORMAL_ACTIVE;
1578 return 0; 1581 return 0;
1579 } 1582 }
1580 1583
@@ -1584,23 +1587,23 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1584 /* 1587 /*
1585 * Block waiting for the carrier detect and the line to become 1588 * Block waiting for the carrier detect and the line to become
1586 * free (i.e., not in use by the callout). While we are in 1589 * free (i.e., not in use by the callout). While we are in
1587 * this loop, info->tport.count is dropped by one, so that 1590 * this loop, port->count is dropped by one, so that
1588 * rs_close() knows when to free things. We restore it upon 1591 * rs_close() knows when to free things. We restore it upon
1589 * exit, either normal or abnormal. 1592 * exit, either normal or abnormal.
1590 */ 1593 */
1591 retval = 0; 1594 retval = 0;
1592 add_wait_queue(&info->tport.open_wait, &wait); 1595 add_wait_queue(&port->open_wait, &wait);
1593#ifdef SERIAL_DEBUG_OPEN 1596#ifdef SERIAL_DEBUG_OPEN
1594 printk("block_til_ready before block: ttys%d, count = %d\n", 1597 printk("block_til_ready before block: ttys%d, count = %d\n",
1595 info->line, info->tport.count); 1598 info->line, port->count);
1596#endif 1599#endif
1597 local_irq_save(flags); 1600 local_irq_save(flags);
1598 if (!tty_hung_up_p(filp)) { 1601 if (!tty_hung_up_p(filp)) {
1599 extra_count = 1; 1602 extra_count = 1;
1600 info->tport.count--; 1603 port->count--;
1601 } 1604 }
1602 local_irq_restore(flags); 1605 local_irq_restore(flags);
1603 info->tport.blocked_open++; 1606 port->blocked_open++;
1604 while (1) { 1607 while (1) {
1605 local_irq_save(flags); 1608 local_irq_save(flags);
1606 if (tty->termios->c_cflag & CBAUD) 1609 if (tty->termios->c_cflag & CBAUD)
@@ -1608,9 +1611,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1608 local_irq_restore(flags); 1611 local_irq_restore(flags);
1609 set_current_state(TASK_INTERRUPTIBLE); 1612 set_current_state(TASK_INTERRUPTIBLE);
1610 if (tty_hung_up_p(filp) || 1613 if (tty_hung_up_p(filp) ||
1611 !(info->flags & ASYNC_INITIALIZED)) { 1614 !(port->flags & ASYNC_INITIALIZED)) {
1612#ifdef SERIAL_DO_RESTART 1615#ifdef SERIAL_DO_RESTART
1613 if (info->flags & ASYNC_HUP_NOTIFY) 1616 if (port->flags & ASYNC_HUP_NOTIFY)
1614 retval = -EAGAIN; 1617 retval = -EAGAIN;
1615 else 1618 else
1616 retval = -ERESTARTSYS; 1619 retval = -ERESTARTSYS;
@@ -1619,7 +1622,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1619#endif 1622#endif
1620 break; 1623 break;
1621 } 1624 }
1622 if (!(info->flags & ASYNC_CLOSING) && 1625 if (!(port->flags & ASYNC_CLOSING) &&
1623 (do_clocal || (!(ciab.pra & SER_DCD)) )) 1626 (do_clocal || (!(ciab.pra & SER_DCD)) ))
1624 break; 1627 break;
1625 if (signal_pending(current)) { 1628 if (signal_pending(current)) {
@@ -1628,24 +1631,24 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1628 } 1631 }
1629#ifdef SERIAL_DEBUG_OPEN 1632#ifdef SERIAL_DEBUG_OPEN
1630 printk("block_til_ready blocking: ttys%d, count = %d\n", 1633 printk("block_til_ready blocking: ttys%d, count = %d\n",
1631 info->line, info->tport.count); 1634 info->line, port->count);
1632#endif 1635#endif
1633 tty_unlock(); 1636 tty_unlock();
1634 schedule(); 1637 schedule();
1635 tty_lock(); 1638 tty_lock();
1636 } 1639 }
1637 __set_current_state(TASK_RUNNING); 1640 __set_current_state(TASK_RUNNING);
1638 remove_wait_queue(&info->tport.open_wait, &wait); 1641 remove_wait_queue(&port->open_wait, &wait);
1639 if (extra_count) 1642 if (extra_count)
1640 info->tport.count++; 1643 port->count++;
1641 info->tport.blocked_open--; 1644 port->blocked_open--;
1642#ifdef SERIAL_DEBUG_OPEN 1645#ifdef SERIAL_DEBUG_OPEN
1643 printk("block_til_ready after blocking: ttys%d, count = %d\n", 1646 printk("block_til_ready after blocking: ttys%d, count = %d\n",
1644 info->line, info->tport.count); 1647 info->line, port->count);
1645#endif 1648#endif
1646 if (retval) 1649 if (retval)
1647 return retval; 1650 return retval;
1648 info->flags |= ASYNC_NORMAL_ACTIVE; 1651 port->flags |= ASYNC_NORMAL_ACTIVE;
1649 return 0; 1652 return 0;
1650} 1653}
1651 1654
@@ -1670,17 +1673,17 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
1670#ifdef SERIAL_DEBUG_OPEN 1673#ifdef SERIAL_DEBUG_OPEN
1671 printk("rs_open %s, count = %d\n", tty->name, info->count); 1674 printk("rs_open %s, count = %d\n", tty->name, info->count);
1672#endif 1675#endif
1673 tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1676 tty->low_latency = (info->tport.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1674 1677
1675 /* 1678 /*
1676 * If the port is the middle of closing, bail out now 1679 * If the port is the middle of closing, bail out now
1677 */ 1680 */
1678 if (tty_hung_up_p(filp) || 1681 if (tty_hung_up_p(filp) ||
1679 (info->flags & ASYNC_CLOSING)) { 1682 (info->tport.flags & ASYNC_CLOSING)) {
1680 if (info->flags & ASYNC_CLOSING) 1683 if (info->tport.flags & ASYNC_CLOSING)
1681 interruptible_sleep_on(&info->tport.close_wait); 1684 interruptible_sleep_on(&info->tport.close_wait);
1682#ifdef SERIAL_DO_RESTART 1685#ifdef SERIAL_DO_RESTART
1683 return ((info->flags & ASYNC_HUP_NOTIFY) ? 1686 return ((info->tport.flags & ASYNC_HUP_NOTIFY) ?
1684 -EAGAIN : -ERESTARTSYS); 1687 -EAGAIN : -ERESTARTSYS);
1685#else 1688#else
1686 return -EAGAIN; 1689 return -EAGAIN;
@@ -1723,7 +1726,7 @@ static inline void line_info(struct seq_file *m, struct serial_state *state)
1723 1726
1724 local_irq_save(flags); 1727 local_irq_save(flags);
1725 status = ciab.pra; 1728 status = ciab.pra;
1726 control = (state->flags & ASYNC_INITIALIZED) ? state->MCR : status; 1729 control = (state->tport.flags & ASYNC_INITIALIZED) ? state->MCR : status;
1727 local_irq_restore(flags); 1730 local_irq_restore(flags);
1728 1731
1729 stat_buf[0] = 0; 1732 stat_buf[0] = 0;