aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/mxser.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-16 16:56:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:12:37 -0400
commit0ad9e7d1d6bf7829912be50d24d4f3f473006326 (patch)
tree2d4359c50127e7bba54e5cdd160c33d9e217af1d /drivers/char/mxser.c
parent9de6a51fee08f9e7020074738150441305e83af2 (diff)
mxser: use tty_port
Switch mxser to use the new tty_port structure Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/mxser.c')
-rw-r--r--drivers/char/mxser.c257
1 files changed, 126 insertions, 131 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 4b81a85c5b53..e83ccee03161 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -222,8 +222,8 @@ struct mxser_mon_ext {
222struct mxser_board; 222struct mxser_board;
223 223
224struct mxser_port { 224struct mxser_port {
225 struct tty_port port;
225 struct mxser_board *board; 226 struct mxser_board *board;
226 struct tty_struct *tty;
227 227
228 unsigned long ioaddr; 228 unsigned long ioaddr;
229 unsigned long opmode_ioaddr; 229 unsigned long opmode_ioaddr;
@@ -234,7 +234,6 @@ struct mxser_port {
234 int rx_low_water; 234 int rx_low_water;
235 int baud_base; /* max. speed */ 235 int baud_base; /* max. speed */
236 int type; /* UART type */ 236 int type; /* UART type */
237 int flags; /* defined in tty.h */
238 237
239 int x_char; /* xon/xoff character */ 238 int x_char; /* xon/xoff character */
240 int IER; /* Interrupt Enable Register */ 239 int IER; /* Interrupt Enable Register */
@@ -249,15 +248,12 @@ struct mxser_port {
249 unsigned char err_shadow; 248 unsigned char err_shadow;
250 unsigned long event; 249 unsigned long event;
251 250
252 int count; /* # of fd on device */
253 int blocked_open; /* # of blocked opens */
254 struct async_icount icount; /* kernel counters for 4 input interrupts */ 251 struct async_icount icount; /* kernel counters for 4 input interrupts */
255 int timeout; 252 int timeout;
256 253
257 int read_status_mask; 254 int read_status_mask;
258 int ignore_status_mask; 255 int ignore_status_mask;
259 int xmit_fifo_size; 256 int xmit_fifo_size;
260 unsigned char *xmit_buf;
261 int xmit_head; 257 int xmit_head;
262 int xmit_tail; 258 int xmit_tail;
263 int xmit_cnt; 259 int xmit_cnt;
@@ -267,7 +263,6 @@ struct mxser_port {
267 struct mxser_mon mon_data; 263 struct mxser_mon mon_data;
268 264
269 spinlock_t slock; 265 spinlock_t slock;
270 wait_queue_head_t open_wait;
271 wait_queue_head_t delta_msr_wait; 266 wait_queue_head_t delta_msr_wait;
272}; 267};
273 268
@@ -575,7 +570,7 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
575 */ 570 */
576 if ((filp->f_flags & O_NONBLOCK) || 571 if ((filp->f_flags & O_NONBLOCK) ||
577 test_bit(TTY_IO_ERROR, &tty->flags)) { 572 test_bit(TTY_IO_ERROR, &tty->flags)) {
578 port->flags |= ASYNC_NORMAL_ACTIVE; 573 port->port.flags |= ASYNC_NORMAL_ACTIVE;
579 return 0; 574 return 0;
580 } 575 }
581 576
@@ -585,32 +580,32 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
585 /* 580 /*
586 * Block waiting for the carrier detect and the line to become 581 * Block waiting for the carrier detect and the line to become
587 * free (i.e., not in use by the callout). While we are in 582 * free (i.e., not in use by the callout). While we are in
588 * this loop, port->count is dropped by one, so that 583 * this loop, port->port.count is dropped by one, so that
589 * mxser_close() knows when to free things. We restore it upon 584 * mxser_close() knows when to free things. We restore it upon
590 * exit, either normal or abnormal. 585 * exit, either normal or abnormal.
591 */ 586 */
592 retval = 0; 587 retval = 0;
593 add_wait_queue(&port->open_wait, &wait); 588 add_wait_queue(&port->port.open_wait, &wait);
594 589
595 spin_lock_irqsave(&port->slock, flags); 590 spin_lock_irqsave(&port->slock, flags);
596 if (!tty_hung_up_p(filp)) 591 if (!tty_hung_up_p(filp))
597 port->count--; 592 port->port.count--;
598 spin_unlock_irqrestore(&port->slock, flags); 593 spin_unlock_irqrestore(&port->slock, flags);
599 port->blocked_open++; 594 port->port.blocked_open++;
600 while (1) { 595 while (1) {
601 spin_lock_irqsave(&port->slock, flags); 596 spin_lock_irqsave(&port->slock, flags);
602 outb(inb(port->ioaddr + UART_MCR) | 597 outb(inb(port->ioaddr + UART_MCR) |
603 UART_MCR_DTR | UART_MCR_RTS, port->ioaddr + UART_MCR); 598 UART_MCR_DTR | UART_MCR_RTS, port->ioaddr + UART_MCR);
604 spin_unlock_irqrestore(&port->slock, flags); 599 spin_unlock_irqrestore(&port->slock, flags);
605 set_current_state(TASK_INTERRUPTIBLE); 600 set_current_state(TASK_INTERRUPTIBLE);
606 if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { 601 if (tty_hung_up_p(filp) || !(port->port.flags & ASYNC_INITIALIZED)) {
607 if (port->flags & ASYNC_HUP_NOTIFY) 602 if (port->port.flags & ASYNC_HUP_NOTIFY)
608 retval = -EAGAIN; 603 retval = -EAGAIN;
609 else 604 else
610 retval = -ERESTARTSYS; 605 retval = -ERESTARTSYS;
611 break; 606 break;
612 } 607 }
613 if (!(port->flags & ASYNC_CLOSING) && 608 if (!(port->port.flags & ASYNC_CLOSING) &&
614 (do_clocal || 609 (do_clocal ||
615 (inb(port->ioaddr + UART_MSR) & UART_MSR_DCD))) 610 (inb(port->ioaddr + UART_MSR) & UART_MSR_DCD)))
616 break; 611 break;
@@ -621,13 +616,13 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
621 schedule(); 616 schedule();
622 } 617 }
623 set_current_state(TASK_RUNNING); 618 set_current_state(TASK_RUNNING);
624 remove_wait_queue(&port->open_wait, &wait); 619 remove_wait_queue(&port->port.open_wait, &wait);
625 if (!tty_hung_up_p(filp)) 620 if (!tty_hung_up_p(filp))
626 port->count++; 621 port->port.count++;
627 port->blocked_open--; 622 port->port.blocked_open--;
628 if (retval) 623 if (retval)
629 return retval; 624 return retval;
630 port->flags |= ASYNC_NORMAL_ACTIVE; 625 port->port.flags |= ASYNC_NORMAL_ACTIVE;
631 return 0; 626 return 0;
632} 627}
633 628
@@ -636,7 +631,7 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
636 int quot = 0, baud; 631 int quot = 0, baud;
637 unsigned char cval; 632 unsigned char cval;
638 633
639 if (!info->tty || !info->tty->termios) 634 if (!info->port.tty || !info->port.tty->termios)
640 return -1; 635 return -1;
641 636
642 if (!(info->ioaddr)) 637 if (!(info->ioaddr))
@@ -647,13 +642,13 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
647 642
648 if (newspd == 134) { 643 if (newspd == 134) {
649 quot = 2 * info->baud_base / 269; 644 quot = 2 * info->baud_base / 269;
650 tty_encode_baud_rate(info->tty, 134, 134); 645 tty_encode_baud_rate(info->port.tty, 134, 134);
651 } else if (newspd) { 646 } else if (newspd) {
652 quot = info->baud_base / newspd; 647 quot = info->baud_base / newspd;
653 if (quot == 0) 648 if (quot == 0)
654 quot = 1; 649 quot = 1;
655 baud = info->baud_base/quot; 650 baud = info->baud_base/quot;
656 tty_encode_baud_rate(info->tty, baud, baud); 651 tty_encode_baud_rate(info->port.tty, baud, baud);
657 } else { 652 } else {
658 quot = 0; 653 quot = 0;
659 } 654 }
@@ -679,7 +674,7 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
679 outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */ 674 outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */
680 675
681#ifdef BOTHER 676#ifdef BOTHER
682 if (C_BAUD(info->tty) == BOTHER) { 677 if (C_BAUD(info->port.tty) == BOTHER) {
683 quot = info->baud_base % newspd; 678 quot = info->baud_base % newspd;
684 quot *= 8; 679 quot *= 8;
685 if (quot % newspd > newspd / 2) { 680 if (quot % newspd > newspd / 2) {
@@ -707,14 +702,14 @@ static int mxser_change_speed(struct mxser_port *info,
707 int ret = 0; 702 int ret = 0;
708 unsigned char status; 703 unsigned char status;
709 704
710 if (!info->tty || !info->tty->termios) 705 if (!info->port.tty || !info->port.tty->termios)
711 return ret; 706 return ret;
712 cflag = info->tty->termios->c_cflag; 707 cflag = info->port.tty->termios->c_cflag;
713 if (!(info->ioaddr)) 708 if (!(info->ioaddr))
714 return ret; 709 return ret;
715 710
716 if (mxser_set_baud_method[info->tty->index] == 0) 711 if (mxser_set_baud_method[info->port.tty->index] == 0)
717 mxser_set_baud(info, tty_get_baud_rate(info->tty)); 712 mxser_set_baud(info, tty_get_baud_rate(info->port.tty));
718 713
719 /* byte size and parity */ 714 /* byte size and parity */
720 switch (cflag & CSIZE) { 715 switch (cflag & CSIZE) {
@@ -777,15 +772,15 @@ static int mxser_change_speed(struct mxser_port *info,
777 info->IER &= ~UART_IER_MSI; 772 info->IER &= ~UART_IER_MSI;
778 info->MCR &= ~UART_MCR_AFE; 773 info->MCR &= ~UART_MCR_AFE;
779 if (cflag & CRTSCTS) { 774 if (cflag & CRTSCTS) {
780 info->flags |= ASYNC_CTS_FLOW; 775 info->port.flags |= ASYNC_CTS_FLOW;
781 info->IER |= UART_IER_MSI; 776 info->IER |= UART_IER_MSI;
782 if ((info->type == PORT_16550A) || (info->board->chip_flag)) { 777 if ((info->type == PORT_16550A) || (info->board->chip_flag)) {
783 info->MCR |= UART_MCR_AFE; 778 info->MCR |= UART_MCR_AFE;
784 } else { 779 } else {
785 status = inb(info->ioaddr + UART_MSR); 780 status = inb(info->ioaddr + UART_MSR);
786 if (info->tty->hw_stopped) { 781 if (info->port.tty->hw_stopped) {
787 if (status & UART_MSR_CTS) { 782 if (status & UART_MSR_CTS) {
788 info->tty->hw_stopped = 0; 783 info->port.tty->hw_stopped = 0;
789 if (info->type != PORT_16550A && 784 if (info->type != PORT_16550A &&
790 !info->board->chip_flag) { 785 !info->board->chip_flag) {
791 outb(info->IER & ~UART_IER_THRI, 786 outb(info->IER & ~UART_IER_THRI,
@@ -795,11 +790,11 @@ static int mxser_change_speed(struct mxser_port *info,
795 outb(info->IER, info->ioaddr + 790 outb(info->IER, info->ioaddr +
796 UART_IER); 791 UART_IER);
797 } 792 }
798 tty_wakeup(info->tty); 793 tty_wakeup(info->port.tty);
799 } 794 }
800 } else { 795 } else {
801 if (!(status & UART_MSR_CTS)) { 796 if (!(status & UART_MSR_CTS)) {
802 info->tty->hw_stopped = 1; 797 info->port.tty->hw_stopped = 1;
803 if ((info->type != PORT_16550A) && 798 if ((info->type != PORT_16550A) &&
804 (!info->board->chip_flag)) { 799 (!info->board->chip_flag)) {
805 info->IER &= ~UART_IER_THRI; 800 info->IER &= ~UART_IER_THRI;
@@ -810,13 +805,13 @@ static int mxser_change_speed(struct mxser_port *info,
810 } 805 }
811 } 806 }
812 } else { 807 } else {
813 info->flags &= ~ASYNC_CTS_FLOW; 808 info->port.flags &= ~ASYNC_CTS_FLOW;
814 } 809 }
815 outb(info->MCR, info->ioaddr + UART_MCR); 810 outb(info->MCR, info->ioaddr + UART_MCR);
816 if (cflag & CLOCAL) { 811 if (cflag & CLOCAL) {
817 info->flags &= ~ASYNC_CHECK_CD; 812 info->port.flags &= ~ASYNC_CHECK_CD;
818 } else { 813 } else {
819 info->flags |= ASYNC_CHECK_CD; 814 info->port.flags |= ASYNC_CHECK_CD;
820 info->IER |= UART_IER_MSI; 815 info->IER |= UART_IER_MSI;
821 } 816 }
822 outb(info->IER, info->ioaddr + UART_IER); 817 outb(info->IER, info->ioaddr + UART_IER);
@@ -825,21 +820,21 @@ static int mxser_change_speed(struct mxser_port *info,
825 * Set up parity check flag 820 * Set up parity check flag
826 */ 821 */
827 info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; 822 info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
828 if (I_INPCK(info->tty)) 823 if (I_INPCK(info->port.tty))
829 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; 824 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE;
830 if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) 825 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
831 info->read_status_mask |= UART_LSR_BI; 826 info->read_status_mask |= UART_LSR_BI;
832 827
833 info->ignore_status_mask = 0; 828 info->ignore_status_mask = 0;
834 829
835 if (I_IGNBRK(info->tty)) { 830 if (I_IGNBRK(info->port.tty)) {
836 info->ignore_status_mask |= UART_LSR_BI; 831 info->ignore_status_mask |= UART_LSR_BI;
837 info->read_status_mask |= UART_LSR_BI; 832 info->read_status_mask |= UART_LSR_BI;
838 /* 833 /*
839 * If we're ignore parity and break indicators, ignore 834 * If we're ignore parity and break indicators, ignore
840 * overruns too. (For real raw support). 835 * overruns too. (For real raw support).
841 */ 836 */
842 if (I_IGNPAR(info->tty)) { 837 if (I_IGNPAR(info->port.tty)) {
843 info->ignore_status_mask |= 838 info->ignore_status_mask |=
844 UART_LSR_OE | 839 UART_LSR_OE |
845 UART_LSR_PE | 840 UART_LSR_PE |
@@ -851,16 +846,16 @@ static int mxser_change_speed(struct mxser_port *info,
851 } 846 }
852 } 847 }
853 if (info->board->chip_flag) { 848 if (info->board->chip_flag) {
854 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(info->tty)); 849 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(info->port.tty));
855 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(info->tty)); 850 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(info->port.tty));
856 if (I_IXON(info->tty)) { 851 if (I_IXON(info->port.tty)) {
857 mxser_enable_must_rx_software_flow_control( 852 mxser_enable_must_rx_software_flow_control(
858 info->ioaddr); 853 info->ioaddr);
859 } else { 854 } else {
860 mxser_disable_must_rx_software_flow_control( 855 mxser_disable_must_rx_software_flow_control(
861 info->ioaddr); 856 info->ioaddr);
862 } 857 }
863 if (I_IXOFF(info->tty)) { 858 if (I_IXOFF(info->port.tty)) {
864 mxser_enable_must_tx_software_flow_control( 859 mxser_enable_must_tx_software_flow_control(
865 info->ioaddr); 860 info->ioaddr);
866 } else { 861 } else {
@@ -890,15 +885,15 @@ static void mxser_check_modem_status(struct mxser_port *port, int status)
890 port->mon_data.modem_status = status; 885 port->mon_data.modem_status = status;
891 wake_up_interruptible(&port->delta_msr_wait); 886 wake_up_interruptible(&port->delta_msr_wait);
892 887
893 if ((port->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { 888 if ((port->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
894 if (status & UART_MSR_DCD) 889 if (status & UART_MSR_DCD)
895 wake_up_interruptible(&port->open_wait); 890 wake_up_interruptible(&port->port.open_wait);
896 } 891 }
897 892
898 if (port->flags & ASYNC_CTS_FLOW) { 893 if (port->port.flags & ASYNC_CTS_FLOW) {
899 if (port->tty->hw_stopped) { 894 if (port->port.tty->hw_stopped) {
900 if (status & UART_MSR_CTS) { 895 if (status & UART_MSR_CTS) {
901 port->tty->hw_stopped = 0; 896 port->port.tty->hw_stopped = 0;
902 897
903 if ((port->type != PORT_16550A) && 898 if ((port->type != PORT_16550A) &&
904 (!port->board->chip_flag)) { 899 (!port->board->chip_flag)) {
@@ -908,11 +903,11 @@ static void mxser_check_modem_status(struct mxser_port *port, int status)
908 outb(port->IER, port->ioaddr + 903 outb(port->IER, port->ioaddr +
909 UART_IER); 904 UART_IER);
910 } 905 }
911 tty_wakeup(port->tty); 906 tty_wakeup(port->port.tty);
912 } 907 }
913 } else { 908 } else {
914 if (!(status & UART_MSR_CTS)) { 909 if (!(status & UART_MSR_CTS)) {
915 port->tty->hw_stopped = 1; 910 port->port.tty->hw_stopped = 1;
916 if (port->type != PORT_16550A && 911 if (port->type != PORT_16550A &&
917 !port->board->chip_flag) { 912 !port->board->chip_flag) {
918 port->IER &= ~UART_IER_THRI; 913 port->IER &= ~UART_IER_THRI;
@@ -935,23 +930,23 @@ static int mxser_startup(struct mxser_port *info)
935 930
936 spin_lock_irqsave(&info->slock, flags); 931 spin_lock_irqsave(&info->slock, flags);
937 932
938 if (info->flags & ASYNC_INITIALIZED) { 933 if (info->port.flags & ASYNC_INITIALIZED) {
939 free_page(page); 934 free_page(page);
940 spin_unlock_irqrestore(&info->slock, flags); 935 spin_unlock_irqrestore(&info->slock, flags);
941 return 0; 936 return 0;
942 } 937 }
943 938
944 if (!info->ioaddr || !info->type) { 939 if (!info->ioaddr || !info->type) {
945 if (info->tty) 940 if (info->port.tty)
946 set_bit(TTY_IO_ERROR, &info->tty->flags); 941 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
947 free_page(page); 942 free_page(page);
948 spin_unlock_irqrestore(&info->slock, flags); 943 spin_unlock_irqrestore(&info->slock, flags);
949 return 0; 944 return 0;
950 } 945 }
951 if (info->xmit_buf) 946 if (info->port.xmit_buf)
952 free_page(page); 947 free_page(page);
953 else 948 else
954 info->xmit_buf = (unsigned char *) page; 949 info->port.xmit_buf = (unsigned char *) page;
955 950
956 /* 951 /*
957 * Clear the FIFO buffers and disable them 952 * Clear the FIFO buffers and disable them
@@ -973,8 +968,8 @@ static int mxser_startup(struct mxser_port *info)
973 if (inb(info->ioaddr + UART_LSR) == 0xff) { 968 if (inb(info->ioaddr + UART_LSR) == 0xff) {
974 spin_unlock_irqrestore(&info->slock, flags); 969 spin_unlock_irqrestore(&info->slock, flags);
975 if (capable(CAP_SYS_ADMIN)) { 970 if (capable(CAP_SYS_ADMIN)) {
976 if (info->tty) 971 if (info->port.tty)
977 set_bit(TTY_IO_ERROR, &info->tty->flags); 972 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
978 return 0; 973 return 0;
979 } else 974 } else
980 return -ENODEV; 975 return -ENODEV;
@@ -1012,15 +1007,15 @@ static int mxser_startup(struct mxser_port *info)
1012 (void) inb(info->ioaddr + UART_IIR); 1007 (void) inb(info->ioaddr + UART_IIR);
1013 (void) inb(info->ioaddr + UART_MSR); 1008 (void) inb(info->ioaddr + UART_MSR);
1014 1009
1015 if (info->tty) 1010 if (info->port.tty)
1016 clear_bit(TTY_IO_ERROR, &info->tty->flags); 1011 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
1017 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 1012 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
1018 1013
1019 /* 1014 /*
1020 * and set the speed of the serial port 1015 * and set the speed of the serial port
1021 */ 1016 */
1022 mxser_change_speed(info, NULL); 1017 mxser_change_speed(info, NULL);
1023 info->flags |= ASYNC_INITIALIZED; 1018 info->port.flags |= ASYNC_INITIALIZED;
1024 spin_unlock_irqrestore(&info->slock, flags); 1019 spin_unlock_irqrestore(&info->slock, flags);
1025 1020
1026 return 0; 1021 return 0;
@@ -1034,7 +1029,7 @@ static void mxser_shutdown(struct mxser_port *info)
1034{ 1029{
1035 unsigned long flags; 1030 unsigned long flags;
1036 1031
1037 if (!(info->flags & ASYNC_INITIALIZED)) 1032 if (!(info->port.flags & ASYNC_INITIALIZED))
1038 return; 1033 return;
1039 1034
1040 spin_lock_irqsave(&info->slock, flags); 1035 spin_lock_irqsave(&info->slock, flags);
@@ -1048,15 +1043,15 @@ static void mxser_shutdown(struct mxser_port *info)
1048 /* 1043 /*
1049 * Free the IRQ, if necessary 1044 * Free the IRQ, if necessary
1050 */ 1045 */
1051 if (info->xmit_buf) { 1046 if (info->port.xmit_buf) {
1052 free_page((unsigned long) info->xmit_buf); 1047 free_page((unsigned long) info->port.xmit_buf);
1053 info->xmit_buf = NULL; 1048 info->port.xmit_buf = NULL;
1054 } 1049 }
1055 1050
1056 info->IER = 0; 1051 info->IER = 0;
1057 outb(0x00, info->ioaddr + UART_IER); 1052 outb(0x00, info->ioaddr + UART_IER);
1058 1053
1059 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) 1054 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL))
1060 info->MCR &= ~(UART_MCR_DTR | UART_MCR_RTS); 1055 info->MCR &= ~(UART_MCR_DTR | UART_MCR_RTS);
1061 outb(info->MCR, info->ioaddr + UART_MCR); 1056 outb(info->MCR, info->ioaddr + UART_MCR);
1062 1057
@@ -1072,10 +1067,10 @@ static void mxser_shutdown(struct mxser_port *info)
1072 /* read data port to reset things */ 1067 /* read data port to reset things */
1073 (void) inb(info->ioaddr + UART_RX); 1068 (void) inb(info->ioaddr + UART_RX);
1074 1069
1075 if (info->tty) 1070 if (info->port.tty)
1076 set_bit(TTY_IO_ERROR, &info->tty->flags); 1071 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
1077 1072
1078 info->flags &= ~ASYNC_INITIALIZED; 1073 info->port.flags &= ~ASYNC_INITIALIZED;
1079 1074
1080 if (info->board->chip_flag) 1075 if (info->board->chip_flag)
1081 SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr); 1076 SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr);
@@ -1105,12 +1100,12 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
1105 return -ENODEV; 1100 return -ENODEV;
1106 1101
1107 tty->driver_data = info; 1102 tty->driver_data = info;
1108 info->tty = tty; 1103 info->port.tty = tty;
1109 /* 1104 /*
1110 * Start up serial port 1105 * Start up serial port
1111 */ 1106 */
1112 spin_lock_irqsave(&info->slock, flags); 1107 spin_lock_irqsave(&info->slock, flags);
1113 info->count++; 1108 info->port.count++;
1114 spin_unlock_irqrestore(&info->slock, flags); 1109 spin_unlock_irqrestore(&info->slock, flags);
1115 retval = mxser_startup(info); 1110 retval = mxser_startup(info);
1116 if (retval) 1111 if (retval)
@@ -1170,34 +1165,34 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1170 spin_unlock_irqrestore(&info->slock, flags); 1165 spin_unlock_irqrestore(&info->slock, flags);
1171 return; 1166 return;
1172 } 1167 }
1173 if ((tty->count == 1) && (info->count != 1)) { 1168 if ((tty->count == 1) && (info->port.count != 1)) {
1174 /* 1169 /*
1175 * Uh, oh. tty->count is 1, which means that the tty 1170 * Uh, oh. tty->count is 1, which means that the tty
1176 * structure will be freed. Info->count should always 1171 * structure will be freed. Info->port.count should always
1177 * be one in these conditions. If it's greater than 1172 * be one in these conditions. If it's greater than
1178 * one, we've got real problems, since it means the 1173 * one, we've got real problems, since it means the
1179 * serial port won't be shutdown. 1174 * serial port won't be shutdown.
1180 */ 1175 */
1181 printk(KERN_ERR "mxser_close: bad serial port count; " 1176 printk(KERN_ERR "mxser_close: bad serial port count; "
1182 "tty->count is 1, info->count is %d\n", info->count); 1177 "tty->count is 1, info->port.count is %d\n", info->port.count);
1183 info->count = 1; 1178 info->port.count = 1;
1184 } 1179 }
1185 if (--info->count < 0) { 1180 if (--info->port.count < 0) {
1186 printk(KERN_ERR "mxser_close: bad serial port count for " 1181 printk(KERN_ERR "mxser_close: bad serial port count for "
1187 "ttys%d: %d\n", tty->index, info->count); 1182 "ttys%d: %d\n", tty->index, info->port.count);
1188 info->count = 0; 1183 info->port.count = 0;
1189 } 1184 }
1190 if (info->count) { 1185 if (info->port.count) {
1191 spin_unlock_irqrestore(&info->slock, flags); 1186 spin_unlock_irqrestore(&info->slock, flags);
1192 return; 1187 return;
1193 } 1188 }
1194 info->flags |= ASYNC_CLOSING; 1189 info->port.flags |= ASYNC_CLOSING;
1195 spin_unlock_irqrestore(&info->slock, flags); 1190 spin_unlock_irqrestore(&info->slock, flags);
1196 /* 1191 /*
1197 * Save the termios structure, since this port may have 1192 * Save the termios structure, since this port may have
1198 * separate termios for callout and dialin. 1193 * separate termios for callout and dialin.
1199 */ 1194 */
1200 if (info->flags & ASYNC_NORMAL_ACTIVE) 1195 if (info->port.flags & ASYNC_NORMAL_ACTIVE)
1201 info->normal_termios = *tty->termios; 1196 info->normal_termios = *tty->termios;
1202 /* 1197 /*
1203 * Now we wait for the transmit buffer to clear; and we notify 1198 * Now we wait for the transmit buffer to clear; and we notify
@@ -1216,7 +1211,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1216 if (info->board->chip_flag) 1211 if (info->board->chip_flag)
1217 info->IER &= ~MOXA_MUST_RECV_ISR; 1212 info->IER &= ~MOXA_MUST_RECV_ISR;
1218 1213
1219 if (info->flags & ASYNC_INITIALIZED) { 1214 if (info->port.flags & ASYNC_INITIALIZED) {
1220 outb(info->IER, info->ioaddr + UART_IER); 1215 outb(info->IER, info->ioaddr + UART_IER);
1221 /* 1216 /*
1222 * Before we drop DTR, make sure the UART transmitter 1217 * Before we drop DTR, make sure the UART transmitter
@@ -1237,14 +1232,14 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1237 1232
1238 tty->closing = 0; 1233 tty->closing = 0;
1239 info->event = 0; 1234 info->event = 0;
1240 info->tty = NULL; 1235 info->port.tty = NULL;
1241 if (info->blocked_open) { 1236 if (info->port.blocked_open) {
1242 if (info->close_delay) 1237 if (info->close_delay)
1243 schedule_timeout_interruptible(info->close_delay); 1238 schedule_timeout_interruptible(info->close_delay);
1244 wake_up_interruptible(&info->open_wait); 1239 wake_up_interruptible(&info->port.open_wait);
1245 } 1240 }
1246 1241
1247 info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); 1242 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
1248} 1243}
1249 1244
1250static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) 1245static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count)
@@ -1253,7 +1248,7 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou
1253 struct mxser_port *info = tty->driver_data; 1248 struct mxser_port *info = tty->driver_data;
1254 unsigned long flags; 1249 unsigned long flags;
1255 1250
1256 if (!info->xmit_buf) 1251 if (!info->port.xmit_buf)
1257 return 0; 1252 return 0;
1258 1253
1259 while (1) { 1254 while (1) {
@@ -1262,7 +1257,7 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou
1262 if (c <= 0) 1257 if (c <= 0)
1263 break; 1258 break;
1264 1259
1265 memcpy(info->xmit_buf + info->xmit_head, buf, c); 1260 memcpy(info->port.xmit_buf + info->xmit_head, buf, c);
1266 spin_lock_irqsave(&info->slock, flags); 1261 spin_lock_irqsave(&info->slock, flags);
1267 info->xmit_head = (info->xmit_head + c) & 1262 info->xmit_head = (info->xmit_head + c) &
1268 (SERIAL_XMIT_SIZE - 1); 1263 (SERIAL_XMIT_SIZE - 1);
@@ -1294,14 +1289,14 @@ static int mxser_put_char(struct tty_struct *tty, unsigned char ch)
1294 struct mxser_port *info = tty->driver_data; 1289 struct mxser_port *info = tty->driver_data;
1295 unsigned long flags; 1290 unsigned long flags;
1296 1291
1297 if (!info->xmit_buf) 1292 if (!info->port.xmit_buf)
1298 return 0; 1293 return 0;
1299 1294
1300 if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1) 1295 if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1)
1301 return 0; 1296 return 0;
1302 1297
1303 spin_lock_irqsave(&info->slock, flags); 1298 spin_lock_irqsave(&info->slock, flags);
1304 info->xmit_buf[info->xmit_head++] = ch; 1299 info->port.xmit_buf[info->xmit_head++] = ch;
1305 info->xmit_head &= SERIAL_XMIT_SIZE - 1; 1300 info->xmit_head &= SERIAL_XMIT_SIZE - 1;
1306 info->xmit_cnt++; 1301 info->xmit_cnt++;
1307 spin_unlock_irqrestore(&info->slock, flags); 1302 spin_unlock_irqrestore(&info->slock, flags);
@@ -1327,7 +1322,7 @@ static void mxser_flush_chars(struct tty_struct *tty)
1327 1322
1328 if (info->xmit_cnt <= 0 || 1323 if (info->xmit_cnt <= 0 ||
1329 tty->stopped || 1324 tty->stopped ||
1330 !info->xmit_buf || 1325 !info->port.xmit_buf ||
1331 (tty->hw_stopped && 1326 (tty->hw_stopped &&
1332 (info->type != PORT_16550A) && 1327 (info->type != PORT_16550A) &&
1333 (!info->board->chip_flag) 1328 (!info->board->chip_flag)
@@ -1370,10 +1365,10 @@ static int mxser_get_serial_info(struct mxser_port *info,
1370{ 1365{
1371 struct serial_struct tmp = { 1366 struct serial_struct tmp = {
1372 .type = info->type, 1367 .type = info->type,
1373 .line = info->tty->index, 1368 .line = info->port.tty->index,
1374 .port = info->ioaddr, 1369 .port = info->ioaddr,
1375 .irq = info->board->irq, 1370 .irq = info->board->irq,
1376 .flags = info->flags, 1371 .flags = info->port.flags,
1377 .baud_base = info->baud_base, 1372 .baud_base = info->baud_base,
1378 .close_delay = info->close_delay, 1373 .close_delay = info->close_delay,
1379 .closing_wait = info->closing_wait, 1374 .closing_wait = info->closing_wait,
@@ -1403,33 +1398,33 @@ static int mxser_set_serial_info(struct mxser_port *info,
1403 new_serial.port != info->ioaddr) 1398 new_serial.port != info->ioaddr)
1404 return -EINVAL; 1399 return -EINVAL;
1405 1400
1406 flags = info->flags & ASYNC_SPD_MASK; 1401 flags = info->port.flags & ASYNC_SPD_MASK;
1407 1402
1408 if (!capable(CAP_SYS_ADMIN)) { 1403 if (!capable(CAP_SYS_ADMIN)) {
1409 if ((new_serial.baud_base != info->baud_base) || 1404 if ((new_serial.baud_base != info->baud_base) ||
1410 (new_serial.close_delay != info->close_delay) || 1405 (new_serial.close_delay != info->close_delay) ||
1411 ((new_serial.flags & ~ASYNC_USR_MASK) != (info->flags & ~ASYNC_USR_MASK))) 1406 ((new_serial.flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK)))
1412 return -EPERM; 1407 return -EPERM;
1413 info->flags = ((info->flags & ~ASYNC_USR_MASK) | 1408 info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |
1414 (new_serial.flags & ASYNC_USR_MASK)); 1409 (new_serial.flags & ASYNC_USR_MASK));
1415 } else { 1410 } else {
1416 /* 1411 /*
1417 * OK, past this point, all the error checking has been done. 1412 * OK, past this point, all the error checking has been done.
1418 * At this point, we start making changes..... 1413 * At this point, we start making changes.....
1419 */ 1414 */
1420 info->flags = ((info->flags & ~ASYNC_FLAGS) | 1415 info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |
1421 (new_serial.flags & ASYNC_FLAGS)); 1416 (new_serial.flags & ASYNC_FLAGS));
1422 info->close_delay = new_serial.close_delay * HZ / 100; 1417 info->close_delay = new_serial.close_delay * HZ / 100;
1423 info->closing_wait = new_serial.closing_wait * HZ / 100; 1418 info->closing_wait = new_serial.closing_wait * HZ / 100;
1424 info->tty->low_latency = 1419 info->port.tty->low_latency =
1425 (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1420 (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1426 info->tty->low_latency = 0; 1421 info->port.tty->low_latency = 0;
1427 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST && 1422 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST &&
1428 (new_serial.baud_base != info->baud_base || 1423 (new_serial.baud_base != info->baud_base ||
1429 new_serial.custom_divisor != 1424 new_serial.custom_divisor !=
1430 info->custom_divisor)) { 1425 info->custom_divisor)) {
1431 baud = new_serial.baud_base / new_serial.custom_divisor; 1426 baud = new_serial.baud_base / new_serial.custom_divisor;
1432 tty_encode_baud_rate(info->tty, baud, baud); 1427 tty_encode_baud_rate(info->port.tty, baud, baud);
1433 } 1428 }
1434 } 1429 }
1435 1430
@@ -1437,8 +1432,8 @@ static int mxser_set_serial_info(struct mxser_port *info,
1437 1432
1438 process_txrx_fifo(info); 1433 process_txrx_fifo(info);
1439 1434
1440 if (info->flags & ASYNC_INITIALIZED) { 1435 if (info->port.flags & ASYNC_INITIALIZED) {
1441 if (flags != (info->flags & ASYNC_SPD_MASK)) { 1436 if (flags != (info->port.flags & ASYNC_SPD_MASK)) {
1442 spin_lock_irqsave(&info->slock, sl_flags); 1437 spin_lock_irqsave(&info->slock, sl_flags);
1443 mxser_change_speed(info, NULL); 1438 mxser_change_speed(info, NULL);
1444 spin_unlock_irqrestore(&info->slock, sl_flags); 1439 spin_unlock_irqrestore(&info->slock, sl_flags);
@@ -1693,12 +1688,12 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1693 continue; 1688 continue;
1694 } 1689 }
1695 1690
1696 if (!port->tty || !port->tty->termios) 1691 if (!port->port.tty || !port->port.tty->termios)
1697 GMStatus[i].cflag = 1692 GMStatus[i].cflag =
1698 port->normal_termios.c_cflag; 1693 port->normal_termios.c_cflag;
1699 else 1694 else
1700 GMStatus[i].cflag = 1695 GMStatus[i].cflag =
1701 port->tty->termios->c_cflag; 1696 port->port.tty->termios->c_cflag;
1702 1697
1703 status = inb(port->ioaddr + UART_MSR); 1698 status = inb(port->ioaddr + UART_MSR);
1704 if (status & 0x80 /*UART_MSR_DCD */ ) 1699 if (status & 0x80 /*UART_MSR_DCD */ )
@@ -1755,14 +1750,14 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1755 mon_data_ext.modem_status[i] = 1750 mon_data_ext.modem_status[i] =
1756 port->mon_data.modem_status; 1751 port->mon_data.modem_status;
1757 mon_data_ext.baudrate[i] = 1752 mon_data_ext.baudrate[i] =
1758 tty_get_baud_rate(port->tty); 1753 tty_get_baud_rate(port->port.tty);
1759 1754
1760 if (!port->tty || !port->tty->termios) { 1755 if (!port->port.tty || !port->port.tty->termios) {
1761 cflag = port->normal_termios.c_cflag; 1756 cflag = port->normal_termios.c_cflag;
1762 iflag = port->normal_termios.c_iflag; 1757 iflag = port->normal_termios.c_iflag;
1763 } else { 1758 } else {
1764 cflag = port->tty->termios->c_cflag; 1759 cflag = port->port.tty->termios->c_cflag;
1765 iflag = port->tty->termios->c_iflag; 1760 iflag = port->port.tty->termios->c_iflag;
1766 } 1761 }
1767 1762
1768 mon_data_ext.databits[i] = cflag & CSIZE; 1763 mon_data_ext.databits[i] = cflag & CSIZE;
@@ -1989,7 +1984,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
1989 else 1984 else
1990 info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFXENT; 1985 info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFXENT;
1991 1986
1992 if (info->tty->hw_stopped) 1987 if (info->port.tty->hw_stopped)
1993 info->mon_data.hold_reason |= NPPI_NOTIFY_CTSHOLD; 1988 info->mon_data.hold_reason |= NPPI_NOTIFY_CTSHOLD;
1994 else 1989 else
1995 info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; 1990 info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD;
@@ -2038,7 +2033,7 @@ static void mxser_stoprx(struct tty_struct *tty)
2038 } 2033 }
2039 } 2034 }
2040 2035
2041 if (info->tty->termios->c_cflag & CRTSCTS) { 2036 if (info->port.tty->termios->c_cflag & CRTSCTS) {
2042 info->MCR &= ~UART_MCR_RTS; 2037 info->MCR &= ~UART_MCR_RTS;
2043 outb(info->MCR, info->ioaddr + UART_MCR); 2038 outb(info->MCR, info->ioaddr + UART_MCR);
2044 } 2039 }
@@ -2075,7 +2070,7 @@ static void mxser_unthrottle(struct tty_struct *tty)
2075 } 2070 }
2076 } 2071 }
2077 2072
2078 if (info->tty->termios->c_cflag & CRTSCTS) { 2073 if (info->port.tty->termios->c_cflag & CRTSCTS) {
2079 info->MCR |= UART_MCR_RTS; 2074 info->MCR |= UART_MCR_RTS;
2080 outb(info->MCR, info->ioaddr + UART_MCR); 2075 outb(info->MCR, info->ioaddr + UART_MCR);
2081 } 2076 }
@@ -2106,7 +2101,7 @@ static void mxser_start(struct tty_struct *tty)
2106 unsigned long flags; 2101 unsigned long flags;
2107 2102
2108 spin_lock_irqsave(&info->slock, flags); 2103 spin_lock_irqsave(&info->slock, flags);
2109 if (info->xmit_cnt && info->xmit_buf) { 2104 if (info->xmit_cnt && info->port.xmit_buf) {
2110 outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); 2105 outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER);
2111 info->IER |= UART_IER_THRI; 2106 info->IER |= UART_IER_THRI;
2112 outb(info->IER, info->ioaddr + UART_IER); 2107 outb(info->IER, info->ioaddr + UART_IER);
@@ -2220,10 +2215,10 @@ static void mxser_hangup(struct tty_struct *tty)
2220 mxser_flush_buffer(tty); 2215 mxser_flush_buffer(tty);
2221 mxser_shutdown(info); 2216 mxser_shutdown(info);
2222 info->event = 0; 2217 info->event = 0;
2223 info->count = 0; 2218 info->port.count = 0;
2224 info->flags &= ~ASYNC_NORMAL_ACTIVE; 2219 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
2225 info->tty = NULL; 2220 info->port.tty = NULL;
2226 wake_up_interruptible(&info->open_wait); 2221 wake_up_interruptible(&info->port.open_wait);
2227} 2222}
2228 2223
2229/* 2224/*
@@ -2246,7 +2241,7 @@ static void mxser_rs_break(struct tty_struct *tty, int break_state)
2246 2241
2247static void mxser_receive_chars(struct mxser_port *port, int *status) 2242static void mxser_receive_chars(struct mxser_port *port, int *status)
2248{ 2243{
2249 struct tty_struct *tty = port->tty; 2244 struct tty_struct *tty = port->port.tty;
2250 unsigned char ch, gdl; 2245 unsigned char ch, gdl;
2251 int ignored = 0; 2246 int ignored = 0;
2252 int cnt = 0; 2247 int cnt = 0;
@@ -2302,7 +2297,7 @@ intr_old:
2302 flag = TTY_BREAK; 2297 flag = TTY_BREAK;
2303 port->icount.brk++; 2298 port->icount.brk++;
2304 2299
2305 if (port->flags & ASYNC_SAK) 2300 if (port->port.flags & ASYNC_SAK)
2306 do_SAK(tty); 2301 do_SAK(tty);
2307 } else if (*status & UART_LSR_PE) { 2302 } else if (*status & UART_LSR_PE) {
2308 flag = TTY_PARITY; 2303 flag = TTY_PARITY;
@@ -2333,7 +2328,7 @@ intr_old:
2333 } while (*status & UART_LSR_DR); 2328 } while (*status & UART_LSR_DR);
2334 2329
2335end_intr: 2330end_intr:
2336 mxvar_log.rxcnt[port->tty->index] += cnt; 2331 mxvar_log.rxcnt[port->port.tty->index] += cnt;
2337 port->mon_data.rxcnt += cnt; 2332 port->mon_data.rxcnt += cnt;
2338 port->mon_data.up_rxcnt += cnt; 2333 port->mon_data.up_rxcnt += cnt;
2339 2334
@@ -2354,18 +2349,18 @@ static void mxser_transmit_chars(struct mxser_port *port)
2354 if (port->x_char) { 2349 if (port->x_char) {
2355 outb(port->x_char, port->ioaddr + UART_TX); 2350 outb(port->x_char, port->ioaddr + UART_TX);
2356 port->x_char = 0; 2351 port->x_char = 0;
2357 mxvar_log.txcnt[port->tty->index]++; 2352 mxvar_log.txcnt[port->port.tty->index]++;
2358 port->mon_data.txcnt++; 2353 port->mon_data.txcnt++;
2359 port->mon_data.up_txcnt++; 2354 port->mon_data.up_txcnt++;
2360 port->icount.tx++; 2355 port->icount.tx++;
2361 return; 2356 return;
2362 } 2357 }
2363 2358
2364 if (port->xmit_buf == NULL) 2359 if (port->port.xmit_buf == NULL)
2365 return; 2360 return;
2366 2361
2367 if ((port->xmit_cnt <= 0) || port->tty->stopped || 2362 if ((port->xmit_cnt <= 0) || port->port.tty->stopped ||
2368 (port->tty->hw_stopped && 2363 (port->port.tty->hw_stopped &&
2369 (port->type != PORT_16550A) && 2364 (port->type != PORT_16550A) &&
2370 (!port->board->chip_flag))) { 2365 (!port->board->chip_flag))) {
2371 port->IER &= ~UART_IER_THRI; 2366 port->IER &= ~UART_IER_THRI;
@@ -2376,20 +2371,20 @@ static void mxser_transmit_chars(struct mxser_port *port)
2376 cnt = port->xmit_cnt; 2371 cnt = port->xmit_cnt;
2377 count = port->xmit_fifo_size; 2372 count = port->xmit_fifo_size;
2378 do { 2373 do {
2379 outb(port->xmit_buf[port->xmit_tail++], 2374 outb(port->port.xmit_buf[port->xmit_tail++],
2380 port->ioaddr + UART_TX); 2375 port->ioaddr + UART_TX);
2381 port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1); 2376 port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1);
2382 if (--port->xmit_cnt <= 0) 2377 if (--port->xmit_cnt <= 0)
2383 break; 2378 break;
2384 } while (--count > 0); 2379 } while (--count > 0);
2385 mxvar_log.txcnt[port->tty->index] += (cnt - port->xmit_cnt); 2380 mxvar_log.txcnt[port->port.tty->index] += (cnt - port->xmit_cnt);
2386 2381
2387 port->mon_data.txcnt += (cnt - port->xmit_cnt); 2382 port->mon_data.txcnt += (cnt - port->xmit_cnt);
2388 port->mon_data.up_txcnt += (cnt - port->xmit_cnt); 2383 port->mon_data.up_txcnt += (cnt - port->xmit_cnt);
2389 port->icount.tx += (cnt - port->xmit_cnt); 2384 port->icount.tx += (cnt - port->xmit_cnt);
2390 2385
2391 if (port->xmit_cnt < WAKEUP_CHARS) 2386 if (port->xmit_cnt < WAKEUP_CHARS)
2392 tty_wakeup(port->tty); 2387 tty_wakeup(port->port.tty);
2393 2388
2394 if (port->xmit_cnt <= 0) { 2389 if (port->xmit_cnt <= 0) {
2395 port->IER &= ~UART_IER_THRI; 2390 port->IER &= ~UART_IER_THRI;
@@ -2440,9 +2435,9 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id)
2440 if (iir & UART_IIR_NO_INT) 2435 if (iir & UART_IIR_NO_INT)
2441 break; 2436 break;
2442 iir &= MOXA_MUST_IIR_MASK; 2437 iir &= MOXA_MUST_IIR_MASK;
2443 if (!port->tty || 2438 if (!port->port.tty ||
2444 (port->flags & ASYNC_CLOSING) || 2439 (port->port.flags & ASYNC_CLOSING) ||
2445 !(port->flags & 2440 !(port->port.flags &
2446 ASYNC_INITIALIZED)) { 2441 ASYNC_INITIALIZED)) {
2447 status = inb(port->ioaddr + UART_LSR); 2442 status = inb(port->ioaddr + UART_LSR);
2448 outb(0x27, port->ioaddr + UART_FCR); 2443 outb(0x27, port->ioaddr + UART_FCR);
@@ -2558,7 +2553,7 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
2558 if (brd->chip_flag != MOXA_OTHER_UART) 2553 if (brd->chip_flag != MOXA_OTHER_UART)
2559 mxser_enable_must_enchance_mode(info->ioaddr); 2554 mxser_enable_must_enchance_mode(info->ioaddr);
2560 2555
2561 info->flags = ASYNC_SHARE_IRQ; 2556 info->port.flags = ASYNC_SHARE_IRQ;
2562 info->type = brd->uart_type; 2557 info->type = brd->uart_type;
2563 2558
2564 process_txrx_fifo(info); 2559 process_txrx_fifo(info);
@@ -2567,7 +2562,7 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
2567 info->close_delay = 5 * HZ / 10; 2562 info->close_delay = 5 * HZ / 10;
2568 info->closing_wait = 30 * HZ; 2563 info->closing_wait = 30 * HZ;
2569 info->normal_termios = mxvar_sdriver->init_termios; 2564 info->normal_termios = mxvar_sdriver->init_termios;
2570 init_waitqueue_head(&info->open_wait); 2565 tty_port_init(&info->port);
2571 init_waitqueue_head(&info->delta_msr_wait); 2566 init_waitqueue_head(&info->delta_msr_wait);
2572 memset(&info->mon_data, 0, sizeof(struct mxser_mon)); 2567 memset(&info->mon_data, 0, sizeof(struct mxser_mon));
2573 info->err_shadow = 0; 2568 info->err_shadow = 0;