Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

istallion: use tty_port

Switch istallion to use the new tty_port structure

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

authored by

Alan Cox and committed by
Linus Torvalds
b02f5ad6 f1d03228

+59 -63
+58 -58
drivers/char/istallion.c
··· 735 735 for (j = 0; j < STL_MAXPORTS; j++) { 736 736 portp = brdp->ports[j]; 737 737 if (portp != NULL) { 738 - if (portp->tty != NULL) 739 - tty_hangup(portp->tty); 738 + if (portp->port.tty != NULL) 739 + tty_hangup(portp->port.tty); 740 740 kfree(portp); 741 741 } 742 742 } ··· 811 811 * The sleep here does not need interrupt protection since the wakeup 812 812 * for it is done with the same context. 813 813 */ 814 - if (portp->flags & ASYNC_CLOSING) { 815 - interruptible_sleep_on(&portp->close_wait); 816 - if (portp->flags & ASYNC_HUP_NOTIFY) 814 + if (portp->port.flags & ASYNC_CLOSING) { 815 + interruptible_sleep_on(&portp->port.close_wait); 816 + if (portp->port.flags & ASYNC_HUP_NOTIFY) 817 817 return -EAGAIN; 818 818 return -ERESTARTSYS; 819 819 } ··· 824 824 * requires several commands to the board we will need to wait for any 825 825 * other open that is already initializing the port. 826 826 */ 827 - portp->tty = tty; 827 + portp->port.tty = tty; 828 828 tty->driver_data = portp; 829 829 portp->refcount++; 830 830 ··· 833 833 if (signal_pending(current)) 834 834 return -ERESTARTSYS; 835 835 836 - if ((portp->flags & ASYNC_INITIALIZED) == 0) { 836 + if ((portp->port.flags & ASYNC_INITIALIZED) == 0) { 837 837 set_bit(ST_INITIALIZING, &portp->state); 838 838 if ((rc = stli_initopen(brdp, portp)) >= 0) { 839 - portp->flags |= ASYNC_INITIALIZED; 839 + portp->port.flags |= ASYNC_INITIALIZED; 840 840 clear_bit(TTY_IO_ERROR, &tty->flags); 841 841 } 842 842 clear_bit(ST_INITIALIZING, &portp->state); ··· 851 851 * The sleep here does not need interrupt protection since the wakeup 852 852 * for it is done with the same context. 853 853 */ 854 - if (portp->flags & ASYNC_CLOSING) { 855 - interruptible_sleep_on(&portp->close_wait); 856 - if (portp->flags & ASYNC_HUP_NOTIFY) 854 + if (portp->port.flags & ASYNC_CLOSING) { 855 + interruptible_sleep_on(&portp->port.close_wait); 856 + if (portp->port.flags & ASYNC_HUP_NOTIFY) 857 857 return -EAGAIN; 858 858 return -ERESTARTSYS; 859 859 } ··· 867 867 if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) 868 868 return rc; 869 869 } 870 - portp->flags |= ASYNC_NORMAL_ACTIVE; 870 + portp->port.flags |= ASYNC_NORMAL_ACTIVE; 871 871 return 0; 872 872 } 873 873 ··· 895 895 return; 896 896 } 897 897 898 - portp->flags |= ASYNC_CLOSING; 898 + portp->port.flags |= ASYNC_CLOSING; 899 899 900 900 /* 901 901 * May want to wait for data to drain before closing. The BUSY flag ··· 911 911 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) 912 912 tty_wait_until_sent(tty, portp->closing_wait); 913 913 914 - portp->flags &= ~ASYNC_INITIALIZED; 914 + portp->port.flags &= ~ASYNC_INITIALIZED; 915 915 brdp = stli_brds[portp->brdnr]; 916 916 stli_rawclose(brdp, portp, 0, 0); 917 917 if (tty->termios->c_cflag & HUPCL) { ··· 931 931 stli_flushbuffer(tty); 932 932 933 933 tty->closing = 0; 934 - portp->tty = NULL; 934 + portp->port.tty = NULL; 935 935 936 936 if (portp->openwaitcnt) { 937 937 if (portp->close_delay) 938 938 msleep_interruptible(jiffies_to_msecs(portp->close_delay)); 939 - wake_up_interruptible(&portp->open_wait); 939 + wake_up_interruptible(&portp->port.open_wait); 940 940 } 941 941 942 - portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 943 - wake_up_interruptible(&portp->close_wait); 942 + portp->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 943 + wake_up_interruptible(&portp->port.close_wait); 944 944 } 945 945 946 946 /*****************************************************************************/ ··· 970 970 sizeof(asynotify_t), 0)) < 0) 971 971 return rc; 972 972 973 - tty = portp->tty; 973 + tty = portp->port.tty; 974 974 if (tty == NULL) 975 975 return -ENODEV; 976 976 stli_mkasyport(portp, &aport, tty->termios); ··· 1169 1169 1170 1170 if (portp == NULL) 1171 1171 return -ENODEV; 1172 - if (portp->tty == NULL) 1172 + if (portp->port.tty == NULL) 1173 1173 return -ENODEV; 1174 1174 if (portp->brdnr >= stli_nrbrds) 1175 1175 return -ENODEV; ··· 1177 1177 if (brdp == NULL) 1178 1178 return -ENODEV; 1179 1179 1180 - stli_mkasyport(portp, &aport, portp->tty->termios); 1180 + stli_mkasyport(portp, &aport, portp->port.tty->termios); 1181 1181 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); 1182 1182 } 1183 1183 ··· 1196 1196 rc = 0; 1197 1197 doclocal = 0; 1198 1198 1199 - if (portp->tty->termios->c_cflag & CLOCAL) 1199 + if (portp->port.tty->termios->c_cflag & CLOCAL) 1200 1200 doclocal++; 1201 1201 1202 1202 spin_lock_irqsave(&stli_lock, flags); ··· 1211 1211 &portp->asig, sizeof(asysigs_t), 0)) < 0) 1212 1212 break; 1213 1213 if (tty_hung_up_p(filp) || 1214 - ((portp->flags & ASYNC_INITIALIZED) == 0)) { 1215 - if (portp->flags & ASYNC_HUP_NOTIFY) 1214 + ((portp->port.flags & ASYNC_INITIALIZED) == 0)) { 1215 + if (portp->port.flags & ASYNC_HUP_NOTIFY) 1216 1216 rc = -EBUSY; 1217 1217 else 1218 1218 rc = -ERESTARTSYS; 1219 1219 break; 1220 1220 } 1221 - if (((portp->flags & ASYNC_CLOSING) == 0) && 1221 + if (((portp->port.flags & ASYNC_CLOSING) == 0) && 1222 1222 (doclocal || (portp->sigs & TIOCM_CD))) { 1223 1223 break; 1224 1224 } ··· 1226 1226 rc = -ERESTARTSYS; 1227 1227 break; 1228 1228 } 1229 - interruptible_sleep_on(&portp->open_wait); 1229 + interruptible_sleep_on(&portp->port.open_wait); 1230 1230 } 1231 1231 1232 1232 spin_lock_irqsave(&stli_lock, flags); ··· 1548 1548 sio.type = PORT_UNKNOWN; 1549 1549 sio.line = portp->portnr; 1550 1550 sio.irq = 0; 1551 - sio.flags = portp->flags; 1551 + sio.flags = portp->port.flags; 1552 1552 sio.baud_base = portp->baud_base; 1553 1553 sio.close_delay = portp->close_delay; 1554 1554 sio.closing_wait = portp->closing_wait; ··· 1583 1583 if ((sio.baud_base != portp->baud_base) || 1584 1584 (sio.close_delay != portp->close_delay) || 1585 1585 ((sio.flags & ~ASYNC_USR_MASK) != 1586 - (portp->flags & ~ASYNC_USR_MASK))) 1586 + (portp->port.flags & ~ASYNC_USR_MASK))) 1587 1587 return -EPERM; 1588 1588 } 1589 1589 1590 - portp->flags = (portp->flags & ~ASYNC_USR_MASK) | 1590 + portp->port.flags = (portp->port.flags & ~ASYNC_USR_MASK) | 1591 1591 (sio.flags & ASYNC_USR_MASK); 1592 1592 portp->baud_base = sio.baud_base; 1593 1593 portp->close_delay = sio.close_delay; ··· 1751 1751 if ((old->c_cflag & CRTSCTS) && ((tiosp->c_cflag & CRTSCTS) == 0)) 1752 1752 tty->hw_stopped = 0; 1753 1753 if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL)) 1754 - wake_up_interruptible(&portp->open_wait); 1754 + wake_up_interruptible(&portp->port.open_wait); 1755 1755 } 1756 1756 1757 1757 /*****************************************************************************/ ··· 1834 1834 if (brdp == NULL) 1835 1835 return; 1836 1836 1837 - portp->flags &= ~ASYNC_INITIALIZED; 1837 + portp->port.flags &= ~ASYNC_INITIALIZED; 1838 1838 1839 1839 if (!test_bit(ST_CLOSING, &portp->state)) 1840 1840 stli_rawclose(brdp, portp, 0, 0); ··· 1855 1855 clear_bit(ST_TXBUSY, &portp->state); 1856 1856 clear_bit(ST_RXSTOP, &portp->state); 1857 1857 set_bit(TTY_IO_ERROR, &tty->flags); 1858 - portp->tty = NULL; 1859 - portp->flags &= ~ASYNC_NORMAL_ACTIVE; 1858 + portp->port.tty = NULL; 1859 + portp->port.flags &= ~ASYNC_NORMAL_ACTIVE; 1860 1860 portp->refcount = 0; 1861 1861 spin_unlock_irqrestore(&stli_lock, flags); 1862 1862 1863 - wake_up_interruptible(&portp->open_wait); 1863 + wake_up_interruptible(&portp->port.open_wait); 1864 1864 } 1865 1865 1866 1866 /*****************************************************************************/ ··· 2188 2188 2189 2189 if (test_bit(ST_RXSTOP, &portp->state)) 2190 2190 return; 2191 - tty = portp->tty; 2191 + tty = portp->port.tty; 2192 2192 if (tty == NULL) 2193 2193 return; 2194 2194 ··· 2362 2362 if (ap->notify) { 2363 2363 nt = ap->changed; 2364 2364 ap->notify = 0; 2365 - tty = portp->tty; 2365 + tty = portp->port.tty; 2366 2366 2367 2367 if (nt.signal & SG_DCD) { 2368 2368 oldsigs = portp->sigs; ··· 2370 2370 clear_bit(ST_GETSIGS, &portp->state); 2371 2371 if ((portp->sigs & TIOCM_CD) && 2372 2372 ((oldsigs & TIOCM_CD) == 0)) 2373 - wake_up_interruptible(&portp->open_wait); 2373 + wake_up_interruptible(&portp->port.open_wait); 2374 2374 if ((oldsigs & TIOCM_CD) && 2375 2375 ((portp->sigs & TIOCM_CD) == 0)) { 2376 - if (portp->flags & ASYNC_CHECK_CD) { 2376 + if (portp->port.flags & ASYNC_CHECK_CD) { 2377 2377 if (tty) 2378 2378 tty_hangup(tty); 2379 2379 } ··· 2392 2392 if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { 2393 2393 if (tty != NULL) { 2394 2394 tty_insert_flip_char(tty, 0, TTY_BREAK); 2395 - if (portp->flags & ASYNC_SAK) { 2395 + if (portp->port.flags & ASYNC_SAK) { 2396 2396 do_SAK(tty); 2397 2397 EBRDENABLE(brdp); 2398 2398 } ··· 2542 2542 /* 2543 2543 * Start of by setting the baud, char size, parity and stop bit info. 2544 2544 */ 2545 - pp->baudout = tty_get_baud_rate(portp->tty); 2545 + pp->baudout = tty_get_baud_rate(portp->port.tty); 2546 2546 if ((tiosp->c_cflag & CBAUD) == B38400) { 2547 - if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 2547 + if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 2548 2548 pp->baudout = 57600; 2549 - else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 2549 + else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 2550 2550 pp->baudout = 115200; 2551 - else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 2551 + else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 2552 2552 pp->baudout = 230400; 2553 - else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 2553 + else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 2554 2554 pp->baudout = 460800; 2555 - else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) 2555 + else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) 2556 2556 pp->baudout = (portp->baud_base / portp->custom_divisor); 2557 2557 } 2558 2558 if (pp->baudout > STL_MAXBAUD) ··· 2625 2625 * Set up clocal processing as required. 2626 2626 */ 2627 2627 if (tiosp->c_cflag & CLOCAL) 2628 - portp->flags &= ~ASYNC_CHECK_CD; 2628 + portp->port.flags &= ~ASYNC_CHECK_CD; 2629 2629 else 2630 - portp->flags |= ASYNC_CHECK_CD; 2630 + portp->port.flags |= ASYNC_CHECK_CD; 2631 2631 2632 2632 /* 2633 2633 * Transfer any persistent flags into the asyport structure. ··· 2703 2703 portp->baud_base = STL_BAUDBASE; 2704 2704 portp->close_delay = STL_CLOSEDELAY; 2705 2705 portp->closing_wait = 30 * HZ; 2706 - init_waitqueue_head(&portp->open_wait); 2707 - init_waitqueue_head(&portp->close_wait); 2706 + init_waitqueue_head(&portp->port.open_wait); 2707 + init_waitqueue_head(&portp->port.close_wait); 2708 2708 init_waitqueue_head(&portp->raw_wait); 2709 2709 panelport++; 2710 2710 if (panelport >= brdp->panels[panelnr]) { ··· 4246 4246 stli_comstats.panel = portp->panelnr; 4247 4247 stli_comstats.port = portp->portnr; 4248 4248 stli_comstats.state = portp->state; 4249 - stli_comstats.flags = portp->flags; 4249 + stli_comstats.flags = portp->port.flag; 4250 4250 4251 4251 spin_lock_irqsave(&brd_lock, flags); 4252 - if (portp->tty != NULL) { 4253 - if (portp->tty->driver_data == portp) { 4254 - stli_comstats.ttystate = portp->tty->flags; 4252 + if (portp->port.tty != NULL) { 4253 + if (portp->port.tty->driver_data == portp) { 4254 + stli_comstats.ttystate = portp->port.tty->flags; 4255 4255 stli_comstats.rxbuffered = -1; 4256 - if (portp->tty->termios != NULL) { 4257 - stli_comstats.cflags = portp->tty->termios->c_cflag; 4258 - stli_comstats.iflags = portp->tty->termios->c_iflag; 4259 - stli_comstats.oflags = portp->tty->termios->c_oflag; 4260 - stli_comstats.lflags = portp->tty->termios->c_lflag; 4256 + if (portp->port.tty->termios != NULL) { 4257 + stli_comstats.cflags = portp->port.tty->termios->c_cflag; 4258 + stli_comstats.iflags = portp->port.tty->termios->c_iflag; 4259 + stli_comstats.oflags = portp->port.tty->termios->c_oflag; 4260 + stli_comstats.lflags = portp->port.tty->termios->c_lflag; 4261 4261 } 4262 4262 } 4263 4263 }
+1 -5
include/linux/istallion.h
··· 51 51 */ 52 52 struct stliport { 53 53 unsigned long magic; 54 + struct tty_port port; 54 55 unsigned int portnr; 55 56 unsigned int panelnr; 56 57 unsigned int brdnr; 57 58 unsigned long state; 58 59 unsigned int devnr; 59 - int flags; 60 60 int baud_base; 61 61 int custom_divisor; 62 62 int close_delay; 63 63 int closing_wait; 64 - int refcount; 65 64 int openwaitcnt; 66 65 int rc; 67 66 int argsize; 68 67 void *argp; 69 68 unsigned int rxmarkmsk; 70 - struct tty_struct *tty; 71 - wait_queue_head_t open_wait; 72 - wait_queue_head_t close_wait; 73 69 wait_queue_head_t raw_wait; 74 70 struct asysigs asig; 75 71 unsigned long addr;