aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-16 16:57:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:12:38 -0400
commit44b7d1b37f786c61d0e382b6f72f605f73de284b (patch)
tree2ac150e99311cde2e841bb6c80ac9d2800c8aff7
parent593573bc55c9e1999b9679da4e477c0220a6fbbd (diff)
tty: add more tty_port fields
Move more bits into the tty_port structure Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/cyclades.c28
-rw-r--r--drivers/char/isicom.c28
-rw-r--r--drivers/char/moxa.c8
-rw-r--r--drivers/char/mxser.c29
-rw-r--r--drivers/char/riscom8.c24
-rw-r--r--drivers/char/riscom8.h2
-rw-r--r--drivers/char/rocket.c23
-rw-r--r--drivers/char/rocket.h4
-rw-r--r--drivers/char/rocket_int.h2
-rw-r--r--drivers/char/specialix.c153
-rw-r--r--drivers/char/specialix_io8.h8
-rw-r--r--drivers/char/sx.c2
-rw-r--r--drivers/char/synclink.c16
-rw-r--r--drivers/char/synclink_gt.c16
-rw-r--r--drivers/char/synclinkmp.c14
-rw-r--r--drivers/char/tty_io.c2
-rw-r--r--include/linux/cyclades.h6
-rw-r--r--include/linux/tty.h2
18 files changed, 169 insertions, 198 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 0144b19d1036..e991dc85f2fb 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2677,8 +2677,8 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2677 */ 2677 */
2678 tty->closing = 1; 2678 tty->closing = 1;
2679 spin_unlock_irqrestore(&card->card_lock, flags); 2679 spin_unlock_irqrestore(&card->card_lock, flags);
2680 if (info->closing_wait != CY_CLOSING_WAIT_NONE) 2680 if (info->port.closing_wait != CY_CLOSING_WAIT_NONE)
2681 tty_wait_until_sent(tty, info->closing_wait); 2681 tty_wait_until_sent(tty, info->port.closing_wait);
2682 2682
2683 spin_lock_irqsave(&card->card_lock, flags); 2683 spin_lock_irqsave(&card->card_lock, flags);
2684 2684
@@ -2734,9 +2734,9 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2734 info->port.tty = NULL; 2734 info->port.tty = NULL;
2735 if (info->port.blocked_open) { 2735 if (info->port.blocked_open) {
2736 spin_unlock_irqrestore(&card->card_lock, flags); 2736 spin_unlock_irqrestore(&card->card_lock, flags);
2737 if (info->close_delay) { 2737 if (info->port.close_delay) {
2738 msleep_interruptible(jiffies_to_msecs 2738 msleep_interruptible(jiffies_to_msecs
2739 (info->close_delay)); 2739 (info->port.close_delay));
2740 } 2740 }
2741 wake_up_interruptible(&info->port.open_wait); 2741 wake_up_interruptible(&info->port.open_wait);
2742 spin_lock_irqsave(&card->card_lock, flags); 2742 spin_lock_irqsave(&card->card_lock, flags);
@@ -3382,8 +3382,8 @@ get_serial_info(struct cyclades_port *info,
3382 cinfo->first_line; 3382 cinfo->first_line;
3383 tmp.irq = cinfo->irq; 3383 tmp.irq = cinfo->irq;
3384 tmp.flags = info->port.flags; 3384 tmp.flags = info->port.flags;
3385 tmp.close_delay = info->close_delay; 3385 tmp.close_delay = info->port.close_delay;
3386 tmp.closing_wait = info->closing_wait; 3386 tmp.closing_wait = info->port.closing_wait;
3387 tmp.baud_base = info->baud; 3387 tmp.baud_base = info->baud;
3388 tmp.custom_divisor = info->custom_divisor; 3388 tmp.custom_divisor = info->custom_divisor;
3389 tmp.hub6 = 0; /*!!! */ 3389 tmp.hub6 = 0; /*!!! */
@@ -3402,7 +3402,7 @@ set_serial_info(struct cyclades_port *info,
3402 old_info = *info; 3402 old_info = *info;
3403 3403
3404 if (!capable(CAP_SYS_ADMIN)) { 3404 if (!capable(CAP_SYS_ADMIN)) {
3405 if (new_serial.close_delay != info->close_delay || 3405 if (new_serial.close_delay != info->port.close_delay ||
3406 new_serial.baud_base != info->baud || 3406 new_serial.baud_base != info->baud ||
3407 (new_serial.flags & ASYNC_FLAGS & 3407 (new_serial.flags & ASYNC_FLAGS &
3408 ~ASYNC_USR_MASK) != 3408 ~ASYNC_USR_MASK) !=
@@ -3424,8 +3424,8 @@ set_serial_info(struct cyclades_port *info,
3424 info->custom_divisor = new_serial.custom_divisor; 3424 info->custom_divisor = new_serial.custom_divisor;
3425 info->port.flags = (info->port.flags & ~ASYNC_FLAGS) | 3425 info->port.flags = (info->port.flags & ~ASYNC_FLAGS) |
3426 (new_serial.flags & ASYNC_FLAGS); 3426 (new_serial.flags & ASYNC_FLAGS);
3427 info->close_delay = new_serial.close_delay * HZ / 100; 3427 info->port.close_delay = new_serial.close_delay * HZ / 100;
3428 info->closing_wait = new_serial.closing_wait * HZ / 100; 3428 info->port.closing_wait = new_serial.closing_wait * HZ / 100;
3429 3429
3430check_and_exit: 3430check_and_exit:
3431 if (info->port.flags & ASYNC_INITIALIZED) { 3431 if (info->port.flags & ASYNC_INITIALIZED) {
@@ -3971,11 +3971,11 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
3971 break; 3971 break;
3972#endif /* CONFIG_CYZ_INTR */ 3972#endif /* CONFIG_CYZ_INTR */
3973 case CYSETWAIT: 3973 case CYSETWAIT:
3974 info->closing_wait = (unsigned short)arg * HZ / 100; 3974 info->port.closing_wait = (unsigned short)arg * HZ / 100;
3975 ret_val = 0; 3975 ret_val = 0;
3976 break; 3976 break;
3977 case CYGETWAIT: 3977 case CYGETWAIT:
3978 ret_val = info->closing_wait / (HZ / 100); 3978 ret_val = info->port.closing_wait / (HZ / 100);
3979 break; 3979 break;
3980 case TIOCGSERIAL: 3980 case TIOCGSERIAL:
3981 ret_val = get_serial_info(info, argp); 3981 ret_val = get_serial_info(info, argp);
@@ -4376,13 +4376,13 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4376 for (port = cinfo->first_line; port < cinfo->first_line + nports; 4376 for (port = cinfo->first_line; port < cinfo->first_line + nports;
4377 port++) { 4377 port++) {
4378 info = &cinfo->ports[port - cinfo->first_line]; 4378 info = &cinfo->ports[port - cinfo->first_line];
4379 tty_port_init(&info->port);
4379 info->magic = CYCLADES_MAGIC; 4380 info->magic = CYCLADES_MAGIC;
4380 info->card = cinfo; 4381 info->card = cinfo;
4381 info->line = port; 4382 info->line = port;
4382 info->closing_wait = CLOSING_WAIT_DELAY;
4383 info->close_delay = 5 * HZ / 10;
4384 4383
4385 tty_port_init(&info->port); 4384 info->port.closing_wait = CLOSING_WAIT_DELAY;
4385 info->port.close_delay = 5 * HZ / 10;
4386 info->port.flags = STD_COM_FLAGS; 4386 info->port.flags = STD_COM_FLAGS;
4387 init_completion(&info->shutdown_wait); 4387 init_completion(&info->shutdown_wait);
4388 init_waitqueue_head(&info->delta_msr_wait); 4388 init_waitqueue_head(&info->delta_msr_wait);
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 5a53c15b0dc2..d4281df10c22 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -199,10 +199,8 @@ struct isi_board {
199struct isi_port { 199struct isi_port {
200 unsigned short magic; 200 unsigned short magic;
201 struct tty_port port; 201 struct tty_port port;
202 int close_delay;
203 u16 channel; 202 u16 channel;
204 u16 status; 203 u16 status;
205 u16 closing_wait;
206 struct isi_board *card; 204 struct isi_board *card;
207 unsigned char *xmit_buf; 205 unsigned char *xmit_buf;
208 int xmit_head; 206 int xmit_head;
@@ -1051,8 +1049,8 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
1051 tty->closing = 1; 1049 tty->closing = 1;
1052 spin_unlock_irqrestore(&card->card_lock, flags); 1050 spin_unlock_irqrestore(&card->card_lock, flags);
1053 1051
1054 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) 1052 if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
1055 tty_wait_until_sent(tty, port->closing_wait); 1053 tty_wait_until_sent(tty, port->port.closing_wait);
1056 /* indicate to the card that no more data can be received 1054 /* indicate to the card that no more data can be received
1057 on this port */ 1055 on this port */
1058 spin_lock_irqsave(&card->card_lock, flags); 1056 spin_lock_irqsave(&card->card_lock, flags);
@@ -1071,10 +1069,10 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
1071 1069
1072 if (port->port.blocked_open) { 1070 if (port->port.blocked_open) {
1073 spin_unlock_irqrestore(&card->card_lock, flags); 1071 spin_unlock_irqrestore(&card->card_lock, flags);
1074 if (port->close_delay) { 1072 if (port->port.close_delay) {
1075 pr_dbg("scheduling until time out.\n"); 1073 pr_dbg("scheduling until time out.\n");
1076 msleep_interruptible( 1074 msleep_interruptible(
1077 jiffies_to_msecs(port->close_delay)); 1075 jiffies_to_msecs(port->port.close_delay));
1078 } 1076 }
1079 spin_lock_irqsave(&card->card_lock, flags); 1077 spin_lock_irqsave(&card->card_lock, flags);
1080 wake_up_interruptible(&port->port.open_wait); 1078 wake_up_interruptible(&port->port.open_wait);
@@ -1256,8 +1254,8 @@ static int isicom_set_serial_info(struct isi_port *port,
1256 (newinfo.flags & ASYNC_SPD_MASK)); 1254 (newinfo.flags & ASYNC_SPD_MASK));
1257 1255
1258 if (!capable(CAP_SYS_ADMIN)) { 1256 if (!capable(CAP_SYS_ADMIN)) {
1259 if ((newinfo.close_delay != port->close_delay) || 1257 if ((newinfo.close_delay != port->port.close_delay) ||
1260 (newinfo.closing_wait != port->closing_wait) || 1258 (newinfo.closing_wait != port->port.closing_wait) ||
1261 ((newinfo.flags & ~ASYNC_USR_MASK) != 1259 ((newinfo.flags & ~ASYNC_USR_MASK) !=
1262 (port->port.flags & ~ASYNC_USR_MASK))) { 1260 (port->port.flags & ~ASYNC_USR_MASK))) {
1263 unlock_kernel(); 1261 unlock_kernel();
@@ -1266,8 +1264,8 @@ static int isicom_set_serial_info(struct isi_port *port,
1266 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | 1264 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
1267 (newinfo.flags & ASYNC_USR_MASK)); 1265 (newinfo.flags & ASYNC_USR_MASK));
1268 } else { 1266 } else {
1269 port->close_delay = newinfo.close_delay; 1267 port->port.close_delay = newinfo.close_delay;
1270 port->closing_wait = newinfo.closing_wait; 1268 port->port.closing_wait = newinfo.closing_wait;
1271 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) | 1269 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
1272 (newinfo.flags & ASYNC_FLAGS)); 1270 (newinfo.flags & ASYNC_FLAGS));
1273 } 1271 }
@@ -1294,8 +1292,8 @@ static int isicom_get_serial_info(struct isi_port *port,
1294 out_info.irq = port->card->irq; 1292 out_info.irq = port->card->irq;
1295 out_info.flags = port->port.flags; 1293 out_info.flags = port->port.flags;
1296/* out_info.baud_base = ? */ 1294/* out_info.baud_base = ? */
1297 out_info.close_delay = port->close_delay; 1295 out_info.close_delay = port->port.close_delay;
1298 out_info.closing_wait = port->closing_wait; 1296 out_info.closing_wait = port->port.closing_wait;
1299 unlock_kernel(); 1297 unlock_kernel();
1300 if (copy_to_user(info, &out_info, sizeof(out_info))) 1298 if (copy_to_user(info, &out_info, sizeof(out_info)))
1301 return -EFAULT; 1299 return -EFAULT;
@@ -1804,13 +1802,13 @@ static int __init isicom_init(void)
1804 isi_card[idx].ports = port; 1802 isi_card[idx].ports = port;
1805 spin_lock_init(&isi_card[idx].card_lock); 1803 spin_lock_init(&isi_card[idx].card_lock);
1806 for (channel = 0; channel < 16; channel++, port++) { 1804 for (channel = 0; channel < 16; channel++, port++) {
1805 tty_port_init(&port->port);
1807 port->magic = ISICOM_MAGIC; 1806 port->magic = ISICOM_MAGIC;
1808 port->card = &isi_card[idx]; 1807 port->card = &isi_card[idx];
1809 port->channel = channel; 1808 port->channel = channel;
1810 port->close_delay = 50 * HZ/100; 1809 port->port.close_delay = 50 * HZ/100;
1811 port->closing_wait = 3000 * HZ/100; 1810 port->port.closing_wait = 3000 * HZ/100;
1812 port->status = 0; 1811 port->status = 0;
1813 tty_port_init(&port->port);
1814 /* . . . */ 1812 /* . . . */
1815 } 1813 }
1816 isi_card[idx].base = 0; 1814 isi_card[idx].base = 0;
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index dd10f143d96f..2bba250ffc8e 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -135,7 +135,6 @@ struct moxa_port {
135 void __iomem *tableAddr; 135 void __iomem *tableAddr;
136 136
137 int type; 137 int type;
138 int close_delay;
139 int cflag; 138 int cflag;
140 unsigned long statusflags; 139 unsigned long statusflags;
141 140
@@ -822,10 +821,9 @@ static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev)
822 } 821 }
823 822
824 for (i = 0, p = brd->ports; i < MAX_PORTS_PER_BOARD; i++, p++) { 823 for (i = 0, p = brd->ports; i < MAX_PORTS_PER_BOARD; i++, p++) {
824 tty_port_init(&p->port);
825 p->type = PORT_16550A; 825 p->type = PORT_16550A;
826 p->close_delay = 5 * HZ / 10;
827 p->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; 826 p->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL;
828 tty_port_init(&p->port);
829 } 827 }
830 828
831 switch (brd->boardType) { 829 switch (brd->boardType) {
@@ -2124,7 +2122,7 @@ static int moxa_get_serial_info(struct moxa_port *info,
2124 .line = info->port.tty->index, 2122 .line = info->port.tty->index,
2125 .flags = info->port.flags, 2123 .flags = info->port.flags,
2126 .baud_base = 921600, 2124 .baud_base = 921600,
2127 .close_delay = info->close_delay 2125 .close_delay = info->port.close_delay
2128 }; 2126 };
2129 return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0; 2127 return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0;
2130} 2128}
@@ -2148,7 +2146,7 @@ static int moxa_set_serial_info(struct moxa_port *info,
2148 (info->port.flags & ~ASYNC_USR_MASK))) 2146 (info->port.flags & ~ASYNC_USR_MASK)))
2149 return -EPERM; 2147 return -EPERM;
2150 } else 2148 } else
2151 info->close_delay = new_serial.close_delay * HZ / 100; 2149 info->port.close_delay = new_serial.close_delay * HZ / 100;
2152 2150
2153 new_serial.flags = (new_serial.flags & ~ASYNC_FLAGS); 2151 new_serial.flags = (new_serial.flags & ~ASYNC_FLAGS);
2154 new_serial.flags |= (info->port.flags & ASYNC_FLAGS); 2152 new_serial.flags |= (info->port.flags & ASYNC_FLAGS);
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index e83ccee03161..6307e301bd26 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -243,10 +243,7 @@ struct mxser_port {
243 unsigned char ldisc_stop_rx; 243 unsigned char ldisc_stop_rx;
244 244
245 int custom_divisor; 245 int custom_divisor;
246 int close_delay;
247 unsigned short closing_wait;
248 unsigned char err_shadow; 246 unsigned char err_shadow;
249 unsigned long event;
250 247
251 struct async_icount icount; /* kernel counters for 4 input interrupts */ 248 struct async_icount icount; /* kernel counters for 4 input interrupts */
252 int timeout; 249 int timeout;
@@ -1199,8 +1196,8 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1199 * the line discipline to only process XON/XOFF characters. 1196 * the line discipline to only process XON/XOFF characters.
1200 */ 1197 */
1201 tty->closing = 1; 1198 tty->closing = 1;
1202 if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) 1199 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
1203 tty_wait_until_sent(tty, info->closing_wait); 1200 tty_wait_until_sent(tty, info->port.closing_wait);
1204 /* 1201 /*
1205 * At this point we stop accepting input. To do this, we 1202 * At this point we stop accepting input. To do this, we
1206 * disable the receive line status interrupts, and tell the 1203 * disable the receive line status interrupts, and tell the
@@ -1231,11 +1228,10 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1231 tty_ldisc_flush(tty); 1228 tty_ldisc_flush(tty);
1232 1229
1233 tty->closing = 0; 1230 tty->closing = 0;
1234 info->event = 0;
1235 info->port.tty = NULL; 1231 info->port.tty = NULL;
1236 if (info->port.blocked_open) { 1232 if (info->port.blocked_open) {
1237 if (info->close_delay) 1233 if (info->port.close_delay)
1238 schedule_timeout_interruptible(info->close_delay); 1234 schedule_timeout_interruptible(info->port.close_delay);
1239 wake_up_interruptible(&info->port.open_wait); 1235 wake_up_interruptible(&info->port.open_wait);
1240 } 1236 }
1241 1237
@@ -1370,8 +1366,8 @@ static int mxser_get_serial_info(struct mxser_port *info,
1370 .irq = info->board->irq, 1366 .irq = info->board->irq,
1371 .flags = info->port.flags, 1367 .flags = info->port.flags,
1372 .baud_base = info->baud_base, 1368 .baud_base = info->baud_base,
1373 .close_delay = info->close_delay, 1369 .close_delay = info->port.close_delay,
1374 .closing_wait = info->closing_wait, 1370 .closing_wait = info->port.closing_wait,
1375 .custom_divisor = info->custom_divisor, 1371 .custom_divisor = info->custom_divisor,
1376 .hub6 = 0 1372 .hub6 = 0
1377 }; 1373 };
@@ -1402,7 +1398,7 @@ static int mxser_set_serial_info(struct mxser_port *info,
1402 1398
1403 if (!capable(CAP_SYS_ADMIN)) { 1399 if (!capable(CAP_SYS_ADMIN)) {
1404 if ((new_serial.baud_base != info->baud_base) || 1400 if ((new_serial.baud_base != info->baud_base) ||
1405 (new_serial.close_delay != info->close_delay) || 1401 (new_serial.close_delay != info->port.close_delay) ||
1406 ((new_serial.flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK))) 1402 ((new_serial.flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK)))
1407 return -EPERM; 1403 return -EPERM;
1408 info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) | 1404 info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |
@@ -1414,8 +1410,8 @@ static int mxser_set_serial_info(struct mxser_port *info,
1414 */ 1410 */
1415 info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) | 1411 info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |
1416 (new_serial.flags & ASYNC_FLAGS)); 1412 (new_serial.flags & ASYNC_FLAGS));
1417 info->close_delay = new_serial.close_delay * HZ / 100; 1413 info->port.close_delay = new_serial.close_delay * HZ / 100;
1418 info->closing_wait = new_serial.closing_wait * HZ / 100; 1414 info->port.closing_wait = new_serial.closing_wait * HZ / 100;
1419 info->port.tty->low_latency = 1415 info->port.tty->low_latency =
1420 (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1416 (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1421 info->port.tty->low_latency = 0; 1417 info->port.tty->low_latency = 0;
@@ -2214,7 +2210,6 @@ static void mxser_hangup(struct tty_struct *tty)
2214 2210
2215 mxser_flush_buffer(tty); 2211 mxser_flush_buffer(tty);
2216 mxser_shutdown(info); 2212 mxser_shutdown(info);
2217 info->event = 0;
2218 info->port.count = 0; 2213 info->port.count = 0;
2219 info->port.flags &= ~ASYNC_NORMAL_ACTIVE; 2214 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
2220 info->port.tty = NULL; 2215 info->port.tty = NULL;
@@ -2545,6 +2540,7 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
2545 2540
2546 for (i = 0; i < brd->info->nports; i++) { 2541 for (i = 0; i < brd->info->nports; i++) {
2547 info = &brd->ports[i]; 2542 info = &brd->ports[i];
2543 tty_port_init(&info->port);
2548 info->board = brd; 2544 info->board = brd;
2549 info->stop_rx = 0; 2545 info->stop_rx = 0;
2550 info->ldisc_stop_rx = 0; 2546 info->ldisc_stop_rx = 0;
@@ -2559,10 +2555,9 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
2559 process_txrx_fifo(info); 2555 process_txrx_fifo(info);
2560 2556
2561 info->custom_divisor = info->baud_base * 16; 2557 info->custom_divisor = info->baud_base * 16;
2562 info->close_delay = 5 * HZ / 10; 2558 info->port.close_delay = 5 * HZ / 10;
2563 info->closing_wait = 30 * HZ; 2559 info->port.closing_wait = 30 * HZ;
2564 info->normal_termios = mxvar_sdriver->init_termios; 2560 info->normal_termios = mxvar_sdriver->init_termios;
2565 tty_port_init(&info->port);
2566 init_waitqueue_head(&info->delta_msr_wait); 2561 init_waitqueue_head(&info->delta_msr_wait);
2567 memset(&info->mon_data, 0, sizeof(struct mxser_mon)); 2562 memset(&info->mon_data, 0, sizeof(struct mxser_mon));
2568 info->err_shadow = 0; 2563 info->err_shadow = 0;
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index 3ca8957ba327..724b2b20f4b2 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -1032,8 +1032,8 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
1032 * the line discipline to only process XON/XOFF characters. 1032 * the line discipline to only process XON/XOFF characters.
1033 */ 1033 */
1034 tty->closing = 1; 1034 tty->closing = 1;
1035 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) 1035 if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
1036 tty_wait_until_sent(tty, port->closing_wait); 1036 tty_wait_until_sent(tty, port->port.closing_wait);
1037 /* 1037 /*
1038 * At this point we stop accepting input. To do this, we 1038 * At this point we stop accepting input. To do this, we
1039 * disable the receive line status interrupts, and tell the 1039 * disable the receive line status interrupts, and tell the
@@ -1065,8 +1065,8 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
1065 tty->closing = 0; 1065 tty->closing = 0;
1066 port->port.tty = NULL; 1066 port->port.tty = NULL;
1067 if (port->port.blocked_open) { 1067 if (port->port.blocked_open) {
1068 if (port->close_delay) 1068 if (port->port.close_delay)
1069 msleep_interruptible(jiffies_to_msecs(port->close_delay)); 1069 msleep_interruptible(jiffies_to_msecs(port->port.close_delay));
1070 wake_up_interruptible(&port->port.open_wait); 1070 wake_up_interruptible(&port->port.open_wait);
1071 } 1071 }
1072 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1072 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
@@ -1295,8 +1295,8 @@ static int rc_set_serial_info(struct riscom_port *port,
1295 (tmp.flags & ASYNC_SPD_MASK)); 1295 (tmp.flags & ASYNC_SPD_MASK));
1296 1296
1297 if (!capable(CAP_SYS_ADMIN)) { 1297 if (!capable(CAP_SYS_ADMIN)) {
1298 if ((tmp.close_delay != port->close_delay) || 1298 if ((tmp.close_delay != port->port.close_delay) ||
1299 (tmp.closing_wait != port->closing_wait) || 1299 (tmp.closing_wait != port->port.closing_wait) ||
1300 ((tmp.flags & ~ASYNC_USR_MASK) != 1300 ((tmp.flags & ~ASYNC_USR_MASK) !=
1301 (port->port.flags & ~ASYNC_USR_MASK))) 1301 (port->port.flags & ~ASYNC_USR_MASK)))
1302 return -EPERM; 1302 return -EPERM;
@@ -1305,8 +1305,8 @@ static int rc_set_serial_info(struct riscom_port *port,
1305 } else { 1305 } else {
1306 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) | 1306 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
1307 (tmp.flags & ASYNC_FLAGS)); 1307 (tmp.flags & ASYNC_FLAGS));
1308 port->close_delay = tmp.close_delay; 1308 port->port.close_delay = tmp.close_delay;
1309 port->closing_wait = tmp.closing_wait; 1309 port->port.closing_wait = tmp.closing_wait;
1310 } 1310 }
1311 if (change_speed) { 1311 if (change_speed) {
1312 unsigned long flags; 1312 unsigned long flags;
@@ -1331,8 +1331,8 @@ static int rc_get_serial_info(struct riscom_port *port,
1331 tmp.irq = bp->irq; 1331 tmp.irq = bp->irq;
1332 tmp.flags = port->port.flags; 1332 tmp.flags = port->port.flags;
1333 tmp.baud_base = (RC_OSCFREQ + CD180_TPC/2) / CD180_TPC; 1333 tmp.baud_base = (RC_OSCFREQ + CD180_TPC/2) / CD180_TPC;
1334 tmp.close_delay = port->close_delay * HZ/100; 1334 tmp.close_delay = port->port.close_delay * HZ/100;
1335 tmp.closing_wait = port->closing_wait * HZ/100; 1335 tmp.closing_wait = port->port.closing_wait * HZ/100;
1336 tmp.xmit_fifo_size = CD180_NFIFO; 1336 tmp.xmit_fifo_size = CD180_NFIFO;
1337 return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0; 1337 return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0;
1338} 1338}
@@ -1549,10 +1549,8 @@ static int __init rc_init_drivers(void)
1549 } 1549 }
1550 memset(rc_port, 0, sizeof(rc_port)); 1550 memset(rc_port, 0, sizeof(rc_port));
1551 for (i = 0; i < RC_NPORT * RC_NBOARD; i++) { 1551 for (i = 0; i < RC_NPORT * RC_NBOARD; i++) {
1552 rc_port[i].magic = RISCOM8_MAGIC;
1553 rc_port[i].close_delay = 50 * HZ / 100;
1554 rc_port[i].closing_wait = 3000 * HZ / 100;
1555 tty_port_init(&rc_port[i].port); 1552 tty_port_init(&rc_port[i].port);
1553 rc_port[i].magic = RISCOM8_MAGIC;
1556 } 1554 }
1557 return 0; 1555 return 0;
1558} 1556}
diff --git a/drivers/char/riscom8.h b/drivers/char/riscom8.h
index 29ddbab78801..c9876b3f9714 100644
--- a/drivers/char/riscom8.h
+++ b/drivers/char/riscom8.h
@@ -69,14 +69,12 @@ struct riscom_port {
69 struct tty_port port; 69 struct tty_port port;
70 int baud_base; 70 int baud_base;
71 int timeout; 71 int timeout;
72 int close_delay;
73 int custom_divisor; 72 int custom_divisor;
74 int xmit_head; 73 int xmit_head;
75 int xmit_tail; 74 int xmit_tail;
76 int xmit_cnt; 75 int xmit_cnt;
77 short wakeup_chars; 76 short wakeup_chars;
78 short break_length; 77 short break_length;
79 unsigned short closing_wait;
80 unsigned char mark_mask; 78 unsigned char mark_mask;
81 unsigned char IER; 79 unsigned char IER;
82 unsigned char MSVR; 80 unsigned char MSVR;
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index bc35b900f9c6..e670eae2f510 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>
@@ -648,8 +649,8 @@ 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->port.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;
@@ -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
@@ -1168,8 +1169,8 @@ static void rp_close(struct tty_struct *tty, struct file *filp)
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->port.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->port.open_wait); 1175 wake_up_interruptible(&info->port.open_wait);
1175 } else { 1176 } else {
@@ -1327,8 +1328,8 @@ static int get_config(struct r_port *info, struct rocket_config __user *retinfo)
1327 memset(&tmp, 0, sizeof (tmp)); 1328 memset(&tmp, 0, sizeof (tmp));
1328 tmp.line = info->line; 1329 tmp.line = info->line;
1329 tmp.flags = info->flags; 1330 tmp.flags = info->flags;
1330 tmp.close_delay = info->close_delay; 1331 tmp.close_delay = info->port.close_delay;
1331 tmp.closing_wait = info->closing_wait; 1332 tmp.closing_wait = info->port.closing_wait;
1332 tmp.port = rcktpt_io_addr[(info->line >> 5) & 3]; 1333 tmp.port = rcktpt_io_addr[(info->line >> 5) & 3];
1333 1334
1334 if (copy_to_user(retinfo, &tmp, sizeof (*retinfo))) 1335 if (copy_to_user(retinfo, &tmp, sizeof (*retinfo)))
@@ -1353,8 +1354,8 @@ static int set_config(struct r_port *info, struct rocket_config __user *new_info
1353 } 1354 }
1354 1355
1355 info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS)); 1356 info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS));
1356 info->close_delay = new_serial.close_delay; 1357 info->port.close_delay = new_serial.close_delay;
1357 info->closing_wait = new_serial.closing_wait; 1358 info->port.closing_wait = new_serial.closing_wait;
1358 1359
1359 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) 1360 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI)
1360 info->port.tty->alt_speed = 57600; 1361 info->port.tty->alt_speed = 57600;
diff --git a/drivers/char/rocket.h b/drivers/char/rocket.h
index ae6b04f90c03..a8b09195ebba 100644
--- a/drivers/char/rocket.h
+++ b/drivers/char/rocket.h
@@ -64,8 +64,8 @@ struct rocket_version {
64/* 64/*
65 * For closing_wait and closing_wait2 65 * For closing_wait and closing_wait2
66 */ 66 */
67#define ROCKET_CLOSING_WAIT_NONE 65535 67#define ROCKET_CLOSING_WAIT_NONE ASYNC_CLOSING_WAIT_NONE
68#define ROCKET_CLOSING_WAIT_INF 0 68#define ROCKET_CLOSING_WAIT_INF ASYNC_CLOSING_WAIT_INF
69 69
70/* 70/*
71 * Rocketport ioctls -- "RP" 71 * Rocketport ioctls -- "RP"
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h
index 3affc48f6a57..21f3ff53ba32 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/char/rocket_int.h
@@ -1133,8 +1133,6 @@ struct r_port {
1133 unsigned int chan:3; 1133 unsigned int chan:3;
1134 CONTROLLER_t *ctlp; 1134 CONTROLLER_t *ctlp;
1135 CHANNEL_t channel; 1135 CHANNEL_t channel;
1136 int closing_wait;
1137 int close_delay;
1138 int intmask; 1136 int intmask;
1139 int xmit_fifo_room; /* room in xmit fifo */ 1137 int xmit_fifo_room; /* room in xmit fifo */
1140 unsigned char *xmit_buf; 1138 unsigned char *xmit_buf;
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index 2ee4d9893757..037dc47e4cb1 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -608,9 +608,9 @@ static inline struct specialix_port * sx_get_port(struct specialix_board * bp,
608 dprintk (SX_DEBUG_CHAN, "channel: %d\n", channel); 608 dprintk (SX_DEBUG_CHAN, "channel: %d\n", channel);
609 if (channel < CD186x_NCH) { 609 if (channel < CD186x_NCH) {
610 port = &sx_port[board_No(bp) * SX_NPORT + channel]; 610 port = &sx_port[board_No(bp) * SX_NPORT + channel];
611 dprintk (SX_DEBUG_CHAN, "port: %d %p flags: 0x%x\n",board_No(bp) * SX_NPORT + channel, port, port->flags & ASYNC_INITIALIZED); 611 dprintk (SX_DEBUG_CHAN, "port: %d %p flags: 0x%lx\n",board_No(bp) * SX_NPORT + channel, port, port->port.flags & ASYNC_INITIALIZED);
612 612
613 if (port->flags & ASYNC_INITIALIZED) { 613 if (port->port.flags & ASYNC_INITIALIZED) {
614 dprintk (SX_DEBUG_CHAN, "port: %d %p\n", channel, port); 614 dprintk (SX_DEBUG_CHAN, "port: %d %p\n", channel, port);
615 func_exit(); 615 func_exit();
616 return port; 616 return port;
@@ -637,7 +637,7 @@ static inline void sx_receive_exc(struct specialix_board * bp)
637 func_exit(); 637 func_exit();
638 return; 638 return;
639 } 639 }
640 tty = port->tty; 640 tty = port->port.tty;
641 641
642 status = sx_in(bp, CD186x_RCSR); 642 status = sx_in(bp, CD186x_RCSR);
643 643
@@ -673,7 +673,7 @@ static inline void sx_receive_exc(struct specialix_board * bp)
673 dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", 673 dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n",
674 board_No(bp), port_No(port)); 674 board_No(bp), port_No(port));
675 flag = TTY_BREAK; 675 flag = TTY_BREAK;
676 if (port->flags & ASYNC_SAK) 676 if (port->port.flags & ASYNC_SAK)
677 do_SAK(tty); 677 do_SAK(tty);
678 678
679 } else if (status & RCSR_PE) 679 } else if (status & RCSR_PE)
@@ -707,7 +707,7 @@ static inline void sx_receive(struct specialix_board * bp)
707 func_exit(); 707 func_exit();
708 return; 708 return;
709 } 709 }
710 tty = port->tty; 710 tty = port->port.tty;
711 711
712 count = sx_in(bp, CD186x_RDCR); 712 count = sx_in(bp, CD186x_RDCR);
713 dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); 713 dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count);
@@ -734,7 +734,7 @@ static inline void sx_transmit(struct specialix_board * bp)
734 return; 734 return;
735 } 735 }
736 dprintk (SX_DEBUG_TX, "port: %p\n", port); 736 dprintk (SX_DEBUG_TX, "port: %p\n", port);
737 tty = port->tty; 737 tty = port->port.tty;
738 738
739 if (port->IER & IER_TXEMPTY) { 739 if (port->IER & IER_TXEMPTY) {
740 /* FIFO drained */ 740 /* FIFO drained */
@@ -811,7 +811,7 @@ static inline void sx_check_modem(struct specialix_board * bp)
811 if (!(port = sx_get_port(bp, "Modem"))) 811 if (!(port = sx_get_port(bp, "Modem")))
812 return; 812 return;
813 813
814 tty = port->tty; 814 tty = port->port.tty;
815 815
816 mcr = sx_in(bp, CD186x_MCR); 816 mcr = sx_in(bp, CD186x_MCR);
817 printk ("mcr = %02x.\n", mcr); 817 printk ("mcr = %02x.\n", mcr);
@@ -821,7 +821,7 @@ static inline void sx_check_modem(struct specialix_board * bp)
821 msvr_cd = sx_in(bp, CD186x_MSVR) & MSVR_CD; 821 msvr_cd = sx_in(bp, CD186x_MSVR) & MSVR_CD;
822 if (msvr_cd) { 822 if (msvr_cd) {
823 dprintk (SX_DEBUG_SIGNALS, "Waking up guys in open.\n"); 823 dprintk (SX_DEBUG_SIGNALS, "Waking up guys in open.\n");
824 wake_up_interruptible(&port->open_wait); 824 wake_up_interruptible(&port->port.open_wait);
825 } else { 825 } else {
826 dprintk (SX_DEBUG_SIGNALS, "Sending HUP.\n"); 826 dprintk (SX_DEBUG_SIGNALS, "Sending HUP.\n");
827 tty_hangup(tty); 827 tty_hangup(tty);
@@ -1030,7 +1030,7 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
1030 1030
1031 func_enter(); 1031 func_enter();
1032 1032
1033 if (!(tty = port->tty) || !tty->termios) { 1033 if (!(tty = port->port.tty) || !tty->termios) {
1034 func_exit(); 1034 func_exit();
1035 return; 1035 return;
1036 } 1036 }
@@ -1052,9 +1052,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
1052 baud = tty_get_baud_rate(tty); 1052 baud = tty_get_baud_rate(tty);
1053 1053
1054 if (baud == 38400) { 1054 if (baud == 38400) {
1055 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 1055 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1056 baud = 57600; 1056 baud = 57600;
1057 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 1057 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1058 baud = 115200; 1058 baud = 115200;
1059 } 1059 }
1060 1060
@@ -1244,7 +1244,7 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port
1244 1244
1245 func_enter(); 1245 func_enter();
1246 1246
1247 if (port->flags & ASYNC_INITIALIZED) { 1247 if (port->port.flags & ASYNC_INITIALIZED) {
1248 func_exit(); 1248 func_exit();
1249 return 0; 1249 return 0;
1250 } 1250 }
@@ -1268,12 +1268,12 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port
1268 1268
1269 spin_lock_irqsave(&port->lock, flags); 1269 spin_lock_irqsave(&port->lock, flags);
1270 1270
1271 if (port->tty) 1271 if (port->port.tty)
1272 clear_bit(TTY_IO_ERROR, &port->tty->flags); 1272 clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
1273 1273
1274 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 1274 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
1275 sx_change_speed(bp, port); 1275 sx_change_speed(bp, port);
1276 port->flags |= ASYNC_INITIALIZED; 1276 port->port.flags |= ASYNC_INITIALIZED;
1277 1277
1278 spin_unlock_irqrestore(&port->lock, flags); 1278 spin_unlock_irqrestore(&port->lock, flags);
1279 1279
@@ -1292,7 +1292,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port *
1292 1292
1293 func_enter(); 1293 func_enter();
1294 1294
1295 if (!(port->flags & ASYNC_INITIALIZED)) { 1295 if (!(port->port.flags & ASYNC_INITIALIZED)) {
1296 func_exit(); 1296 func_exit();
1297 return; 1297 return;
1298 } 1298 }
@@ -1315,7 +1315,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port *
1315 spin_lock_irqsave(&bp->lock, flags); 1315 spin_lock_irqsave(&bp->lock, flags);
1316 sx_out(bp, CD186x_CAR, port_No(port)); 1316 sx_out(bp, CD186x_CAR, port_No(port));
1317 1317
1318 if (!(tty = port->tty) || C_HUPCL(tty)) { 1318 if (!(tty = port->port.tty) || C_HUPCL(tty)) {
1319 /* Drop DTR */ 1319 /* Drop DTR */
1320 sx_out(bp, CD186x_MSVDTR, 0); 1320 sx_out(bp, CD186x_MSVDTR, 0);
1321 } 1321 }
@@ -1330,7 +1330,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port *
1330 spin_unlock_irqrestore(&bp->lock, flags); 1330 spin_unlock_irqrestore(&bp->lock, flags);
1331 if (tty) 1331 if (tty)
1332 set_bit(TTY_IO_ERROR, &tty->flags); 1332 set_bit(TTY_IO_ERROR, &tty->flags);
1333 port->flags &= ~ASYNC_INITIALIZED; 1333 port->port.flags &= ~ASYNC_INITIALIZED;
1334 1334
1335 if (!bp->count) 1335 if (!bp->count)
1336 sx_shutdown_board(bp); 1336 sx_shutdown_board(bp);
@@ -1354,9 +1354,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1354 * If the device is in the middle of being closed, then block 1354 * If the device is in the middle of being closed, then block
1355 * until it's done, and then try again. 1355 * until it's done, and then try again.
1356 */ 1356 */
1357 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { 1357 if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) {
1358 interruptible_sleep_on(&port->close_wait); 1358 interruptible_sleep_on(&port->port.close_wait);
1359 if (port->flags & ASYNC_HUP_NOTIFY) { 1359 if (port->port.flags & ASYNC_HUP_NOTIFY) {
1360 func_exit(); 1360 func_exit();
1361 return -EAGAIN; 1361 return -EAGAIN;
1362 } else { 1362 } else {
@@ -1371,7 +1371,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1371 */ 1371 */
1372 if ((filp->f_flags & O_NONBLOCK) || 1372 if ((filp->f_flags & O_NONBLOCK) ||
1373 (tty->flags & (1 << TTY_IO_ERROR))) { 1373 (tty->flags & (1 << TTY_IO_ERROR))) {
1374 port->flags |= ASYNC_NORMAL_ACTIVE; 1374 port->port.flags |= ASYNC_NORMAL_ACTIVE;
1375 func_exit(); 1375 func_exit();
1376 return 0; 1376 return 0;
1377 } 1377 }
@@ -1387,13 +1387,13 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1387 * exit, either normal or abnormal. 1387 * exit, either normal or abnormal.
1388 */ 1388 */
1389 retval = 0; 1389 retval = 0;
1390 add_wait_queue(&port->open_wait, &wait); 1390 add_wait_queue(&port->port.open_wait, &wait);
1391 spin_lock_irqsave(&port->lock, flags); 1391 spin_lock_irqsave(&port->lock, flags);
1392 if (!tty_hung_up_p(filp)) { 1392 if (!tty_hung_up_p(filp)) {
1393 port->count--; 1393 port->port.count--;
1394 } 1394 }
1395 spin_unlock_irqrestore(&port->lock, flags); 1395 spin_unlock_irqrestore(&port->lock, flags);
1396 port->blocked_open++; 1396 port->port.blocked_open++;
1397 while (1) { 1397 while (1) {
1398 spin_lock_irqsave(&bp->lock, flags); 1398 spin_lock_irqsave(&bp->lock, flags);
1399 sx_out(bp, CD186x_CAR, port_No(port)); 1399 sx_out(bp, CD186x_CAR, port_No(port));
@@ -1410,14 +1410,14 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1410 spin_unlock_irqrestore(&bp->lock, flags); 1410 spin_unlock_irqrestore(&bp->lock, flags);
1411 set_current_state(TASK_INTERRUPTIBLE); 1411 set_current_state(TASK_INTERRUPTIBLE);
1412 if (tty_hung_up_p(filp) || 1412 if (tty_hung_up_p(filp) ||
1413 !(port->flags & ASYNC_INITIALIZED)) { 1413 !(port->port.flags & ASYNC_INITIALIZED)) {
1414 if (port->flags & ASYNC_HUP_NOTIFY) 1414 if (port->port.flags & ASYNC_HUP_NOTIFY)
1415 retval = -EAGAIN; 1415 retval = -EAGAIN;
1416 else 1416 else
1417 retval = -ERESTARTSYS; 1417 retval = -ERESTARTSYS;
1418 break; 1418 break;
1419 } 1419 }
1420 if (!(port->flags & ASYNC_CLOSING) && 1420 if (!(port->port.flags & ASYNC_CLOSING) &&
1421 (do_clocal || CD)) 1421 (do_clocal || CD))
1422 break; 1422 break;
1423 if (signal_pending(current)) { 1423 if (signal_pending(current)) {
@@ -1428,19 +1428,19 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1428 } 1428 }
1429 1429
1430 set_current_state(TASK_RUNNING); 1430 set_current_state(TASK_RUNNING);
1431 remove_wait_queue(&port->open_wait, &wait); 1431 remove_wait_queue(&port->port.open_wait, &wait);
1432 spin_lock_irqsave(&port->lock, flags); 1432 spin_lock_irqsave(&port->lock, flags);
1433 if (!tty_hung_up_p(filp)) { 1433 if (!tty_hung_up_p(filp)) {
1434 port->count++; 1434 port->port.count++;
1435 } 1435 }
1436 port->blocked_open--; 1436 port->port.blocked_open--;
1437 spin_unlock_irqrestore(&port->lock, flags); 1437 spin_unlock_irqrestore(&port->lock, flags);
1438 if (retval) { 1438 if (retval) {
1439 func_exit(); 1439 func_exit();
1440 return retval; 1440 return retval;
1441 } 1441 }
1442 1442
1443 port->flags |= ASYNC_NORMAL_ACTIVE; 1443 port->port.flags |= ASYNC_NORMAL_ACTIVE;
1444 func_exit(); 1444 func_exit();
1445 return 0; 1445 return 0;
1446} 1446}
@@ -1484,10 +1484,10 @@ static int sx_open(struct tty_struct * tty, struct file * filp)
1484 } 1484 }
1485 1485
1486 spin_lock_irqsave(&bp->lock, flags); 1486 spin_lock_irqsave(&bp->lock, flags);
1487 port->count++; 1487 port->port.count++;
1488 bp->count++; 1488 bp->count++;
1489 tty->driver_data = port; 1489 tty->driver_data = port;
1490 port->tty = tty; 1490 port->port.tty = tty;
1491 spin_unlock_irqrestore(&bp->lock, flags); 1491 spin_unlock_irqrestore(&bp->lock, flags);
1492 1492
1493 if ((error = sx_setup_port(bp, port))) { 1493 if ((error = sx_setup_port(bp, port))) {
@@ -1547,15 +1547,15 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1547 } 1547 }
1548 1548
1549 bp = port_Board(port); 1549 bp = port_Board(port);
1550 if ((tty->count == 1) && (port->count != 1)) { 1550 if ((tty->count == 1) && (port->port.count != 1)) {
1551 printk(KERN_ERR "sx%d: sx_close: bad port count;" 1551 printk(KERN_ERR "sx%d: sx_close: bad port count;"
1552 " tty->count is 1, port count is %d\n", 1552 " tty->count is 1, port count is %d\n",
1553 board_No(bp), port->count); 1553 board_No(bp), port->port.count);
1554 port->count = 1; 1554 port->port.count = 1;
1555 } 1555 }
1556 1556
1557 if (port->count > 1) { 1557 if (port->port.count > 1) {
1558 port->count--; 1558 port->port.count--;
1559 bp->count--; 1559 bp->count--;
1560 1560
1561 spin_unlock_irqrestore(&port->lock, flags); 1561 spin_unlock_irqrestore(&port->lock, flags);
@@ -1563,7 +1563,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1563 func_exit(); 1563 func_exit();
1564 return; 1564 return;
1565 } 1565 }
1566 port->flags |= ASYNC_CLOSING; 1566 port->port.flags |= ASYNC_CLOSING;
1567 /* 1567 /*
1568 * Now we wait for the transmit buffer to clear; and we notify 1568 * Now we wait for the transmit buffer to clear; and we notify
1569 * the line discipline to only process XON/XOFF characters. 1569 * the line discipline to only process XON/XOFF characters.
@@ -1571,8 +1571,8 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1571 tty->closing = 1; 1571 tty->closing = 1;
1572 spin_unlock_irqrestore(&port->lock, flags); 1572 spin_unlock_irqrestore(&port->lock, flags);
1573 dprintk (SX_DEBUG_OPEN, "Closing\n"); 1573 dprintk (SX_DEBUG_OPEN, "Closing\n");
1574 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) { 1574 if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {
1575 tty_wait_until_sent(tty, port->closing_wait); 1575 tty_wait_until_sent(tty, port->port.closing_wait);
1576 } 1576 }
1577 /* 1577 /*
1578 * At this point we stop accepting input. To do this, we 1578 * At this point we stop accepting input. To do this, we
@@ -1582,7 +1582,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1582 */ 1582 */
1583 dprintk (SX_DEBUG_OPEN, "Closed\n"); 1583 dprintk (SX_DEBUG_OPEN, "Closed\n");
1584 port->IER &= ~IER_RXD; 1584 port->IER &= ~IER_RXD;
1585 if (port->flags & ASYNC_INITIALIZED) { 1585 if (port->port.flags & ASYNC_INITIALIZED) {
1586 port->IER &= ~IER_TXRDY; 1586 port->IER &= ~IER_TXRDY;
1587 port->IER |= IER_TXEMPTY; 1587 port->IER |= IER_TXEMPTY;
1588 spin_lock_irqsave(&bp->lock, flags); 1588 spin_lock_irqsave(&bp->lock, flags);
@@ -1611,10 +1611,10 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1611 board_No(bp), bp->count, tty->index); 1611 board_No(bp), bp->count, tty->index);
1612 bp->count = 0; 1612 bp->count = 0;
1613 } 1613 }
1614 if (--port->count < 0) { 1614 if (--port->port.count < 0) {
1615 printk(KERN_ERR "sx%d: sx_close: bad port count for tty%d: %d\n", 1615 printk(KERN_ERR "sx%d: sx_close: bad port count for tty%d: %d\n",
1616 board_No(bp), port_No(port), port->count); 1616 board_No(bp), port_No(port), port->port.count);
1617 port->count = 0; 1617 port->port.count = 0;
1618 } 1618 }
1619 1619
1620 sx_shutdown_port(bp, port); 1620 sx_shutdown_port(bp, port);
@@ -1622,16 +1622,16 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1622 tty_ldisc_flush(tty); 1622 tty_ldisc_flush(tty);
1623 spin_lock_irqsave(&port->lock, flags); 1623 spin_lock_irqsave(&port->lock, flags);
1624 tty->closing = 0; 1624 tty->closing = 0;
1625 port->tty = NULL; 1625 port->port.tty = NULL;
1626 spin_unlock_irqrestore(&port->lock, flags); 1626 spin_unlock_irqrestore(&port->lock, flags);
1627 if (port->blocked_open) { 1627 if (port->port.blocked_open) {
1628 if (port->close_delay) { 1628 if (port->port.close_delay) {
1629 msleep_interruptible(jiffies_to_msecs(port->close_delay)); 1629 msleep_interruptible(jiffies_to_msecs(port->port.close_delay));
1630 } 1630 }
1631 wake_up_interruptible(&port->open_wait); 1631 wake_up_interruptible(&port->port.open_wait);
1632 } 1632 }
1633 port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1633 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1634 wake_up_interruptible(&port->close_wait); 1634 wake_up_interruptible(&port->port.close_wait);
1635 1635
1636 func_exit(); 1636 func_exit();
1637} 1637}
@@ -1815,7 +1815,7 @@ static int sx_tiocmget(struct tty_struct *tty, struct file *file)
1815 dprintk (SX_DEBUG_INIT, "Got msvr[%d] = %02x, car = %d.\n", 1815 dprintk (SX_DEBUG_INIT, "Got msvr[%d] = %02x, car = %d.\n",
1816 port_No(port), status, sx_in (bp, CD186x_CAR)); 1816 port_No(port), status, sx_in (bp, CD186x_CAR));
1817 dprintk (SX_DEBUG_INIT, "sx_port = %p, port = %p\n", sx_port, port); 1817 dprintk (SX_DEBUG_INIT, "sx_port = %p, port = %p\n", sx_port, port);
1818 if (SX_CRTSCTS(port->tty)) { 1818 if (SX_CRTSCTS(port->port.tty)) {
1819 result = /* (status & MSVR_RTS) ? */ TIOCM_DTR /* : 0) */ 1819 result = /* (status & MSVR_RTS) ? */ TIOCM_DTR /* : 0) */
1820 | ((status & MSVR_DTR) ? TIOCM_RTS : 0) 1820 | ((status & MSVR_DTR) ? TIOCM_RTS : 0)
1821 | ((status & MSVR_CD) ? TIOCM_CAR : 0) 1821 | ((status & MSVR_CD) ? TIOCM_CAR : 0)
@@ -1857,7 +1857,7 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file,
1857 /* if (set & TIOCM_DTR) 1857 /* if (set & TIOCM_DTR)
1858 port->MSVR |= MSVR_DTR; */ 1858 port->MSVR |= MSVR_DTR; */
1859 1859
1860 if (SX_CRTSCTS(port->tty)) { 1860 if (SX_CRTSCTS(port->port.tty)) {
1861 if (set & TIOCM_RTS) 1861 if (set & TIOCM_RTS)
1862 port->MSVR |= MSVR_DTR; 1862 port->MSVR |= MSVR_DTR;
1863 } else { 1863 } else {
@@ -1869,7 +1869,7 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file,
1869 port->MSVR &= ~MSVR_RTS; */ 1869 port->MSVR &= ~MSVR_RTS; */
1870 /* if (clear & TIOCM_DTR) 1870 /* if (clear & TIOCM_DTR)
1871 port->MSVR &= ~MSVR_DTR; */ 1871 port->MSVR &= ~MSVR_DTR; */
1872 if (SX_CRTSCTS(port->tty)) { 1872 if (SX_CRTSCTS(port->port.tty)) {
1873 if (clear & TIOCM_RTS) 1873 if (clear & TIOCM_RTS)
1874 port->MSVR &= ~MSVR_DTR; 1874 port->MSVR &= ~MSVR_DTR;
1875 } else { 1875 } else {
@@ -1929,27 +1929,27 @@ static inline int sx_set_serial_info(struct specialix_port * port,
1929 1929
1930 lock_kernel(); 1930 lock_kernel();
1931 1931
1932 change_speed = ((port->flags & ASYNC_SPD_MASK) != 1932 change_speed = ((port->port.flags & ASYNC_SPD_MASK) !=
1933 (tmp.flags & ASYNC_SPD_MASK)); 1933 (tmp.flags & ASYNC_SPD_MASK));
1934 change_speed |= (tmp.custom_divisor != port->custom_divisor); 1934 change_speed |= (tmp.custom_divisor != port->custom_divisor);
1935 1935
1936 if (!capable(CAP_SYS_ADMIN)) { 1936 if (!capable(CAP_SYS_ADMIN)) {
1937 if ((tmp.close_delay != port->close_delay) || 1937 if ((tmp.close_delay != port->port.close_delay) ||
1938 (tmp.closing_wait != port->closing_wait) || 1938 (tmp.closing_wait != port->port.closing_wait) ||
1939 ((tmp.flags & ~ASYNC_USR_MASK) != 1939 ((tmp.flags & ~ASYNC_USR_MASK) !=
1940 (port->flags & ~ASYNC_USR_MASK))) { 1940 (port->port.flags & ~ASYNC_USR_MASK))) {
1941 func_exit(); 1941 func_exit();
1942 unlock_kernel(); 1942 unlock_kernel();
1943 return -EPERM; 1943 return -EPERM;
1944 } 1944 }
1945 port->flags = ((port->flags & ~ASYNC_USR_MASK) | 1945 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
1946 (tmp.flags & ASYNC_USR_MASK)); 1946 (tmp.flags & ASYNC_USR_MASK));
1947 port->custom_divisor = tmp.custom_divisor; 1947 port->custom_divisor = tmp.custom_divisor;
1948 } else { 1948 } else {
1949 port->flags = ((port->flags & ~ASYNC_FLAGS) | 1949 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
1950 (tmp.flags & ASYNC_FLAGS)); 1950 (tmp.flags & ASYNC_FLAGS));
1951 port->close_delay = tmp.close_delay; 1951 port->port.close_delay = tmp.close_delay;
1952 port->closing_wait = tmp.closing_wait; 1952 port->port.closing_wait = tmp.closing_wait;
1953 port->custom_divisor = tmp.custom_divisor; 1953 port->custom_divisor = tmp.custom_divisor;
1954 } 1954 }
1955 if (change_speed) { 1955 if (change_speed) {
@@ -1975,10 +1975,10 @@ static inline int sx_get_serial_info(struct specialix_port * port,
1975 tmp.line = port - sx_port; 1975 tmp.line = port - sx_port;
1976 tmp.port = bp->base; 1976 tmp.port = bp->base;
1977 tmp.irq = bp->irq; 1977 tmp.irq = bp->irq;
1978 tmp.flags = port->flags; 1978 tmp.flags = port->port.flags;
1979 tmp.baud_base = (SX_OSCFREQ + CD186x_TPC/2) / CD186x_TPC; 1979 tmp.baud_base = (SX_OSCFREQ + CD186x_TPC/2) / CD186x_TPC;
1980 tmp.close_delay = port->close_delay * HZ/100; 1980 tmp.close_delay = port->port.close_delay * HZ/100;
1981 tmp.closing_wait = port->closing_wait * HZ/100; 1981 tmp.closing_wait = port->port.closing_wait * HZ/100;
1982 tmp.custom_divisor = port->custom_divisor; 1982 tmp.custom_divisor = port->custom_divisor;
1983 tmp.xmit_fifo_size = CD186x_NFIFO; 1983 tmp.xmit_fifo_size = CD186x_NFIFO;
1984 unlock_kernel(); 1984 unlock_kernel();
@@ -2199,17 +2199,17 @@ static void sx_hangup(struct tty_struct * tty)
2199 2199
2200 sx_shutdown_port(bp, port); 2200 sx_shutdown_port(bp, port);
2201 spin_lock_irqsave(&port->lock, flags); 2201 spin_lock_irqsave(&port->lock, flags);
2202 bp->count -= port->count; 2202 bp->count -= port->port.count;
2203 if (bp->count < 0) { 2203 if (bp->count < 0) {
2204 printk(KERN_ERR "sx%d: sx_hangup: bad board count: %d port: %d\n", 2204 printk(KERN_ERR "sx%d: sx_hangup: bad board count: %d port: %d\n",
2205 board_No(bp), bp->count, tty->index); 2205 board_No(bp), bp->count, tty->index);
2206 bp->count = 0; 2206 bp->count = 0;
2207 } 2207 }
2208 port->count = 0; 2208 port->port.count = 0;
2209 port->flags &= ~ASYNC_NORMAL_ACTIVE; 2209 port->port.flags &= ~ASYNC_NORMAL_ACTIVE;
2210 port->tty = NULL; 2210 port->port.tty = NULL;
2211 spin_unlock_irqrestore(&port->lock, flags); 2211 spin_unlock_irqrestore(&port->lock, flags);
2212 wake_up_interruptible(&port->open_wait); 2212 wake_up_interruptible(&port->port.open_wait);
2213 2213
2214 func_exit(); 2214 func_exit();
2215} 2215}
@@ -2224,10 +2224,6 @@ static void sx_set_termios(struct tty_struct * tty, struct ktermios * old_termio
2224 if (sx_paranoia_check(port, tty->name, "sx_set_termios")) 2224 if (sx_paranoia_check(port, tty->name, "sx_set_termios"))
2225 return; 2225 return;
2226 2226
2227 if (tty->termios->c_cflag == old_termios->c_cflag &&
2228 tty->termios->c_iflag == old_termios->c_iflag)
2229 return;
2230
2231 bp = port_Board(port); 2227 bp = port_Board(port);
2232 spin_lock_irqsave(&port->lock, flags); 2228 spin_lock_irqsave(&port->lock, flags);
2233 sx_change_speed(port_Board(port), port); 2229 sx_change_speed(port_Board(port), port);
@@ -2297,10 +2293,7 @@ static int sx_init_drivers(void)
2297 memset(sx_port, 0, sizeof(sx_port)); 2293 memset(sx_port, 0, sizeof(sx_port));
2298 for (i = 0; i < SX_NPORT * SX_NBOARD; i++) { 2294 for (i = 0; i < SX_NPORT * SX_NBOARD; i++) {
2299 sx_port[i].magic = SPECIALIX_MAGIC; 2295 sx_port[i].magic = SPECIALIX_MAGIC;
2300 sx_port[i].close_delay = 50 * HZ/100; 2296 tty_port_init(&sx_port[i].port);
2301 sx_port[i].closing_wait = 3000 * HZ/100;
2302 init_waitqueue_head(&sx_port[i].open_wait);
2303 init_waitqueue_head(&sx_port[i].close_wait);
2304 spin_lock_init(&sx_port[i].lock); 2297 spin_lock_init(&sx_port[i].lock);
2305 } 2298 }
2306 2299
diff --git a/drivers/char/specialix_io8.h b/drivers/char/specialix_io8.h
index 3f2f85bdf516..c63005274d9b 100644
--- a/drivers/char/specialix_io8.h
+++ b/drivers/char/specialix_io8.h
@@ -107,23 +107,17 @@ struct specialix_board {
107 107
108struct specialix_port { 108struct specialix_port {
109 int magic; 109 int magic;
110 struct tty_port port;
110 int baud_base; 111 int baud_base;
111 int flags; 112 int flags;
112 struct tty_struct * tty;
113 int count;
114 int blocked_open;
115 int timeout; 113 int timeout;
116 int close_delay;
117 unsigned char * xmit_buf; 114 unsigned char * xmit_buf;
118 int custom_divisor; 115 int custom_divisor;
119 int xmit_head; 116 int xmit_head;
120 int xmit_tail; 117 int xmit_tail;
121 int xmit_cnt; 118 int xmit_cnt;
122 wait_queue_head_t open_wait;
123 wait_queue_head_t close_wait;
124 short wakeup_chars; 119 short wakeup_chars;
125 short break_length; 120 short break_length;
126 unsigned short closing_wait;
127 unsigned char mark_mask; 121 unsigned char mark_mask;
128 unsigned char IER; 122 unsigned char IER;
129 unsigned char MSVR; 123 unsigned char MSVR;
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index b1239ee48b78..d5cffcd6a572 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -2395,6 +2395,7 @@ static int sx_init_portstructs(int nboards, int nports)
2395 board->ports = port; 2395 board->ports = port;
2396 for (j = 0; j < boards[i].nports; j++) { 2396 for (j = 0; j < boards[i].nports; j++) {
2397 sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j); 2397 sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j);
2398 tty_port_init(&port->gs.port);
2398 port->gs.magic = SX_MAGIC; 2399 port->gs.magic = SX_MAGIC;
2399 port->gs.close_delay = HZ / 2; 2400 port->gs.close_delay = HZ / 2;
2400 port->gs.closing_wait = 30 * HZ; 2401 port->gs.closing_wait = 30 * HZ;
@@ -2407,7 +2408,6 @@ static int sx_init_portstructs(int nboards, int nports)
2407 /* 2408 /*
2408 * Initializing wait queue 2409 * Initializing wait queue
2409 */ 2410 */
2410 tty_port_init(&port->gs.port);
2411 port++; 2411 port++;
2412 } 2412 }
2413 } 2413 }
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 734098f7dfa2..9f14753fada1 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -183,8 +183,6 @@ struct mgsl_struct {
183 struct tty_port port; 183 struct tty_port port;
184 int line; 184 int line;
185 int hw_version; 185 int hw_version;
186 unsigned short close_delay;
187 unsigned short closing_wait; /* time to wait before closing */
188 186
189 struct mgsl_icount icount; 187 struct mgsl_icount icount;
190 188
@@ -3142,11 +3140,11 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
3142 3140
3143 /* wait for transmit data to clear all layers */ 3141 /* wait for transmit data to clear all layers */
3144 3142
3145 if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { 3143 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {
3146 if (debug_level >= DEBUG_LEVEL_INFO) 3144 if (debug_level >= DEBUG_LEVEL_INFO)
3147 printk("%s(%d):mgsl_close(%s) calling tty_wait_until_sent\n", 3145 printk("%s(%d):mgsl_close(%s) calling tty_wait_until_sent\n",
3148 __FILE__,__LINE__, info->device_name ); 3146 __FILE__,__LINE__, info->device_name );
3149 tty_wait_until_sent(tty, info->closing_wait); 3147 tty_wait_until_sent(tty, info->port.closing_wait);
3150 } 3148 }
3151 3149
3152 if (info->port.flags & ASYNC_INITIALIZED) 3150 if (info->port.flags & ASYNC_INITIALIZED)
@@ -3162,8 +3160,8 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
3162 info->port.tty = NULL; 3160 info->port.tty = NULL;
3163 3161
3164 if (info->port.blocked_open) { 3162 if (info->port.blocked_open) {
3165 if (info->close_delay) { 3163 if (info->port.close_delay) {
3166 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 3164 msleep_interruptible(jiffies_to_msecs(info->port.close_delay));
3167 } 3165 }
3168 wake_up_interruptible(&info->port.open_wait); 3166 wake_up_interruptible(&info->port.open_wait);
3169 } 3167 }
@@ -4326,12 +4324,12 @@ static struct mgsl_struct* mgsl_allocate_device(void)
4326 if (!info) { 4324 if (!info) {
4327 printk("Error can't allocate device instance data\n"); 4325 printk("Error can't allocate device instance data\n");
4328 } else { 4326 } else {
4327 tty_port_init(&info->port);
4329 info->magic = MGSL_MAGIC; 4328 info->magic = MGSL_MAGIC;
4330 INIT_WORK(&info->task, mgsl_bh_handler); 4329 INIT_WORK(&info->task, mgsl_bh_handler);
4331 info->max_frame_size = 4096; 4330 info->max_frame_size = 4096;
4332 info->close_delay = 5*HZ/10; 4331 info->port.close_delay = 5*HZ/10;
4333 info->closing_wait = 30*HZ; 4332 info->port.closing_wait = 30*HZ;
4334 tty_port_init(&info->port);
4335 init_waitqueue_head(&info->status_event_wait_q); 4333 init_waitqueue_head(&info->status_event_wait_q);
4336 init_waitqueue_head(&info->event_wait_q); 4334 init_waitqueue_head(&info->event_wait_q);
4337 spin_lock_init(&info->irq_spinlock); 4335 spin_lock_init(&info->irq_spinlock);
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index fc71d9819165..07aa42a7f397 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -261,8 +261,6 @@ struct slgt_info {
261 struct slgt_info *port_array[SLGT_MAX_PORTS]; 261 struct slgt_info *port_array[SLGT_MAX_PORTS];
262 262
263 int line; /* tty line instance number */ 263 int line; /* tty line instance number */
264 unsigned short close_delay;
265 unsigned short closing_wait; /* time to wait before closing */
266 264
267 struct mgsl_icount icount; 265 struct mgsl_icount icount;
268 266
@@ -758,9 +756,9 @@ static void close(struct tty_struct *tty, struct file *filp)
758 756
759 /* wait for transmit data to clear all layers */ 757 /* wait for transmit data to clear all layers */
760 758
761 if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { 759 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {
762 DBGINFO(("%s call tty_wait_until_sent\n", info->device_name)); 760 DBGINFO(("%s call tty_wait_until_sent\n", info->device_name));
763 tty_wait_until_sent(tty, info->closing_wait); 761 tty_wait_until_sent(tty, info->port.closing_wait);
764 } 762 }
765 763
766 if (info->port.flags & ASYNC_INITIALIZED) 764 if (info->port.flags & ASYNC_INITIALIZED)
@@ -774,8 +772,8 @@ static void close(struct tty_struct *tty, struct file *filp)
774 info->port.tty = NULL; 772 info->port.tty = NULL;
775 773
776 if (info->port.blocked_open) { 774 if (info->port.blocked_open) {
777 if (info->close_delay) { 775 if (info->port.close_delay) {
778 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 776 msleep_interruptible(jiffies_to_msecs(info->port.close_delay));
779 } 777 }
780 wake_up_interruptible(&info->port.open_wait); 778 wake_up_interruptible(&info->port.open_wait);
781 } 779 }
@@ -3448,13 +3446,13 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
3448 DBGERR(("%s device alloc failed adapter=%d port=%d\n", 3446 DBGERR(("%s device alloc failed adapter=%d port=%d\n",
3449 driver_name, adapter_num, port_num)); 3447 driver_name, adapter_num, port_num));
3450 } else { 3448 } else {
3449 tty_port_init(&info->port);
3451 info->magic = MGSL_MAGIC; 3450 info->magic = MGSL_MAGIC;
3452 INIT_WORK(&info->task, bh_handler); 3451 INIT_WORK(&info->task, bh_handler);
3453 info->max_frame_size = 4096; 3452 info->max_frame_size = 4096;
3454 info->raw_rx_size = DMABUFSIZE; 3453 info->raw_rx_size = DMABUFSIZE;
3455 info->close_delay = 5*HZ/10; 3454 info->port.close_delay = 5*HZ/10;
3456 info->closing_wait = 30*HZ; 3455 info->port.closing_wait = 30*HZ;
3457 tty_port_init(&info->port);
3458 init_waitqueue_head(&info->status_event_wait_q); 3456 init_waitqueue_head(&info->status_event_wait_q);
3459 init_waitqueue_head(&info->event_wait_q); 3457 init_waitqueue_head(&info->event_wait_q);
3460 spin_lock_init(&info->netlock); 3458 spin_lock_init(&info->netlock);
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index 5b5b292d046b..c4bc09018368 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -846,11 +846,11 @@ static void close(struct tty_struct *tty, struct file *filp)
846 846
847 /* wait for transmit data to clear all layers */ 847 /* wait for transmit data to clear all layers */
848 848
849 if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { 849 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {
850 if (debug_level >= DEBUG_LEVEL_INFO) 850 if (debug_level >= DEBUG_LEVEL_INFO)
851 printk("%s(%d):%s close() calling tty_wait_until_sent\n", 851 printk("%s(%d):%s close() calling tty_wait_until_sent\n",
852 __FILE__,__LINE__, info->device_name ); 852 __FILE__,__LINE__, info->device_name );
853 tty_wait_until_sent(tty, info->closing_wait); 853 tty_wait_until_sent(tty, info->port.closing_wait);
854 } 854 }
855 855
856 if (info->port.flags & ASYNC_INITIALIZED) 856 if (info->port.flags & ASYNC_INITIALIZED)
@@ -866,8 +866,8 @@ static void close(struct tty_struct *tty, struct file *filp)
866 info->port.tty = NULL; 866 info->port.tty = NULL;
867 867
868 if (info->port.blocked_open) { 868 if (info->port.blocked_open) {
869 if (info->close_delay) { 869 if (info->port.close_delay) {
870 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 870 msleep_interruptible(jiffies_to_msecs(info->port.close_delay));
871 } 871 }
872 wake_up_interruptible(&info->port.open_wait); 872 wake_up_interruptible(&info->port.open_wait);
873 } 873 }
@@ -3802,12 +3802,12 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev)
3802 printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n", 3802 printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n",
3803 __FILE__,__LINE__, adapter_num, port_num); 3803 __FILE__,__LINE__, adapter_num, port_num);
3804 } else { 3804 } else {
3805 tty_port_init(&info->port);
3805 info->magic = MGSL_MAGIC; 3806 info->magic = MGSL_MAGIC;
3806 INIT_WORK(&info->task, bh_handler); 3807 INIT_WORK(&info->task, bh_handler);
3807 info->max_frame_size = 4096; 3808 info->max_frame_size = 4096;
3808 info->close_delay = 5*HZ/10; 3809 info->port.close_delay = 5*HZ/10;
3809 info->closing_wait = 30*HZ; 3810 info->port.closing_wait = 30*HZ;
3810 tty_port_init(&info->port);
3811 init_waitqueue_head(&info->status_event_wait_q); 3811 init_waitqueue_head(&info->status_event_wait_q);
3812 init_waitqueue_head(&info->event_wait_q); 3812 init_waitqueue_head(&info->event_wait_q);
3813 spin_lock_init(&info->netlock); 3813 spin_lock_init(&info->netlock);
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index a8cc416a23c0..82f6a8c86332 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2094,6 +2094,8 @@ void tty_port_init(struct tty_port *port)
2094 init_waitqueue_head(&port->open_wait); 2094 init_waitqueue_head(&port->open_wait);
2095 init_waitqueue_head(&port->close_wait); 2095 init_waitqueue_head(&port->close_wait);
2096 mutex_init(&port->mutex); 2096 mutex_init(&port->mutex);
2097 port->close_delay = (50 * HZ) / 100;
2098 port->closing_wait = (3000 * HZ) / 100;
2097} 2099}
2098EXPORT_SYMBOL(tty_port_init); 2100EXPORT_SYMBOL(tty_port_init);
2099 2101
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index a982b74a6ee6..2d3d1e04ba92 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -567,8 +567,6 @@ struct cyclades_port {
567 int chip_rev; 567 int chip_rev;
568 int custom_divisor; 568 int custom_divisor;
569 u8 x_char; /* to be pushed out ASAP */ 569 u8 x_char; /* to be pushed out ASAP */
570 int close_delay;
571 unsigned short closing_wait;
572 int breakon; 570 int breakon;
573 int breakoff; 571 int breakoff;
574 int xmit_head; 572 int xmit_head;
@@ -586,8 +584,8 @@ struct cyclades_port {
586}; 584};
587 585
588#define CLOSING_WAIT_DELAY 30*HZ 586#define CLOSING_WAIT_DELAY 30*HZ
589#define CY_CLOSING_WAIT_NONE 65535 587#define CY_CLOSING_WAIT_NONE ASYNC_CLOSING_WAIT_NONE
590#define CY_CLOSING_WAIT_INF 0 588#define CY_CLOSING_WAIT_INF ASYNC_CLOSING_WAIT_INF
591 589
592 590
593#define CyMAX_CHIPS_PER_CARD 8 591#define CyMAX_CHIPS_PER_CARD 8
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 46008e86b191..4e5833073aa6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -188,6 +188,8 @@ struct tty_port {
188 unsigned long flags; /* TTY flags ASY_*/ 188 unsigned long flags; /* TTY flags ASY_*/
189 struct mutex mutex; /* Locking */ 189 struct mutex mutex; /* Locking */
190 unsigned char *xmit_buf; /* Optional buffer */ 190 unsigned char *xmit_buf; /* Optional buffer */
191 int close_delay; /* Close port delay */
192 int closing_wait; /* Delay for output */
191}; 193};
192 194
193/* 195/*