aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/istallion.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/istallion.c')
-rw-r--r--drivers/char/istallion.c113
1 files changed, 57 insertions, 56 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 843a2afaf204..505d7a1f6b8c 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -623,24 +623,25 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
623static void stli_brdpoll(struct stlibrd *brdp, cdkhdr_t __iomem *hdrp); 623static void stli_brdpoll(struct stlibrd *brdp, cdkhdr_t __iomem *hdrp);
624static void stli_poll(unsigned long arg); 624static void stli_poll(unsigned long arg);
625static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp); 625static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp);
626static int stli_initopen(struct stlibrd *brdp, struct stliport *portp); 626static int stli_initopen(struct tty_struct *tty, struct stlibrd *brdp, struct stliport *portp);
627static int stli_rawopen(struct stlibrd *brdp, struct stliport *portp, unsigned long arg, int wait); 627static int stli_rawopen(struct stlibrd *brdp, struct stliport *portp, unsigned long arg, int wait);
628static int stli_rawclose(struct stlibrd *brdp, struct stliport *portp, unsigned long arg, int wait); 628static int stli_rawclose(struct stlibrd *brdp, struct stliport *portp, unsigned long arg, int wait);
629static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct file *filp); 629static int stli_waitcarrier(struct tty_struct *tty, struct stlibrd *brdp,
630static int stli_setport(struct stliport *portp); 630 struct stliport *portp, struct file *filp);
631static int stli_setport(struct tty_struct *tty);
631static int stli_cmdwait(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback); 632static int stli_cmdwait(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback);
632static void stli_sendcmd(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback); 633static void stli_sendcmd(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback);
633static void __stli_sendcmd(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback); 634static void __stli_sendcmd(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback);
634static void stli_dodelaycmd(struct stliport *portp, cdkctrl_t __iomem *cp); 635static void stli_dodelaycmd(struct stliport *portp, cdkctrl_t __iomem *cp);
635static void stli_mkasyport(struct stliport *portp, asyport_t *pp, struct ktermios *tiosp); 636static void stli_mkasyport(struct tty_struct *tty, struct stliport *portp, asyport_t *pp, struct ktermios *tiosp);
636static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts); 637static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts);
637static long stli_mktiocm(unsigned long sigvalue); 638static long stli_mktiocm(unsigned long sigvalue);
638static void stli_read(struct stlibrd *brdp, struct stliport *portp); 639static void stli_read(struct stlibrd *brdp, struct stliport *portp);
639static int stli_getserial(struct stliport *portp, struct serial_struct __user *sp); 640static int stli_getserial(struct stliport *portp, struct serial_struct __user *sp);
640static int stli_setserial(struct stliport *portp, struct serial_struct __user *sp); 641static int stli_setserial(struct tty_struct *tty, struct serial_struct __user *sp);
641static int stli_getbrdstats(combrd_t __user *bp); 642static int stli_getbrdstats(combrd_t __user *bp);
642static int stli_getportstats(struct stliport *portp, comstats_t __user *cp); 643static int stli_getportstats(struct tty_struct *tty, struct stliport *portp, comstats_t __user *cp);
643static int stli_portcmdstats(struct stliport *portp); 644static int stli_portcmdstats(struct tty_struct *tty, struct stliport *portp);
644static int stli_clrportstats(struct stliport *portp, comstats_t __user *cp); 645static int stli_clrportstats(struct stliport *portp, comstats_t __user *cp);
645static int stli_getportstruct(struct stliport __user *arg); 646static int stli_getportstruct(struct stliport __user *arg);
646static int stli_getbrdstruct(struct stlibrd __user *arg); 647static int stli_getbrdstruct(struct stlibrd __user *arg);
@@ -731,12 +732,16 @@ static void stli_cleanup_ports(struct stlibrd *brdp)
731{ 732{
732 struct stliport *portp; 733 struct stliport *portp;
733 unsigned int j; 734 unsigned int j;
735 struct tty_struct *tty;
734 736
735 for (j = 0; j < STL_MAXPORTS; j++) { 737 for (j = 0; j < STL_MAXPORTS; j++) {
736 portp = brdp->ports[j]; 738 portp = brdp->ports[j];
737 if (portp != NULL) { 739 if (portp != NULL) {
738 if (portp->port.tty != NULL) 740 tty = tty_port_tty_get(&portp->port);
739 tty_hangup(portp->port.tty); 741 if (tty != NULL) {
742 tty_hangup(tty);
743 tty_kref_put(tty);
744 }
740 kfree(portp); 745 kfree(portp);
741 } 746 }
742 } 747 }
@@ -824,7 +829,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
824 * requires several commands to the board we will need to wait for any 829 * requires several commands to the board we will need to wait for any
825 * other open that is already initializing the port. 830 * other open that is already initializing the port.
826 */ 831 */
827 portp->port.tty = tty; 832 tty_port_tty_set(&portp->port, tty);
828 tty->driver_data = portp; 833 tty->driver_data = portp;
829 portp->port.count++; 834 portp->port.count++;
830 835
@@ -835,7 +840,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
835 840
836 if ((portp->port.flags & ASYNC_INITIALIZED) == 0) { 841 if ((portp->port.flags & ASYNC_INITIALIZED) == 0) {
837 set_bit(ST_INITIALIZING, &portp->state); 842 set_bit(ST_INITIALIZING, &portp->state);
838 if ((rc = stli_initopen(brdp, portp)) >= 0) { 843 if ((rc = stli_initopen(tty, brdp, portp)) >= 0) {
839 portp->port.flags |= ASYNC_INITIALIZED; 844 portp->port.flags |= ASYNC_INITIALIZED;
840 clear_bit(TTY_IO_ERROR, &tty->flags); 845 clear_bit(TTY_IO_ERROR, &tty->flags);
841 } 846 }
@@ -864,7 +869,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
864 * then also we might have to wait for carrier. 869 * then also we might have to wait for carrier.
865 */ 870 */
866 if (!(filp->f_flags & O_NONBLOCK)) { 871 if (!(filp->f_flags & O_NONBLOCK)) {
867 if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) 872 if ((rc = stli_waitcarrier(tty, brdp, portp, filp)) != 0)
868 return rc; 873 return rc;
869 } 874 }
870 portp->port.flags |= ASYNC_NORMAL_ACTIVE; 875 portp->port.flags |= ASYNC_NORMAL_ACTIVE;
@@ -930,7 +935,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
930 stli_flushbuffer(tty); 935 stli_flushbuffer(tty);
931 936
932 tty->closing = 0; 937 tty->closing = 0;
933 portp->port.tty = NULL; 938 tty_port_tty_set(&portp->port, NULL);
934 939
935 if (portp->openwaitcnt) { 940 if (portp->openwaitcnt) {
936 if (portp->close_delay) 941 if (portp->close_delay)
@@ -952,9 +957,9 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
952 * this still all happens pretty quickly. 957 * this still all happens pretty quickly.
953 */ 958 */
954 959
955static int stli_initopen(struct stlibrd *brdp, struct stliport *portp) 960static int stli_initopen(struct tty_struct *tty,
961 struct stlibrd *brdp, struct stliport *portp)
956{ 962{
957 struct tty_struct *tty;
958 asynotify_t nt; 963 asynotify_t nt;
959 asyport_t aport; 964 asyport_t aport;
960 int rc; 965 int rc;
@@ -969,10 +974,7 @@ static int stli_initopen(struct stlibrd *brdp, struct stliport *portp)
969 sizeof(asynotify_t), 0)) < 0) 974 sizeof(asynotify_t), 0)) < 0)
970 return rc; 975 return rc;
971 976
972 tty = portp->port.tty; 977 stli_mkasyport(tty, portp, &aport, tty->termios);
973 if (tty == NULL)
974 return -ENODEV;
975 stli_mkasyport(portp, &aport, tty->termios);
976 if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport, 978 if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport,
977 sizeof(asyport_t), 0)) < 0) 979 sizeof(asyport_t), 0)) < 0)
978 return rc; 980 return rc;
@@ -1161,22 +1163,21 @@ static int stli_cmdwait(struct stlibrd *brdp, struct stliport *portp, unsigned l
1161 * waiting for the command to complete - so must have user context. 1163 * waiting for the command to complete - so must have user context.
1162 */ 1164 */
1163 1165
1164static int stli_setport(struct stliport *portp) 1166static int stli_setport(struct tty_struct *tty)
1165{ 1167{
1168 struct stliport *portp = tty->driver_data;
1166 struct stlibrd *brdp; 1169 struct stlibrd *brdp;
1167 asyport_t aport; 1170 asyport_t aport;
1168 1171
1169 if (portp == NULL) 1172 if (portp == NULL)
1170 return -ENODEV; 1173 return -ENODEV;
1171 if (portp->port.tty == NULL)
1172 return -ENODEV;
1173 if (portp->brdnr >= stli_nrbrds) 1174 if (portp->brdnr >= stli_nrbrds)
1174 return -ENODEV; 1175 return -ENODEV;
1175 brdp = stli_brds[portp->brdnr]; 1176 brdp = stli_brds[portp->brdnr];
1176 if (brdp == NULL) 1177 if (brdp == NULL)
1177 return -ENODEV; 1178 return -ENODEV;
1178 1179
1179 stli_mkasyport(portp, &aport, portp->port.tty->termios); 1180 stli_mkasyport(tty, portp, &aport, tty->termios);
1180 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); 1181 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0));
1181} 1182}
1182 1183
@@ -1187,7 +1188,8 @@ static int stli_setport(struct stliport *portp)
1187 * maybe because if we are clocal then we don't need to wait... 1188 * maybe because if we are clocal then we don't need to wait...
1188 */ 1189 */
1189 1190
1190static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct file *filp) 1191static int stli_waitcarrier(struct tty_struct *tty, struct stlibrd *brdp,
1192 struct stliport *portp, struct file *filp)
1191{ 1193{
1192 unsigned long flags; 1194 unsigned long flags;
1193 int rc, doclocal; 1195 int rc, doclocal;
@@ -1195,7 +1197,7 @@ static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct
1195 rc = 0; 1197 rc = 0;
1196 doclocal = 0; 1198 doclocal = 0;
1197 1199
1198 if (portp->port.tty->termios->c_cflag & CLOCAL) 1200 if (tty->termios->c_cflag & CLOCAL)
1199 doclocal++; 1201 doclocal++;
1200 1202
1201 spin_lock_irqsave(&stli_lock, flags); 1203 spin_lock_irqsave(&stli_lock, flags);
@@ -1373,8 +1375,6 @@ static void stli_flushchars(struct tty_struct *tty)
1373 stli_txcookrealsize = 0; 1375 stli_txcookrealsize = 0;
1374 stli_txcooktty = NULL; 1376 stli_txcooktty = NULL;
1375 1377
1376 if (tty == NULL)
1377 return;
1378 if (cooktty == NULL) 1378 if (cooktty == NULL)
1379 return; 1379 return;
1380 if (tty != cooktty) 1380 if (tty != cooktty)
@@ -1572,10 +1572,11 @@ static int stli_getserial(struct stliport *portp, struct serial_struct __user *s
1572 * just quietly ignore any requests to change irq, etc. 1572 * just quietly ignore any requests to change irq, etc.
1573 */ 1573 */
1574 1574
1575static int stli_setserial(struct stliport *portp, struct serial_struct __user *sp) 1575static int stli_setserial(struct tty_struct *tty, struct serial_struct __user *sp)
1576{ 1576{
1577 struct serial_struct sio; 1577 struct serial_struct sio;
1578 int rc; 1578 int rc;
1579 struct stliport *portp = tty->driver_data;
1579 1580
1580 if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) 1581 if (copy_from_user(&sio, sp, sizeof(struct serial_struct)))
1581 return -EFAULT; 1582 return -EFAULT;
@@ -1594,7 +1595,7 @@ static int stli_setserial(struct stliport *portp, struct serial_struct __user *s
1594 portp->closing_wait = sio.closing_wait; 1595 portp->closing_wait = sio.closing_wait;
1595 portp->custom_divisor = sio.custom_divisor; 1596 portp->custom_divisor = sio.custom_divisor;
1596 1597
1597 if ((rc = stli_setport(portp)) < 0) 1598 if ((rc = stli_setport(tty)) < 0)
1598 return rc; 1599 return rc;
1599 return 0; 1600 return 0;
1600} 1601}
@@ -1685,17 +1686,17 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1685 rc = stli_getserial(portp, argp); 1686 rc = stli_getserial(portp, argp);
1686 break; 1687 break;
1687 case TIOCSSERIAL: 1688 case TIOCSSERIAL:
1688 rc = stli_setserial(portp, argp); 1689 rc = stli_setserial(tty, argp);
1689 break; 1690 break;
1690 case STL_GETPFLAG: 1691 case STL_GETPFLAG:
1691 rc = put_user(portp->pflag, (unsigned __user *)argp); 1692 rc = put_user(portp->pflag, (unsigned __user *)argp);
1692 break; 1693 break;
1693 case STL_SETPFLAG: 1694 case STL_SETPFLAG:
1694 if ((rc = get_user(portp->pflag, (unsigned __user *)argp)) == 0) 1695 if ((rc = get_user(portp->pflag, (unsigned __user *)argp)) == 0)
1695 stli_setport(portp); 1696 stli_setport(tty);
1696 break; 1697 break;
1697 case COM_GETPORTSTATS: 1698 case COM_GETPORTSTATS:
1698 rc = stli_getportstats(portp, argp); 1699 rc = stli_getportstats(tty, portp, argp);
1699 break; 1700 break;
1700 case COM_CLRPORTSTATS: 1701 case COM_CLRPORTSTATS:
1701 rc = stli_clrportstats(portp, argp); 1702 rc = stli_clrportstats(portp, argp);
@@ -1729,8 +1730,6 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old)
1729 struct ktermios *tiosp; 1730 struct ktermios *tiosp;
1730 asyport_t aport; 1731 asyport_t aport;
1731 1732
1732 if (tty == NULL)
1733 return;
1734 portp = tty->driver_data; 1733 portp = tty->driver_data;
1735 if (portp == NULL) 1734 if (portp == NULL)
1736 return; 1735 return;
@@ -1742,7 +1741,7 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old)
1742 1741
1743 tiosp = tty->termios; 1742 tiosp = tty->termios;
1744 1743
1745 stli_mkasyport(portp, &aport, tiosp); 1744 stli_mkasyport(tty, portp, &aport, tiosp);
1746 stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0); 1745 stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0);
1747 stli_mkasysigs(&portp->asig, ((tiosp->c_cflag & CBAUD) ? 1 : 0), -1); 1746 stli_mkasysigs(&portp->asig, ((tiosp->c_cflag & CBAUD) ? 1 : 0), -1);
1748 stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, 1747 stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig,
@@ -1854,7 +1853,7 @@ static void stli_hangup(struct tty_struct *tty)
1854 clear_bit(ST_TXBUSY, &portp->state); 1853 clear_bit(ST_TXBUSY, &portp->state);
1855 clear_bit(ST_RXSTOP, &portp->state); 1854 clear_bit(ST_RXSTOP, &portp->state);
1856 set_bit(TTY_IO_ERROR, &tty->flags); 1855 set_bit(TTY_IO_ERROR, &tty->flags);
1857 portp->port.tty = NULL; 1856 tty_port_tty_set(&portp->port, NULL);
1858 portp->port.flags &= ~ASYNC_NORMAL_ACTIVE; 1857 portp->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1859 portp->port.count = 0; 1858 portp->port.count = 0;
1860 spin_unlock_irqrestore(&stli_lock, flags); 1859 spin_unlock_irqrestore(&stli_lock, flags);
@@ -1935,8 +1934,6 @@ static void stli_waituntilsent(struct tty_struct *tty, int timeout)
1935 struct stliport *portp; 1934 struct stliport *portp;
1936 unsigned long tend; 1935 unsigned long tend;
1937 1936
1938 if (tty == NULL)
1939 return;
1940 portp = tty->driver_data; 1937 portp = tty->driver_data;
1941 if (portp == NULL) 1938 if (portp == NULL)
1942 return; 1939 return;
@@ -1998,7 +1995,7 @@ static int stli_portinfo(struct stlibrd *brdp, struct stliport *portp, int portn
1998 char *sp, *uart; 1995 char *sp, *uart;
1999 int rc, cnt; 1996 int rc, cnt;
2000 1997
2001 rc = stli_portcmdstats(portp); 1998 rc = stli_portcmdstats(NULL, portp);
2002 1999
2003 uart = "UNKNOWN"; 2000 uart = "UNKNOWN";
2004 if (brdp->state & BST_STARTED) { 2001 if (brdp->state & BST_STARTED) {
@@ -2188,7 +2185,7 @@ static void stli_read(struct stlibrd *brdp, struct stliport *portp)
2188 2185
2189 if (test_bit(ST_RXSTOP, &portp->state)) 2186 if (test_bit(ST_RXSTOP, &portp->state))
2190 return; 2187 return;
2191 tty = portp->port.tty; 2188 tty = tty_port_tty_get(&portp->port);
2192 if (tty == NULL) 2189 if (tty == NULL)
2193 return; 2190 return;
2194 2191
@@ -2230,6 +2227,7 @@ static void stli_read(struct stlibrd *brdp, struct stliport *portp)
2230 set_bit(ST_RXING, &portp->state); 2227 set_bit(ST_RXING, &portp->state);
2231 2228
2232 tty_schedule_flip(tty); 2229 tty_schedule_flip(tty);
2230 tty_kref_put(tty);
2233} 2231}
2234 2232
2235/*****************************************************************************/ 2233/*****************************************************************************/
@@ -2362,7 +2360,7 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp)
2362 if (ap->notify) { 2360 if (ap->notify) {
2363 nt = ap->changed; 2361 nt = ap->changed;
2364 ap->notify = 0; 2362 ap->notify = 0;
2365 tty = portp->port.tty; 2363 tty = tty_port_tty_get(&portp->port);
2366 2364
2367 if (nt.signal & SG_DCD) { 2365 if (nt.signal & SG_DCD) {
2368 oldsigs = portp->sigs; 2366 oldsigs = portp->sigs;
@@ -2399,6 +2397,7 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp)
2399 tty_schedule_flip(tty); 2397 tty_schedule_flip(tty);
2400 } 2398 }
2401 } 2399 }
2400 tty_kref_put(tty);
2402 2401
2403 if (nt.data & DT_RXBUSY) { 2402 if (nt.data & DT_RXBUSY) {
2404 donerx++; 2403 donerx++;
@@ -2535,14 +2534,15 @@ static void stli_poll(unsigned long arg)
2535 * the slave. 2534 * the slave.
2536 */ 2535 */
2537 2536
2538static void stli_mkasyport(struct stliport *portp, asyport_t *pp, struct ktermios *tiosp) 2537static void stli_mkasyport(struct tty_struct *tty, struct stliport *portp,
2538 asyport_t *pp, struct ktermios *tiosp)
2539{ 2539{
2540 memset(pp, 0, sizeof(asyport_t)); 2540 memset(pp, 0, sizeof(asyport_t));
2541 2541
2542/* 2542/*
2543 * Start of by setting the baud, char size, parity and stop bit info. 2543 * Start of by setting the baud, char size, parity and stop bit info.
2544 */ 2544 */
2545 pp->baudout = tty_get_baud_rate(portp->port.tty); 2545 pp->baudout = tty_get_baud_rate(tty);
2546 if ((tiosp->c_cflag & CBAUD) == B38400) { 2546 if ((tiosp->c_cflag & CBAUD) == B38400) {
2547 if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 2547 if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
2548 pp->baudout = 57600; 2548 pp->baudout = 57600;
@@ -2695,7 +2695,7 @@ static int stli_initports(struct stlibrd *brdp)
2695 printk("STALLION: failed to allocate port structure\n"); 2695 printk("STALLION: failed to allocate port structure\n");
2696 continue; 2696 continue;
2697 } 2697 }
2698 2698 tty_port_init(&portp->port);
2699 portp->magic = STLI_PORTMAGIC; 2699 portp->magic = STLI_PORTMAGIC;
2700 portp->portnr = i; 2700 portp->portnr = i;
2701 portp->brdnr = brdp->brdnr; 2701 portp->brdnr = brdp->brdnr;
@@ -4220,7 +4220,7 @@ static struct stliport *stli_getport(unsigned int brdnr, unsigned int panelnr,
4220 * what port to get stats for (used through board control device). 4220 * what port to get stats for (used through board control device).
4221 */ 4221 */
4222 4222
4223static int stli_portcmdstats(struct stliport *portp) 4223static int stli_portcmdstats(struct tty_struct *tty, struct stliport *portp)
4224{ 4224{
4225 unsigned long flags; 4225 unsigned long flags;
4226 struct stlibrd *brdp; 4226 struct stlibrd *brdp;
@@ -4249,15 +4249,15 @@ static int stli_portcmdstats(struct stliport *portp)
4249 stli_comstats.flags = portp->port.flags; 4249 stli_comstats.flags = portp->port.flags;
4250 4250
4251 spin_lock_irqsave(&brd_lock, flags); 4251 spin_lock_irqsave(&brd_lock, flags);
4252 if (portp->port.tty != NULL) { 4252 if (tty != NULL) {
4253 if (portp->port.tty->driver_data == portp) { 4253 if (portp->port.tty == tty) {
4254 stli_comstats.ttystate = portp->port.tty->flags; 4254 stli_comstats.ttystate = tty->flags;
4255 stli_comstats.rxbuffered = -1; 4255 stli_comstats.rxbuffered = -1;
4256 if (portp->port.tty->termios != NULL) { 4256 if (tty->termios != NULL) {
4257 stli_comstats.cflags = portp->port.tty->termios->c_cflag; 4257 stli_comstats.cflags = tty->termios->c_cflag;
4258 stli_comstats.iflags = portp->port.tty->termios->c_iflag; 4258 stli_comstats.iflags = tty->termios->c_iflag;
4259 stli_comstats.oflags = portp->port.tty->termios->c_oflag; 4259 stli_comstats.oflags = tty->termios->c_oflag;
4260 stli_comstats.lflags = portp->port.tty->termios->c_lflag; 4260 stli_comstats.lflags = tty->termios->c_lflag;
4261 } 4261 }
4262 } 4262 }
4263 } 4263 }
@@ -4294,7 +4294,8 @@ static int stli_portcmdstats(struct stliport *portp)
4294 * what port to get stats for (used through board control device). 4294 * what port to get stats for (used through board control device).
4295 */ 4295 */
4296 4296
4297static int stli_getportstats(struct stliport *portp, comstats_t __user *cp) 4297static int stli_getportstats(struct tty_struct *tty, struct stliport *portp,
4298 comstats_t __user *cp)
4298{ 4299{
4299 struct stlibrd *brdp; 4300 struct stlibrd *brdp;
4300 int rc; 4301 int rc;
@@ -4312,7 +4313,7 @@ static int stli_getportstats(struct stliport *portp, comstats_t __user *cp)
4312 if (!brdp) 4313 if (!brdp)
4313 return -ENODEV; 4314 return -ENODEV;
4314 4315
4315 if ((rc = stli_portcmdstats(portp)) < 0) 4316 if ((rc = stli_portcmdstats(tty, portp)) < 0)
4316 return rc; 4317 return rc;
4317 4318
4318 return copy_to_user(cp, &stli_comstats, sizeof(comstats_t)) ? 4319 return copy_to_user(cp, &stli_comstats, sizeof(comstats_t)) ?
@@ -4427,7 +4428,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
4427 4428
4428 switch (cmd) { 4429 switch (cmd) {
4429 case COM_GETPORTSTATS: 4430 case COM_GETPORTSTATS:
4430 rc = stli_getportstats(NULL, argp); 4431 rc = stli_getportstats(NULL, NULL, argp);
4431 done++; 4432 done++;
4432 break; 4433 break;
4433 case COM_CLRPORTSTATS: 4434 case COM_CLRPORTSTATS: