aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/mxser.c
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 /drivers/char/mxser.c
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>
Diffstat (limited to 'drivers/char/mxser.c')
-rw-r--r--drivers/char/mxser.c29
1 files changed, 12 insertions, 17 deletions
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;