[PATCH] Remove #if 0 and other long dead code from rio_tty

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Alan Cox and committed by Linus Torvalds a6176eea 925d70d6

-583
-583
drivers/char/rio/riotty.c
··· 89 89 #include "list.h" 90 90 #include "sam.h" 91 91 92 - #if 0 93 - static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int); 94 - #endif 95 - 96 92 static void RIOClearUp(struct Port *PortP); 97 93 int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); 98 94 99 - #if 0 100 - static int RIOCookMode(struct ttystatics *); 101 - #endif 102 95 103 96 extern int conv_vb[]; /* now defined in ttymgr.c */ 104 97 extern int conv_bv[]; /* now defined in ttymgr.c */ ··· 219 226 ** until the RTA is present then we must spin here waiting for 220 227 ** the RTA to boot. 221 228 */ 222 - #if 0 223 - if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { 224 - if (PortP->WaitUntilBooted) { 225 - rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n"); 226 - do { 227 - if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { 228 - rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); 229 - func_exit(); 230 - return -EINTR; 231 - } 232 - if (repeat_this-- <= 0) { 233 - rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); 234 - RIOPreemptiveCmd(p, PortP, FCLOSE); 235 - pseterr(EINTR); 236 - func_exit(); 237 - return -EIO; 238 - } 239 - } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)); 240 - rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); 241 - } else { 242 - rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n"); 243 - pseterr(ENXIO); 244 - func_exit(); 245 - return 0; 246 - } 247 - } 248 - #else 249 229 /* I find the above code a bit hairy. I find the below code 250 230 easier to read and shorter. Now, if it works too that would 251 231 be great... -- REW ··· 247 281 } 248 282 } 249 283 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); 250 - #endif 251 - #if 0 252 - tp = PortP->TtyP; /* get tty struct */ 253 - #endif 254 284 rio_spin_lock_irqsave(&PortP->portSem, flags); 255 285 if (p->RIOHalted) { 256 286 goto bombout; 257 287 } 258 - #if 0 259 - retval = gs_init_port(&PortP->gs); 260 - if (retval) { 261 - func_exit(); 262 - return retval; 263 - } 264 - #endif 265 288 266 289 /* 267 290 ** If the port is in the final throws of being closed, ··· 318 363 command piggybacks the parameters immediately. 319 364 -- REW */ 320 365 RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ 321 - #if 0 322 - /* This delay of 1 second was annoying. I removed it. -- REW */ 323 - RIODelay(PortP, HUNDRED_MS * 10); 324 - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); /* Config the port */ 325 - #endif 326 366 rio_spin_lock_irqsave(&PortP->portSem, flags); 327 367 328 368 /* ··· 389 439 PortP->State |= RIO_WOPEN; 390 440 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 391 441 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) 392 - #if 0 393 - if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH)) 394 - #endif 395 442 { 396 443 /* 397 444 ** ACTION: verify that this is a good thing ··· 452 505 */ 453 506 int riotclose(void *ptr) 454 507 { 455 - #if 0 456 - register uint SysPort = dev; 457 - struct ttystatics *tp; /* pointer to our ttystruct */ 458 - #endif 459 508 struct Port *PortP = ptr; /* pointer to the port structure */ 460 509 int deleted = 0; 461 510 int try = -1; /* Disable the timeouts by setting them to -1 */ ··· 477 534 end_time = jiffies + MAX_SCHEDULE_TIMEOUT; 478 535 479 536 Modem = rio_ismodem(tty); 480 - #if 0 481 - /* What F.CKING cache? Even then, a higly idle multiprocessor, 482 - system with large caches this won't work . Better find out when 483 - this doesn't work asap, and fix the cause. -- REW */ 484 - 485 - RIODelay(PortP, HUNDRED_MS * 10); /* To flush the cache */ 486 - #endif 487 537 rio_spin_lock_irqsave(&PortP->portSem, flags); 488 538 489 539 /* ··· 639 703 } 640 704 641 705 642 - /* 643 - ** decide if we need to use the line discipline. 644 - ** This routine can return one of three values: 645 - ** COOK_RAW if no processing has to be done by the line discipline or the card 646 - ** COOK_WELL if the line discipline must be used to do the processing 647 - ** COOK_MEDIUM if the card can do all the processing necessary. 648 - */ 649 - #if 0 650 - static int RIOCookMode(struct ttystatics *tp) 651 - { 652 - /* 653 - ** We can't handle tm.c_mstate != 0 on SCO 654 - ** We can't handle mapping 655 - ** We can't handle non-ttwrite line disc. 656 - ** We can't handle lflag XCASE 657 - ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3) 658 - */ 659 - 660 - #ifdef CHECK 661 - CheckTtyP(tp); 662 - #endif 663 - if (!(tp->tm.c_oflag & OPOST)) /* No post processing */ 664 - return COOK_RAW; /* Raw mode o/p */ 665 - 666 - if (tp->tm.c_lflag & XCASE) 667 - return COOK_WELL; /* Use line disc */ 668 - 669 - if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3)) 670 - return COOK_WELL; /* Use line disc for strange modes */ 671 - 672 - if (tp->tm.c_oflag == OPOST) /* If only OPOST is set, do RAW */ 673 - return COOK_RAW; 674 - 675 - /* 676 - ** So, we need to output process! 677 - */ 678 - return COOK_MEDIUM; 679 - } 680 - #endif 681 706 682 707 static void RIOClearUp(PortP) 683 708 struct Port *PortP; ··· 673 776 unsigned long flags; 674 777 675 778 rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n"); 676 - #ifdef CHECK 677 - CheckPortP(PortP); 678 - if (len < 1 || len > 2) 679 - cprintf(("STUPID LENGTH %d\n", len)); 680 - #endif 681 779 682 780 if (PortP->State & RIO_DELETED) { 683 781 rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); ··· 744 852 } 745 853 746 854 747 - #if 0 748 - /* 749 - ** This is an ioctl interface. This is the twentieth century. You know what 750 - ** its all about. 751 - */ 752 - int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) 753 - { 754 - register struct Port *PortP; 755 - register struct ttystatics *tp; 756 - int current; 757 - int ParamSemIncremented = 0; 758 - int old_oflag, old_cflag, old_iflag, changed, oldcook; 759 - int i; 760 - unsigned char sio_regs[5]; /* Here be magic */ 761 - short vpix_cflag; 762 - short divisor; 763 - int baud; 764 - uint SysPort = rio_minor(tty); 765 - int Modem = rio_ismodem(tty); 766 - int ioctl_processed; 767 - 768 - rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty"); 769 - 770 - if (SysPort >= RIO_PORTS) { 771 - rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort); 772 - return -ENXIO; 773 - } 774 - 775 - PortP = p->RIOPortp[SysPort]; 776 - tp = PortP->TtyP; 777 - 778 - rio_spin_lock_irqsave(&PortP->portSem, flags); 779 - 780 - #ifdef STATS 781 - PortP->Stat.IoctlCnt++; 782 - #endif 783 - 784 - if (PortP->State & RIO_DELETED) { 785 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 786 - return -EIO; 787 - } 788 - 789 - 790 - if (p->RIOHalted) { 791 - RIOClearUp(PortP); 792 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 793 - return -EIO; 794 - } 795 - 796 - /* 797 - ** Count ioctls for port statistics reporting 798 - */ 799 - if (PortP->statsGather) 800 - PortP->ioctls++; 801 - 802 - /* 803 - ** Specialix RIO Ioctl calls 804 - */ 805 - switch (cmd) { 806 - 807 - case TCRIOTRIAD: 808 - if (arg) 809 - PortP->State |= RIO_TRIAD_MODE; 810 - else 811 - PortP->State &= ~RIO_TRIAD_MODE; 812 - /* 813 - ** Normally, when istrip is set on a port, a config is 814 - ** sent to the RTA instructing the CD1400 to do the 815 - ** stripping. In TRIAD mode, the interrupt receive routine 816 - ** must do the stripping instead, since it has to detect 817 - ** an 8 bit function key sequence. If istrip is set with 818 - ** TRIAD mode on(off), and 8 bit data is being read by 819 - ** the port, the user then turns TRIAD mode off(on), the RTA 820 - ** must be reconfigured (not) to do the stripping. 821 - ** Hence we call RIOParam here. 822 - */ 823 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 824 - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); 825 - return 0; 826 - 827 - case TCRIOTSTATE: 828 - rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis"); 829 - /* MonitorTstate = 0 ; */ 830 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 831 - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); 832 - return 0; 833 - 834 - case TCRIOSTATE: /* current state of Modem input pins */ 835 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n"); 836 - if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL) 837 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n"); 838 - PortP->State |= RIO_BUSY; 839 - current = PortP->ModemState; 840 - if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) { 841 - rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n"); 842 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 843 - pseterr(EFAULT); 844 - } 845 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 846 - return 0; 847 - 848 - case TCRIOMBIS: /* Set modem lines */ 849 - case TCRIOMBIC: /* Clear modem lines */ 850 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n"); 851 - if (cmd == TCRIOMBIS) { 852 - uint state; 853 - state = (uint) arg; 854 - PortP->ModemState |= (ushort) state; 855 - PortP->ModemLines = (ulong) arg; 856 - if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL) 857 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n"); 858 - } else { 859 - uint state; 860 - 861 - state = (uint) arg; 862 - PortP->ModemState &= ~(ushort) state; 863 - PortP->ModemLines = (ulong) arg; 864 - if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL) 865 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n"); 866 - } 867 - PortP->State |= RIO_BUSY; 868 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 869 - return 0; 870 - 871 - case TCRIOXPON: /* set Xprint ON string */ 872 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n"); 873 - if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) { 874 - rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n"); 875 - PortP->Xprint.XpOn[0] = '\0'; 876 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 877 - pseterr(EFAULT); 878 - } 879 - PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; 880 - PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff); 881 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 882 - return 0; 883 - 884 - case TCRIOXPOFF: /* set Xprint OFF string */ 885 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n"); 886 - if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) { 887 - rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n"); 888 - PortP->Xprint.XpOff[0] = '\0'; 889 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 890 - pseterr(EFAULT); 891 - } 892 - PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; 893 - PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff); 894 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 895 - return 0; 896 - 897 - case TCRIOXPCPS: /* set Xprint CPS string */ 898 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n"); 899 - if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) { 900 - rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg); 901 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 902 - pseterr(EINVAL); 903 - return 0; 904 - } 905 - PortP->Xprint.XpCps = (uint) arg; 906 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 907 - return 0; 908 - 909 - case TCRIOXPRINT: 910 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n"); 911 - if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) { 912 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 913 - pseterr(EFAULT); 914 - } 915 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 916 - return 0; 917 - 918 - case TCRIOIXANYON: 919 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n"); 920 - PortP->Config |= RIO_IXANY; 921 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 922 - return 0; 923 - 924 - case TCRIOIXANYOFF: 925 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n"); 926 - PortP->Config &= ~RIO_IXANY; 927 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 928 - return 0; 929 - 930 - case TCRIOIXONON: 931 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n"); 932 - PortP->Config |= RIO_IXON; 933 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 934 - return 0; 935 - 936 - case TCRIOIXONOFF: 937 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONOFF\n"); 938 - PortP->Config &= ~RIO_IXON; 939 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 940 - return 0; 941 - 942 - /* 943 - ** 15.10.1998 ARG - ESIL 0761 part fix 944 - ** Added support for CTS and RTS flow control ioctls : 945 - */ 946 - case TCRIOCTSFLOWEN: 947 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n"); 948 - PortP->Config |= RIO_CTSFLOW; 949 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 950 - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); 951 - return 0; 952 - 953 - case TCRIOCTSFLOWDIS: 954 - rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n"); 955 - PortP->Config &= ~RIO_CTSFLOW; 956 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 957 - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); 958 - return 0; 959 - 960 - case TCRIORTSFLOWEN: 961 - rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n"); 962 - PortP->Config |= RIO_RTSFLOW; 963 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 964 - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); 965 - return 0; 966 - 967 - case TCRIORTSFLOWDIS: 968 - rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n"); 969 - PortP->Config &= ~RIO_RTSFLOW; 970 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 971 - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); 972 - return 0; 973 - 974 - /* end ESIL 0761 part fix */ 975 - 976 - } 977 - 978 - 979 - /* Lynx IOCTLS */ 980 - switch (cmd) { 981 - case TIOCSETP: 982 - case TIOCSETN: 983 - case OTIOCSETP: 984 - case OTIOCSETN: 985 - ioctl_processed++; 986 - ttyseth(PortP, tp, (struct old_sgttyb *) arg); 987 - break; 988 - case TCSETA: 989 - case TCSETAW: 990 - case TCSETAF: 991 - ioctl_processed++; 992 - rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n"); 993 - ttyseth_pv(PortP, tp, (struct termios *) arg, 0); 994 - break; 995 - case TCSETAP: /* posix tcsetattr() */ 996 - case TCSETAWP: /* posix tcsetattr() */ 997 - case TCSETAFP: /* posix tcsetattr() */ 998 - rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n"); 999 - ttyseth_pv(PortP, tp, (struct termios *) arg, 1); 1000 - ioctl_processed++; 1001 - break; 1002 - } 1003 - 1004 - /* 1005 - ** If its any of the commands that require the port to be in the 1006 - ** non-busy state wait until all output has drained 1007 - */ 1008 - if (!ioctl_processed) 1009 - switch (cmd) { 1010 - case TCSETAW: 1011 - case TCSETAF: 1012 - case TCSETA: 1013 - case TCSBRK: 1014 - #define OLD_POSIX ('x' << 8) 1015 - #define OLD_POSIX_SETA (OLD_POSIX | 2) 1016 - #define OLD_POSIX_SETAW (OLD_POSIX | 3) 1017 - #define OLD_POSIX_SETAF (OLD_POSIX | 4) 1018 - #define NEW_POSIX (('i' << 24) | ('X' << 16)) 1019 - #define NEW_POSIX_SETA (NEW_POSIX | 2) 1020 - #define NEW_POSIX_SETAW (NEW_POSIX | 3) 1021 - #define NEW_POSIX_SETAF (NEW_POSIX | 4) 1022 - case OLD_POSIX_SETA: 1023 - case OLD_POSIX_SETAW: 1024 - case OLD_POSIX_SETAF: 1025 - case NEW_POSIX_SETA: 1026 - case NEW_POSIX_SETAW: 1027 - case NEW_POSIX_SETAF: 1028 - #ifdef TIOCSETP 1029 - case TIOCSETP: 1030 - #endif 1031 - case TIOCSETD: 1032 - case TIOCSETN: 1033 - rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n"); 1034 - /* 1035 - ** Wait for drain here, at least as far as the double buffer 1036 - ** being empty. 1037 - */ 1038 - /* XXX Does the above comment mean that this has 1039 - still to be implemented? -- REW */ 1040 - /* XXX Is the locking OK together with locking 1041 - in txenable? (Deadlock?) -- REW */ 1042 - 1043 - RIOTxEnable((char *) PortP); 1044 - break; 1045 - default: 1046 - break; 1047 - } 1048 - 1049 - old_cflag = tp->tm.c_cflag; 1050 - old_iflag = tp->tm.c_iflag; 1051 - old_oflag = tp->tm.c_oflag; 1052 - oldcook = PortP->CookMode; 1053 - 1054 - if (p->RIOHalted) { 1055 - RIOClearUp(PortP); 1056 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 1057 - pseterr(EIO); 1058 - return 0; 1059 - } 1060 - 1061 - PortP->FlushCmdBodge = 0; 1062 - 1063 - /* 1064 - ** If the port is locked, and it is reconfigured, we want 1065 - ** to restore the state of the tty structure so the change is NOT 1066 - ** made. 1067 - */ 1068 - if (PortP->Lock) { 1069 - tp->tm.c_iflag = PortP->StoredTty.iflag; 1070 - tp->tm.c_oflag = PortP->StoredTty.oflag; 1071 - tp->tm.c_cflag = PortP->StoredTty.cflag; 1072 - tp->tm.c_lflag = PortP->StoredTty.lflag; 1073 - tp->tm.c_line = PortP->StoredTty.line; 1074 - for (i = 0; i < NCC + 1; i++) 1075 - tp->tm.c_cc[i] = PortP->StoredTty.cc[i]; 1076 - } else { 1077 - /* 1078 - ** If the port is set to store the parameters, and it is 1079 - ** reconfigured, we want to save the current tty struct so it 1080 - ** may be restored on the next open. 1081 - */ 1082 - if (PortP->Store) { 1083 - PortP->StoredTty.iflag = tp->tm.c_iflag; 1084 - PortP->StoredTty.oflag = tp->tm.c_oflag; 1085 - PortP->StoredTty.cflag = tp->tm.c_cflag; 1086 - PortP->StoredTty.lflag = tp->tm.c_lflag; 1087 - PortP->StoredTty.line = tp->tm.c_line; 1088 - for (i = 0; i < NCC + 1; i++) 1089 - PortP->StoredTty.cc[i] = tp->tm.c_cc[i]; 1090 - } 1091 - } 1092 - 1093 - changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag); 1094 - 1095 - PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */ 1096 - 1097 - rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook); 1098 - 1099 - #ifdef MODEM_SUPPORT 1100 - /* 1101 - ** kludge to force CARR_ON if CLOCAL set 1102 - */ 1103 - if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { 1104 - tp->tm.c_state |= CARR_ON; 1105 - wakeup((caddr_t) & tp->tm.c_canq); 1106 - } 1107 - #endif 1108 - 1109 - if (p->RIOHalted) { 1110 - RIOClearUp(PortP); 1111 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 1112 - pseterr(EIO); 1113 - return 0; 1114 - } 1115 - /* 1116 - ** Re-configure if modes or cooking have changed 1117 - */ 1118 - if (changed || oldcook != PortP->CookMode || (ioctl_processed)) { 1119 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 1120 - rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n"); 1121 - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); 1122 - rio_spin_lock_irqsave(&PortP->portSem, flags); 1123 - } 1124 - 1125 - if (p->RIOHalted) { 1126 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 1127 - RIOClearUp(PortP); 1128 - pseterr(EIO); 1129 - return 0; 1130 - } 1131 - rio_spin_unlock_irqrestore(&PortP->portSem, flags); 1132 - return 0; 1133 - } 1134 - 1135 - /* 1136 - ttyseth -- set hardware dependent tty settings 1137 - */ 1138 - void ttyseth(PortP, s, sg) 1139 - struct Port *PortP; 1140 - struct ttystatics *s; 1141 - struct old_sgttyb *sg; 1142 - { 1143 - struct old_sgttyb *tsg; 1144 - struct termios *tp = &s->tm; 1145 - 1146 - tsg = &s->sg; 1147 - 1148 - if (sg->sg_flags & (EVENP | ODDP)) { 1149 - tp->c_cflag &= PARENB; 1150 - if (sg->sg_flags & EVENP) { 1151 - if (sg->sg_flags & ODDP) { 1152 - tp->c_cflag &= V_CS7; 1153 - tp->c_cflag &= ~PARENB; 1154 - } else { 1155 - tp->c_cflag &= V_CS7; 1156 - tp->c_cflag &= PARENB; 1157 - tp->c_cflag &= PARODD; 1158 - } 1159 - } else if (sg->sg_flags & ODDP) { 1160 - tp->c_cflag &= V_CS7; 1161 - tp->c_cflag &= PARENB; 1162 - tp->c_cflag &= PARODD; 1163 - } else { 1164 - tp->c_cflag &= V_CS7; 1165 - tp->c_cflag &= PARENB; 1166 - } 1167 - } 1168 - /* 1169 - * Use ispeed as the desired speed. Most implementations don't handle 1170 - * separate input and output speeds very well. If the RIO handles this, 1171 - * I will have to use separate sets of flags to store them in the 1172 - * Port structure. 1173 - */ 1174 - if (!sg->sg_ospeed) 1175 - sg->sg_ospeed = sg->sg_ispeed; 1176 - else 1177 - sg->sg_ispeed = sg->sg_ospeed; 1178 - if (sg->sg_ispeed > V_EXTB) 1179 - sg->sg_ispeed = V_EXTB; 1180 - if (sg->sg_ispeed < V_B0) 1181 - sg->sg_ispeed = V_B0; 1182 - *tsg = *sg; 1183 - tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed]; 1184 - } 1185 - 1186 - /* 1187 - ttyseth_pv -- set hardware dependent tty settings using either the 1188 - POSIX termios structure or the System V termio structure. 1189 - sysv = 0 => (POSIX): struct termios *sg 1190 - sysv != 0 => (System V): struct termio *sg 1191 - */ 1192 - static void ttyseth_pv(PortP, s, sg, sysv) 1193 - struct Port *PortP; 1194 - struct ttystatics *s; 1195 - struct termios *sg; 1196 - int sysv; 1197 - { 1198 - int speed; 1199 - unsigned char csize; 1200 - unsigned char cread; 1201 - unsigned int lcr_flags; 1202 - int ps; 1203 - 1204 - if (sysv) { 1205 - /* sg points to a System V termio structure */ 1206 - csize = ((struct termio *) sg)->c_cflag & CSIZE; 1207 - cread = ((struct termio *) sg)->c_cflag & CREAD; 1208 - speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD]; 1209 - } else { 1210 - /* sg points to a POSIX termios structure */ 1211 - csize = sg->c_cflag & CSIZE; 1212 - cread = sg->c_cflag & CREAD; 1213 - speed = conv_vb[sg->c_cflag & V_CBAUD]; 1214 - } 1215 - if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) { 1216 - s->sg.sg_ispeed = speed; 1217 - s->sg.sg_ospeed = speed; 1218 - s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed]; 1219 - } 1220 - } 1221 - #endif