diff options
Diffstat (limited to 'drivers/char/rocket.c')
-rw-r--r-- | drivers/char/rocket.c | 144 |
1 files changed, 73 insertions, 71 deletions
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 743dc80a9325..584d791e84a6 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #include <linux/tty.h> | 72 | #include <linux/tty.h> |
73 | #include <linux/tty_driver.h> | 73 | #include <linux/tty_driver.h> |
74 | #include <linux/tty_flip.h> | 74 | #include <linux/tty_flip.h> |
75 | #include <linux/serial.h> | ||
75 | #include <linux/string.h> | 76 | #include <linux/string.h> |
76 | #include <linux/fcntl.h> | 77 | #include <linux/fcntl.h> |
77 | #include <linux/ptrace.h> | 78 | #include <linux/ptrace.h> |
@@ -81,7 +82,7 @@ | |||
81 | #include <linux/completion.h> | 82 | #include <linux/completion.h> |
82 | #include <linux/wait.h> | 83 | #include <linux/wait.h> |
83 | #include <linux/pci.h> | 84 | #include <linux/pci.h> |
84 | #include <asm/uaccess.h> | 85 | #include <linux/uaccess.h> |
85 | #include <asm/atomic.h> | 86 | #include <asm/atomic.h> |
86 | #include <asm/unaligned.h> | 87 | #include <asm/unaligned.h> |
87 | #include <linux/bitops.h> | 88 | #include <linux/bitops.h> |
@@ -434,15 +435,15 @@ static void rp_do_transmit(struct r_port *info) | |||
434 | #endif | 435 | #endif |
435 | if (!info) | 436 | if (!info) |
436 | return; | 437 | return; |
437 | if (!info->tty) { | 438 | if (!info->port.tty) { |
438 | printk(KERN_WARNING "rp: WARNING %s called with " | 439 | printk(KERN_WARNING "rp: WARNING %s called with " |
439 | "info->tty==NULL\n", __func__); | 440 | "info->port.tty==NULL\n", __func__); |
440 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); | 441 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); |
441 | return; | 442 | return; |
442 | } | 443 | } |
443 | 444 | ||
444 | spin_lock_irqsave(&info->slock, flags); | 445 | spin_lock_irqsave(&info->slock, flags); |
445 | tty = info->tty; | 446 | tty = info->port.tty; |
446 | info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp); | 447 | info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp); |
447 | 448 | ||
448 | /* Loop sending data to FIFO until done or FIFO full */ | 449 | /* Loop sending data to FIFO until done or FIFO full */ |
@@ -502,13 +503,13 @@ static void rp_handle_port(struct r_port *info) | |||
502 | "info->flags & NOT_INIT\n"); | 503 | "info->flags & NOT_INIT\n"); |
503 | return; | 504 | return; |
504 | } | 505 | } |
505 | if (!info->tty) { | 506 | if (!info->port.tty) { |
506 | printk(KERN_WARNING "rp: WARNING: rp_handle_port called with " | 507 | printk(KERN_WARNING "rp: WARNING: rp_handle_port called with " |
507 | "info->tty==NULL\n"); | 508 | "info->port.tty==NULL\n"); |
508 | return; | 509 | return; |
509 | } | 510 | } |
510 | cp = &info->channel; | 511 | cp = &info->channel; |
511 | tty = info->tty; | 512 | tty = info->port.tty; |
512 | 513 | ||
513 | IntMask = sGetChanIntID(cp) & info->intmask; | 514 | IntMask = sGetChanIntID(cp) & info->intmask; |
514 | #ifdef ROCKET_DEBUG_INTR | 515 | #ifdef ROCKET_DEBUG_INTR |
@@ -530,7 +531,7 @@ static void rp_handle_port(struct r_port *info) | |||
530 | tty_hangup(tty); | 531 | tty_hangup(tty); |
531 | } | 532 | } |
532 | info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; | 533 | info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; |
533 | wake_up_interruptible(&info->open_wait); | 534 | wake_up_interruptible(&info->port.open_wait); |
534 | } | 535 | } |
535 | #ifdef ROCKET_DEBUG_INTR | 536 | #ifdef ROCKET_DEBUG_INTR |
536 | if (IntMask & DELTA_CTS) { /* CTS change */ | 537 | if (IntMask & DELTA_CTS) { /* CTS change */ |
@@ -648,9 +649,9 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) | |||
648 | info->board = board; | 649 | info->board = board; |
649 | info->aiop = aiop; | 650 | info->aiop = aiop; |
650 | info->chan = chan; | 651 | info->chan = chan; |
651 | info->closing_wait = 3000; | 652 | info->port.closing_wait = 3000; |
652 | info->close_delay = 50; | 653 | info->port.close_delay = 50; |
653 | init_waitqueue_head(&info->open_wait); | 654 | init_waitqueue_head(&info->port.open_wait); |
654 | init_completion(&info->close_wait); | 655 | init_completion(&info->close_wait); |
655 | info->flags &= ~ROCKET_MODE_MASK; | 656 | info->flags &= ~ROCKET_MODE_MASK; |
656 | switch (pc104[board][line]) { | 657 | switch (pc104[board][line]) { |
@@ -717,7 +718,7 @@ static void configure_r_port(struct r_port *info, | |||
717 | unsigned rocketMode; | 718 | unsigned rocketMode; |
718 | int bits, baud, divisor; | 719 | int bits, baud, divisor; |
719 | CHANNEL_t *cp; | 720 | CHANNEL_t *cp; |
720 | struct ktermios *t = info->tty->termios; | 721 | struct ktermios *t = info->port.tty->termios; |
721 | 722 | ||
722 | cp = &info->channel; | 723 | cp = &info->channel; |
723 | cflag = t->c_cflag; | 724 | cflag = t->c_cflag; |
@@ -750,7 +751,7 @@ static void configure_r_port(struct r_port *info, | |||
750 | } | 751 | } |
751 | 752 | ||
752 | /* baud rate */ | 753 | /* baud rate */ |
753 | baud = tty_get_baud_rate(info->tty); | 754 | baud = tty_get_baud_rate(info->port.tty); |
754 | if (!baud) | 755 | if (!baud) |
755 | baud = 9600; | 756 | baud = 9600; |
756 | divisor = ((rp_baud_base[info->board] + (baud >> 1)) / baud) - 1; | 757 | divisor = ((rp_baud_base[info->board] + (baud >> 1)) / baud) - 1; |
@@ -768,7 +769,7 @@ static void configure_r_port(struct r_port *info, | |||
768 | sSetBaud(cp, divisor); | 769 | sSetBaud(cp, divisor); |
769 | 770 | ||
770 | /* FIXME: Should really back compute a baud rate from the divisor */ | 771 | /* FIXME: Should really back compute a baud rate from the divisor */ |
771 | tty_encode_baud_rate(info->tty, baud, baud); | 772 | tty_encode_baud_rate(info->port.tty, baud, baud); |
772 | 773 | ||
773 | if (cflag & CRTSCTS) { | 774 | if (cflag & CRTSCTS) { |
774 | info->intmask |= DELTA_CTS; | 775 | info->intmask |= DELTA_CTS; |
@@ -793,15 +794,15 @@ static void configure_r_port(struct r_port *info, | |||
793 | * Handle software flow control in the board | 794 | * Handle software flow control in the board |
794 | */ | 795 | */ |
795 | #ifdef ROCKET_SOFT_FLOW | 796 | #ifdef ROCKET_SOFT_FLOW |
796 | if (I_IXON(info->tty)) { | 797 | if (I_IXON(info->port.tty)) { |
797 | sEnTxSoftFlowCtl(cp); | 798 | sEnTxSoftFlowCtl(cp); |
798 | if (I_IXANY(info->tty)) { | 799 | if (I_IXANY(info->port.tty)) { |
799 | sEnIXANY(cp); | 800 | sEnIXANY(cp); |
800 | } else { | 801 | } else { |
801 | sDisIXANY(cp); | 802 | sDisIXANY(cp); |
802 | } | 803 | } |
803 | sSetTxXONChar(cp, START_CHAR(info->tty)); | 804 | sSetTxXONChar(cp, START_CHAR(info->port.tty)); |
804 | sSetTxXOFFChar(cp, STOP_CHAR(info->tty)); | 805 | sSetTxXOFFChar(cp, STOP_CHAR(info->port.tty)); |
805 | } else { | 806 | } else { |
806 | sDisTxSoftFlowCtl(cp); | 807 | sDisTxSoftFlowCtl(cp); |
807 | sDisIXANY(cp); | 808 | sDisIXANY(cp); |
@@ -813,24 +814,24 @@ static void configure_r_port(struct r_port *info, | |||
813 | * Set up ignore/read mask words | 814 | * Set up ignore/read mask words |
814 | */ | 815 | */ |
815 | info->read_status_mask = STMRCVROVRH | 0xFF; | 816 | info->read_status_mask = STMRCVROVRH | 0xFF; |
816 | if (I_INPCK(info->tty)) | 817 | if (I_INPCK(info->port.tty)) |
817 | info->read_status_mask |= STMFRAMEH | STMPARITYH; | 818 | info->read_status_mask |= STMFRAMEH | STMPARITYH; |
818 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 819 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
819 | info->read_status_mask |= STMBREAKH; | 820 | info->read_status_mask |= STMBREAKH; |
820 | 821 | ||
821 | /* | 822 | /* |
822 | * Characters to ignore | 823 | * Characters to ignore |
823 | */ | 824 | */ |
824 | info->ignore_status_mask = 0; | 825 | info->ignore_status_mask = 0; |
825 | if (I_IGNPAR(info->tty)) | 826 | if (I_IGNPAR(info->port.tty)) |
826 | info->ignore_status_mask |= STMFRAMEH | STMPARITYH; | 827 | info->ignore_status_mask |= STMFRAMEH | STMPARITYH; |
827 | if (I_IGNBRK(info->tty)) { | 828 | if (I_IGNBRK(info->port.tty)) { |
828 | info->ignore_status_mask |= STMBREAKH; | 829 | info->ignore_status_mask |= STMBREAKH; |
829 | /* | 830 | /* |
830 | * If we're ignoring parity and break indicators, | 831 | * If we're ignoring parity and break indicators, |
831 | * ignore overruns too. (For real raw support). | 832 | * ignore overruns too. (For real raw support). |
832 | */ | 833 | */ |
833 | if (I_IGNPAR(info->tty)) | 834 | if (I_IGNPAR(info->port.tty)) |
834 | info->ignore_status_mask |= STMRCVROVRH; | 835 | info->ignore_status_mask |= STMRCVROVRH; |
835 | } | 836 | } |
836 | 837 | ||
@@ -863,7 +864,7 @@ static void configure_r_port(struct r_port *info, | |||
863 | } | 864 | } |
864 | } | 865 | } |
865 | 866 | ||
866 | /* info->count is considered critical, protected by spinlocks. */ | 867 | /* info->port.count is considered critical, protected by spinlocks. */ |
867 | static int block_til_ready(struct tty_struct *tty, struct file *filp, | 868 | static int block_til_ready(struct tty_struct *tty, struct file *filp, |
868 | struct r_port *info) | 869 | struct r_port *info) |
869 | { | 870 | { |
@@ -897,13 +898,13 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
897 | 898 | ||
898 | /* | 899 | /* |
899 | * Block waiting for the carrier detect and the line to become free. While we are in | 900 | * Block waiting for the carrier detect and the line to become free. While we are in |
900 | * this loop, info->count is dropped by one, so that rp_close() knows when to free things. | 901 | * this loop, info->port.count is dropped by one, so that rp_close() knows when to free things. |
901 | * We restore it upon exit, either normal or abnormal. | 902 | * We restore it upon exit, either normal or abnormal. |
902 | */ | 903 | */ |
903 | retval = 0; | 904 | retval = 0; |
904 | add_wait_queue(&info->open_wait, &wait); | 905 | add_wait_queue(&info->port.open_wait, &wait); |
905 | #ifdef ROCKET_DEBUG_OPEN | 906 | #ifdef ROCKET_DEBUG_OPEN |
906 | printk(KERN_INFO "block_til_ready before block: ttyR%d, count = %d\n", info->line, info->count); | 907 | printk(KERN_INFO "block_til_ready before block: ttyR%d, count = %d\n", info->line, info->port.count); |
907 | #endif | 908 | #endif |
908 | spin_lock_irqsave(&info->slock, flags); | 909 | spin_lock_irqsave(&info->slock, flags); |
909 | 910 | ||
@@ -912,10 +913,10 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
912 | #else | 913 | #else |
913 | if (!tty_hung_up_p(filp)) { | 914 | if (!tty_hung_up_p(filp)) { |
914 | extra_count = 1; | 915 | extra_count = 1; |
915 | info->count--; | 916 | info->port.count--; |
916 | } | 917 | } |
917 | #endif | 918 | #endif |
918 | info->blocked_open++; | 919 | info->port.blocked_open++; |
919 | 920 | ||
920 | spin_unlock_irqrestore(&info->slock, flags); | 921 | spin_unlock_irqrestore(&info->slock, flags); |
921 | 922 | ||
@@ -940,24 +941,24 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
940 | } | 941 | } |
941 | #ifdef ROCKET_DEBUG_OPEN | 942 | #ifdef ROCKET_DEBUG_OPEN |
942 | printk(KERN_INFO "block_til_ready blocking: ttyR%d, count = %d, flags=0x%0x\n", | 943 | printk(KERN_INFO "block_til_ready blocking: ttyR%d, count = %d, flags=0x%0x\n", |
943 | info->line, info->count, info->flags); | 944 | info->line, info->port.count, info->flags); |
944 | #endif | 945 | #endif |
945 | schedule(); /* Don't hold spinlock here, will hang PC */ | 946 | schedule(); /* Don't hold spinlock here, will hang PC */ |
946 | } | 947 | } |
947 | __set_current_state(TASK_RUNNING); | 948 | __set_current_state(TASK_RUNNING); |
948 | remove_wait_queue(&info->open_wait, &wait); | 949 | remove_wait_queue(&info->port.open_wait, &wait); |
949 | 950 | ||
950 | spin_lock_irqsave(&info->slock, flags); | 951 | spin_lock_irqsave(&info->slock, flags); |
951 | 952 | ||
952 | if (extra_count) | 953 | if (extra_count) |
953 | info->count++; | 954 | info->port.count++; |
954 | info->blocked_open--; | 955 | info->port.blocked_open--; |
955 | 956 | ||
956 | spin_unlock_irqrestore(&info->slock, flags); | 957 | spin_unlock_irqrestore(&info->slock, flags); |
957 | 958 | ||
958 | #ifdef ROCKET_DEBUG_OPEN | 959 | #ifdef ROCKET_DEBUG_OPEN |
959 | printk(KERN_INFO "block_til_ready after blocking: ttyR%d, count = %d\n", | 960 | printk(KERN_INFO "block_til_ready after blocking: ttyR%d, count = %d\n", |
960 | info->line, info->count); | 961 | info->line, info->port.count); |
961 | #endif | 962 | #endif |
962 | if (retval) | 963 | if (retval) |
963 | return retval; | 964 | return retval; |
@@ -1001,9 +1002,9 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1001 | info->xmit_buf = (unsigned char *) page; | 1002 | info->xmit_buf = (unsigned char *) page; |
1002 | 1003 | ||
1003 | tty->driver_data = info; | 1004 | tty->driver_data = info; |
1004 | info->tty = tty; | 1005 | info->port.tty = tty; |
1005 | 1006 | ||
1006 | if (info->count++ == 0) { | 1007 | if (info->port.count++ == 0) { |
1007 | atomic_inc(&rp_num_ports_open); | 1008 | atomic_inc(&rp_num_ports_open); |
1008 | 1009 | ||
1009 | #ifdef ROCKET_DEBUG_OPEN | 1010 | #ifdef ROCKET_DEBUG_OPEN |
@@ -1012,7 +1013,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1012 | #endif | 1013 | #endif |
1013 | } | 1014 | } |
1014 | #ifdef ROCKET_DEBUG_OPEN | 1015 | #ifdef ROCKET_DEBUG_OPEN |
1015 | printk(KERN_INFO "rp_open ttyR%d, count=%d\n", info->line, info->count); | 1016 | printk(KERN_INFO "rp_open ttyR%d, count=%d\n", info->line, info->port.count); |
1016 | #endif | 1017 | #endif |
1017 | 1018 | ||
1018 | /* | 1019 | /* |
@@ -1048,13 +1049,13 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1048 | * Set up the tty->alt_speed kludge | 1049 | * Set up the tty->alt_speed kludge |
1049 | */ | 1050 | */ |
1050 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) | 1051 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) |
1051 | info->tty->alt_speed = 57600; | 1052 | info->port.tty->alt_speed = 57600; |
1052 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) | 1053 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) |
1053 | info->tty->alt_speed = 115200; | 1054 | info->port.tty->alt_speed = 115200; |
1054 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) | 1055 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) |
1055 | info->tty->alt_speed = 230400; | 1056 | info->port.tty->alt_speed = 230400; |
1056 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) | 1057 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) |
1057 | info->tty->alt_speed = 460800; | 1058 | info->port.tty->alt_speed = 460800; |
1058 | 1059 | ||
1059 | configure_r_port(info, NULL); | 1060 | configure_r_port(info, NULL); |
1060 | if (tty->termios->c_cflag & CBAUD) { | 1061 | if (tty->termios->c_cflag & CBAUD) { |
@@ -1076,7 +1077,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1076 | } | 1077 | } |
1077 | 1078 | ||
1078 | /* | 1079 | /* |
1079 | * Exception handler that closes a serial port. info->count is considered critical. | 1080 | * Exception handler that closes a serial port. info->port.count is considered critical. |
1080 | */ | 1081 | */ |
1081 | static void rp_close(struct tty_struct *tty, struct file *filp) | 1082 | static void rp_close(struct tty_struct *tty, struct file *filp) |
1082 | { | 1083 | { |
@@ -1089,14 +1090,14 @@ static void rp_close(struct tty_struct *tty, struct file *filp) | |||
1089 | return; | 1090 | return; |
1090 | 1091 | ||
1091 | #ifdef ROCKET_DEBUG_OPEN | 1092 | #ifdef ROCKET_DEBUG_OPEN |
1092 | printk(KERN_INFO "rp_close ttyR%d, count = %d\n", info->line, info->count); | 1093 | printk(KERN_INFO "rp_close ttyR%d, count = %d\n", info->line, info->port.count); |
1093 | #endif | 1094 | #endif |
1094 | 1095 | ||
1095 | if (tty_hung_up_p(filp)) | 1096 | if (tty_hung_up_p(filp)) |
1096 | return; | 1097 | return; |
1097 | spin_lock_irqsave(&info->slock, flags); | 1098 | spin_lock_irqsave(&info->slock, flags); |
1098 | 1099 | ||
1099 | if ((tty->count == 1) && (info->count != 1)) { | 1100 | if ((tty->count == 1) && (info->port.count != 1)) { |
1100 | /* | 1101 | /* |
1101 | * Uh, oh. tty->count is 1, which means that the tty | 1102 | * Uh, oh. tty->count is 1, which means that the tty |
1102 | * structure will be freed. Info->count should always | 1103 | * structure will be freed. Info->count should always |
@@ -1105,15 +1106,15 @@ static void rp_close(struct tty_struct *tty, struct file *filp) | |||
1105 | * serial port won't be shutdown. | 1106 | * serial port won't be shutdown. |
1106 | */ | 1107 | */ |
1107 | printk(KERN_WARNING "rp_close: bad serial port count; " | 1108 | printk(KERN_WARNING "rp_close: bad serial port count; " |
1108 | "tty->count is 1, info->count is %d\n", info->count); | 1109 | "tty->count is 1, info->port.count is %d\n", info->port.count); |
1109 | info->count = 1; | 1110 | info->port.count = 1; |
1110 | } | 1111 | } |
1111 | if (--info->count < 0) { | 1112 | if (--info->port.count < 0) { |
1112 | printk(KERN_WARNING "rp_close: bad serial port count for " | 1113 | printk(KERN_WARNING "rp_close: bad serial port count for " |
1113 | "ttyR%d: %d\n", info->line, info->count); | 1114 | "ttyR%d: %d\n", info->line, info->port.count); |
1114 | info->count = 0; | 1115 | info->port.count = 0; |
1115 | } | 1116 | } |
1116 | if (info->count) { | 1117 | if (info->port.count) { |
1117 | spin_unlock_irqrestore(&info->slock, flags); | 1118 | spin_unlock_irqrestore(&info->slock, flags); |
1118 | return; | 1119 | return; |
1119 | } | 1120 | } |
@@ -1137,8 +1138,8 @@ static void rp_close(struct tty_struct *tty, struct file *filp) | |||
1137 | /* | 1138 | /* |
1138 | * Wait for the transmit buffer to clear | 1139 | * Wait for the transmit buffer to clear |
1139 | */ | 1140 | */ |
1140 | if (info->closing_wait != ROCKET_CLOSING_WAIT_NONE) | 1141 | if (info->port.closing_wait != ROCKET_CLOSING_WAIT_NONE) |
1141 | tty_wait_until_sent(tty, info->closing_wait); | 1142 | tty_wait_until_sent(tty, info->port.closing_wait); |
1142 | /* | 1143 | /* |
1143 | * Before we drop DTR, make sure the UART transmitter | 1144 | * Before we drop DTR, make sure the UART transmitter |
1144 | * has completely drained; this is especially | 1145 | * has completely drained; this is especially |
@@ -1167,11 +1168,11 @@ static void rp_close(struct tty_struct *tty, struct file *filp) | |||
1167 | 1168 | ||
1168 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); | 1169 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); |
1169 | 1170 | ||
1170 | if (info->blocked_open) { | 1171 | if (info->port.blocked_open) { |
1171 | if (info->close_delay) { | 1172 | if (info->port.close_delay) { |
1172 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 1173 | msleep_interruptible(jiffies_to_msecs(info->port.close_delay)); |
1173 | } | 1174 | } |
1174 | wake_up_interruptible(&info->open_wait); | 1175 | wake_up_interruptible(&info->port.open_wait); |
1175 | } else { | 1176 | } else { |
1176 | if (info->xmit_buf) { | 1177 | if (info->xmit_buf) { |
1177 | free_page((unsigned long) info->xmit_buf); | 1178 | free_page((unsigned long) info->xmit_buf); |
@@ -1235,13 +1236,13 @@ static void rp_set_termios(struct tty_struct *tty, | |||
1235 | } | 1236 | } |
1236 | } | 1237 | } |
1237 | 1238 | ||
1238 | static void rp_break(struct tty_struct *tty, int break_state) | 1239 | static int rp_break(struct tty_struct *tty, int break_state) |
1239 | { | 1240 | { |
1240 | struct r_port *info = (struct r_port *) tty->driver_data; | 1241 | struct r_port *info = (struct r_port *) tty->driver_data; |
1241 | unsigned long flags; | 1242 | unsigned long flags; |
1242 | 1243 | ||
1243 | if (rocket_paranoia_check(info, "rp_break")) | 1244 | if (rocket_paranoia_check(info, "rp_break")) |
1244 | return; | 1245 | return -EINVAL; |
1245 | 1246 | ||
1246 | spin_lock_irqsave(&info->slock, flags); | 1247 | spin_lock_irqsave(&info->slock, flags); |
1247 | if (break_state == -1) | 1248 | if (break_state == -1) |
@@ -1249,6 +1250,7 @@ static void rp_break(struct tty_struct *tty, int break_state) | |||
1249 | else | 1250 | else |
1250 | sClrBreak(&info->channel); | 1251 | sClrBreak(&info->channel); |
1251 | spin_unlock_irqrestore(&info->slock, flags); | 1252 | spin_unlock_irqrestore(&info->slock, flags); |
1253 | return 0; | ||
1252 | } | 1254 | } |
1253 | 1255 | ||
1254 | /* | 1256 | /* |
@@ -1327,8 +1329,8 @@ static int get_config(struct r_port *info, struct rocket_config __user *retinfo) | |||
1327 | memset(&tmp, 0, sizeof (tmp)); | 1329 | memset(&tmp, 0, sizeof (tmp)); |
1328 | tmp.line = info->line; | 1330 | tmp.line = info->line; |
1329 | tmp.flags = info->flags; | 1331 | tmp.flags = info->flags; |
1330 | tmp.close_delay = info->close_delay; | 1332 | tmp.close_delay = info->port.close_delay; |
1331 | tmp.closing_wait = info->closing_wait; | 1333 | tmp.closing_wait = info->port.closing_wait; |
1332 | tmp.port = rcktpt_io_addr[(info->line >> 5) & 3]; | 1334 | tmp.port = rcktpt_io_addr[(info->line >> 5) & 3]; |
1333 | 1335 | ||
1334 | if (copy_to_user(retinfo, &tmp, sizeof (*retinfo))) | 1336 | if (copy_to_user(retinfo, &tmp, sizeof (*retinfo))) |
@@ -1353,17 +1355,17 @@ static int set_config(struct r_port *info, struct rocket_config __user *new_info | |||
1353 | } | 1355 | } |
1354 | 1356 | ||
1355 | info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS)); | 1357 | info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS)); |
1356 | info->close_delay = new_serial.close_delay; | 1358 | info->port.close_delay = new_serial.close_delay; |
1357 | info->closing_wait = new_serial.closing_wait; | 1359 | info->port.closing_wait = new_serial.closing_wait; |
1358 | 1360 | ||
1359 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) | 1361 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) |
1360 | info->tty->alt_speed = 57600; | 1362 | info->port.tty->alt_speed = 57600; |
1361 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) | 1363 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) |
1362 | info->tty->alt_speed = 115200; | 1364 | info->port.tty->alt_speed = 115200; |
1363 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) | 1365 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) |
1364 | info->tty->alt_speed = 230400; | 1366 | info->port.tty->alt_speed = 230400; |
1365 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) | 1367 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) |
1366 | info->tty->alt_speed = 460800; | 1368 | info->port.tty->alt_speed = 460800; |
1367 | 1369 | ||
1368 | configure_r_port(info, NULL); | 1370 | configure_r_port(info, NULL); |
1369 | return 0; | 1371 | return 0; |
@@ -1636,13 +1638,13 @@ static void rp_hangup(struct tty_struct *tty) | |||
1636 | rp_flush_buffer(tty); | 1638 | rp_flush_buffer(tty); |
1637 | if (info->flags & ROCKET_CLOSING) | 1639 | if (info->flags & ROCKET_CLOSING) |
1638 | return; | 1640 | return; |
1639 | if (info->count) | 1641 | if (info->port.count) |
1640 | atomic_dec(&rp_num_ports_open); | 1642 | atomic_dec(&rp_num_ports_open); |
1641 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); | 1643 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); |
1642 | 1644 | ||
1643 | info->count = 0; | 1645 | info->port.count = 0; |
1644 | info->flags &= ~ROCKET_NORMAL_ACTIVE; | 1646 | info->flags &= ~ROCKET_NORMAL_ACTIVE; |
1645 | info->tty = NULL; | 1647 | info->port.tty = NULL; |
1646 | 1648 | ||
1647 | cp = &info->channel; | 1649 | cp = &info->channel; |
1648 | sDisRxFIFO(cp); | 1650 | sDisRxFIFO(cp); |
@@ -1653,7 +1655,7 @@ static void rp_hangup(struct tty_struct *tty) | |||
1653 | sClrTxXOFF(cp); | 1655 | sClrTxXOFF(cp); |
1654 | info->flags &= ~ROCKET_INITIALIZED; | 1656 | info->flags &= ~ROCKET_INITIALIZED; |
1655 | 1657 | ||
1656 | wake_up_interruptible(&info->open_wait); | 1658 | wake_up_interruptible(&info->port.open_wait); |
1657 | } | 1659 | } |
1658 | 1660 | ||
1659 | /* | 1661 | /* |
@@ -1762,7 +1764,7 @@ static int rp_write(struct tty_struct *tty, | |||
1762 | 1764 | ||
1763 | /* Write remaining data into the port's xmit_buf */ | 1765 | /* Write remaining data into the port's xmit_buf */ |
1764 | while (1) { | 1766 | while (1) { |
1765 | if (!info->tty) /* Seemingly obligatory check... */ | 1767 | if (!info->port.tty) /* Seemingly obligatory check... */ |
1766 | goto end; | 1768 | goto end; |
1767 | c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1); | 1769 | c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1); |
1768 | c = min(c, XMIT_BUF_SIZE - info->xmit_head); | 1770 | c = min(c, XMIT_BUF_SIZE - info->xmit_head); |