aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/istallion.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-10-13 05:40:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:41 -0400
commitd18a750fe9fa3b6cab882d51f99bba25bb0a006e (patch)
tree391ccab5a5847782ae48dde60a661486f434ae35 /drivers/char/istallion.c
parentd450b5a0196b6442cf3f29fc611d9c8daa56b559 (diff)
stallion: Use krefs
Use tty_port_init and krefs in the stallion drivers to protect us from devices going away underneath us. As with the other drives some rearranging is done to pass the tty structure down properly on the user side. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/istallion.c')
-rw-r--r--drivers/char/istallion.c107
1 files changed, 57 insertions, 50 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 843a2afaf204..96ee1121acef 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);
@@ -1572,10 +1574,11 @@ static int stli_getserial(struct stliport *portp, struct serial_struct __user *s
1572 * just quietly ignore any requests to change irq, etc. 1574 * just quietly ignore any requests to change irq, etc.
1573 */ 1575 */
1574 1576
1575static int stli_setserial(struct stliport *portp, struct serial_struct __user *sp) 1577static int stli_setserial(struct tty_struct *tty, struct serial_struct __user *sp)
1576{ 1578{
1577 struct serial_struct sio; 1579 struct serial_struct sio;
1578 int rc; 1580 int rc;
1581 struct stliport *portp = tty->driver_data;
1579 1582
1580 if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) 1583 if (copy_from_user(&sio, sp, sizeof(struct serial_struct)))
1581 return -EFAULT; 1584 return -EFAULT;
@@ -1594,7 +1597,7 @@ static int stli_setserial(struct stliport *portp, struct serial_struct __user *s
1594 portp->closing_wait = sio.closing_wait; 1597 portp->closing_wait = sio.closing_wait;
1595 portp->custom_divisor = sio.custom_divisor; 1598 portp->custom_divisor = sio.custom_divisor;
1596 1599
1597 if ((rc = stli_setport(portp)) < 0) 1600 if ((rc = stli_setport(tty)) < 0)
1598 return rc; 1601 return rc;
1599 return 0; 1602 return 0;
1600} 1603}
@@ -1685,17 +1688,17 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1685 rc = stli_getserial(portp, argp); 1688 rc = stli_getserial(portp, argp);
1686 break; 1689 break;
1687 case TIOCSSERIAL: 1690 case TIOCSSERIAL:
1688 rc = stli_setserial(portp, argp); 1691 rc = stli_setserial(tty, argp);
1689 break; 1692 break;
1690 case STL_GETPFLAG: 1693 case STL_GETPFLAG:
1691 rc = put_user(portp->pflag, (unsigned __user *)argp); 1694 rc = put_user(portp->pflag, (unsigned __user *)argp);
1692 break; 1695 break;
1693 case STL_SETPFLAG: 1696 case STL_SETPFLAG:
1694 if ((rc = get_user(portp->pflag, (unsigned __user *)argp)) == 0) 1697 if ((rc = get_user(portp->pflag, (unsigned __user *)argp)) == 0)
1695 stli_setport(portp); 1698 stli_setport(tty);
1696 break; 1699 break;
1697 case COM_GETPORTSTATS: 1700 case COM_GETPORTSTATS:
1698 rc = stli_getportstats(portp, argp); 1701 rc = stli_getportstats(tty, portp, argp);
1699 break; 1702 break;
1700 case COM_CLRPORTSTATS: 1703 case COM_CLRPORTSTATS:
1701 rc = stli_clrportstats(portp, argp); 1704 rc = stli_clrportstats(portp, argp);
@@ -1742,7 +1745,7 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old)
1742 1745
1743 tiosp = tty->termios; 1746 tiosp = tty->termios;
1744 1747
1745 stli_mkasyport(portp, &aport, tiosp); 1748 stli_mkasyport(tty, portp, &aport, tiosp);
1746 stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0); 1749 stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0);
1747 stli_mkasysigs(&portp->asig, ((tiosp->c_cflag & CBAUD) ? 1 : 0), -1); 1750 stli_mkasysigs(&portp->asig, ((tiosp->c_cflag & CBAUD) ? 1 : 0), -1);
1748 stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, 1751 stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig,
@@ -1854,7 +1857,7 @@ static void stli_hangup(struct tty_struct *tty)
1854 clear_bit(ST_TXBUSY, &portp->state); 1857 clear_bit(ST_TXBUSY, &portp->state);
1855 clear_bit(ST_RXSTOP, &portp->state); 1858 clear_bit(ST_RXSTOP, &portp->state);
1856 set_bit(TTY_IO_ERROR, &tty->flags); 1859 set_bit(TTY_IO_ERROR, &tty->flags);
1857 portp->port.tty = NULL; 1860 tty_port_tty_set(&portp->port, NULL);
1858 portp->port.flags &= ~ASYNC_NORMAL_ACTIVE; 1861 portp->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1859 portp->port.count = 0; 1862 portp->port.count = 0;
1860 spin_unlock_irqrestore(&stli_lock, flags); 1863 spin_unlock_irqrestore(&stli_lock, flags);
@@ -1998,7 +2001,7 @@ static int stli_portinfo(struct stlibrd *brdp, struct stliport *portp, int portn
1998 char *sp, *uart; 2001 char *sp, *uart;
1999 int rc, cnt; 2002 int rc, cnt;
2000 2003
2001 rc = stli_portcmdstats(portp); 2004 rc = stli_portcmdstats(NULL, portp);
2002 2005
2003 uart = "UNKNOWN"; 2006 uart = "UNKNOWN";
2004 if (brdp->state & BST_STARTED) { 2007 if (brdp->state & BST_STARTED) {
@@ -2188,7 +2191,7 @@ static void stli_read(struct stlibrd *brdp, struct stliport *portp)
2188 2191
2189 if (test_bit(ST_RXSTOP, &portp->state)) 2192 if (test_bit(ST_RXSTOP, &portp->state))
2190 return; 2193 return;
2191 tty = portp->port.tty; 2194 tty = tty_port_tty_get(&portp->port);
2192 if (tty == NULL) 2195 if (tty == NULL)
2193 return; 2196 return;
2194 2197
@@ -2230,6 +2233,7 @@ static void stli_read(struct stlibrd *brdp, struct stliport *portp)
2230 set_bit(ST_RXING, &portp->state); 2233 set_bit(ST_RXING, &portp->state);
2231 2234
2232 tty_schedule_flip(tty); 2235 tty_schedule_flip(tty);
2236 tty_kref_put(tty);
2233} 2237}
2234 2238
2235/*****************************************************************************/ 2239/*****************************************************************************/
@@ -2362,7 +2366,7 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp)
2362 if (ap->notify) { 2366 if (ap->notify) {
2363 nt = ap->changed; 2367 nt = ap->changed;
2364 ap->notify = 0; 2368 ap->notify = 0;
2365 tty = portp->port.tty; 2369 tty = tty_port_tty_get(&portp->port);
2366 2370
2367 if (nt.signal & SG_DCD) { 2371 if (nt.signal & SG_DCD) {
2368 oldsigs = portp->sigs; 2372 oldsigs = portp->sigs;
@@ -2399,6 +2403,7 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp)
2399 tty_schedule_flip(tty); 2403 tty_schedule_flip(tty);
2400 } 2404 }
2401 } 2405 }
2406 tty_kref_put(tty);
2402 2407
2403 if (nt.data & DT_RXBUSY) { 2408 if (nt.data & DT_RXBUSY) {
2404 donerx++; 2409 donerx++;
@@ -2535,14 +2540,15 @@ static void stli_poll(unsigned long arg)
2535 * the slave. 2540 * the slave.
2536 */ 2541 */
2537 2542
2538static void stli_mkasyport(struct stliport *portp, asyport_t *pp, struct ktermios *tiosp) 2543static void stli_mkasyport(struct tty_struct *tty, struct stliport *portp,
2544 asyport_t *pp, struct ktermios *tiosp)
2539{ 2545{
2540 memset(pp, 0, sizeof(asyport_t)); 2546 memset(pp, 0, sizeof(asyport_t));
2541 2547
2542/* 2548/*
2543 * Start of by setting the baud, char size, parity and stop bit info. 2549 * Start of by setting the baud, char size, parity and stop bit info.
2544 */ 2550 */
2545 pp->baudout = tty_get_baud_rate(portp->port.tty); 2551 pp->baudout = tty_get_baud_rate(tty);
2546 if ((tiosp->c_cflag & CBAUD) == B38400) { 2552 if ((tiosp->c_cflag & CBAUD) == B38400) {
2547 if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 2553 if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
2548 pp->baudout = 57600; 2554 pp->baudout = 57600;
@@ -2695,7 +2701,7 @@ static int stli_initports(struct stlibrd *brdp)
2695 printk("STALLION: failed to allocate port structure\n"); 2701 printk("STALLION: failed to allocate port structure\n");
2696 continue; 2702 continue;
2697 } 2703 }
2698 2704 tty_port_init(&portp->port);
2699 portp->magic = STLI_PORTMAGIC; 2705 portp->magic = STLI_PORTMAGIC;
2700 portp->portnr = i; 2706 portp->portnr = i;
2701 portp->brdnr = brdp->brdnr; 2707 portp->brdnr = brdp->brdnr;
@@ -4220,7 +4226,7 @@ static struct stliport *stli_getport(unsigned int brdnr, unsigned int panelnr,
4220 * what port to get stats for (used through board control device). 4226 * what port to get stats for (used through board control device).
4221 */ 4227 */
4222 4228
4223static int stli_portcmdstats(struct stliport *portp) 4229static int stli_portcmdstats(struct tty_struct *tty, struct stliport *portp)
4224{ 4230{
4225 unsigned long flags; 4231 unsigned long flags;
4226 struct stlibrd *brdp; 4232 struct stlibrd *brdp;
@@ -4249,15 +4255,15 @@ static int stli_portcmdstats(struct stliport *portp)
4249 stli_comstats.flags = portp->port.flags; 4255 stli_comstats.flags = portp->port.flags;
4250 4256
4251 spin_lock_irqsave(&brd_lock, flags); 4257 spin_lock_irqsave(&brd_lock, flags);
4252 if (portp->port.tty != NULL) { 4258 if (tty != NULL) {
4253 if (portp->port.tty->driver_data == portp) { 4259 if (portp->port.tty == tty) {
4254 stli_comstats.ttystate = portp->port.tty->flags; 4260 stli_comstats.ttystate = tty->flags;
4255 stli_comstats.rxbuffered = -1; 4261 stli_comstats.rxbuffered = -1;
4256 if (portp->port.tty->termios != NULL) { 4262 if (tty->termios != NULL) {
4257 stli_comstats.cflags = portp->port.tty->termios->c_cflag; 4263 stli_comstats.cflags = tty->termios->c_cflag;
4258 stli_comstats.iflags = portp->port.tty->termios->c_iflag; 4264 stli_comstats.iflags = tty->termios->c_iflag;
4259 stli_comstats.oflags = portp->port.tty->termios->c_oflag; 4265 stli_comstats.oflags = tty->termios->c_oflag;
4260 stli_comstats.lflags = portp->port.tty->termios->c_lflag; 4266 stli_comstats.lflags = tty->termios->c_lflag;
4261 } 4267 }
4262 } 4268 }
4263 } 4269 }
@@ -4294,7 +4300,8 @@ static int stli_portcmdstats(struct stliport *portp)
4294 * what port to get stats for (used through board control device). 4300 * what port to get stats for (used through board control device).
4295 */ 4301 */
4296 4302
4297static int stli_getportstats(struct stliport *portp, comstats_t __user *cp) 4303static int stli_getportstats(struct tty_struct *tty, struct stliport *portp,
4304 comstats_t __user *cp)
4298{ 4305{
4299 struct stlibrd *brdp; 4306 struct stlibrd *brdp;
4300 int rc; 4307 int rc;
@@ -4312,7 +4319,7 @@ static int stli_getportstats(struct stliport *portp, comstats_t __user *cp)
4312 if (!brdp) 4319 if (!brdp)
4313 return -ENODEV; 4320 return -ENODEV;
4314 4321
4315 if ((rc = stli_portcmdstats(portp)) < 0) 4322 if ((rc = stli_portcmdstats(tty, portp)) < 0)
4316 return rc; 4323 return rc;
4317 4324
4318 return copy_to_user(cp, &stli_comstats, sizeof(comstats_t)) ? 4325 return copy_to_user(cp, &stli_comstats, sizeof(comstats_t)) ?
@@ -4427,7 +4434,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
4427 4434
4428 switch (cmd) { 4435 switch (cmd) {
4429 case COM_GETPORTSTATS: 4436 case COM_GETPORTSTATS:
4430 rc = stli_getportstats(NULL, argp); 4437 rc = stli_getportstats(NULL, NULL, argp);
4431 done++; 4438 done++;
4432 break; 4439 break;
4433 case COM_CLRPORTSTATS: 4440 case COM_CLRPORTSTATS: