aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/generic_serial.c158
-rw-r--r--drivers/char/rio/rio_linux.c20
-rw-r--r--drivers/char/rio/riocmd.c10
-rw-r--r--drivers/char/rio/riointr.c10
-rw-r--r--drivers/char/rio/rioparam.c2
-rw-r--r--drivers/char/rio/riotty.c16
-rw-r--r--drivers/char/sx.c115
-rw-r--r--include/linux/generic_serial.h8
8 files changed, 166 insertions, 173 deletions
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 252f73e48596..19d3afb0e50c 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -60,7 +60,7 @@ int gs_put_char(struct tty_struct * tty, unsigned char ch)
60 60
61 if (!port) return 0; 61 if (!port) return 0;
62 62
63 if (! (port->flags & ASYNC_INITIALIZED)) return 0; 63 if (! (port->port.flags & ASYNC_INITIALIZED)) return 0;
64 64
65 /* Take a lock on the serial tranmit buffer! */ 65 /* Take a lock on the serial tranmit buffer! */
66 mutex_lock(& port->port_write_mutex); 66 mutex_lock(& port->port_write_mutex);
@@ -103,7 +103,7 @@ int gs_write(struct tty_struct * tty,
103 103
104 if (!port) return 0; 104 if (!port) return 0;
105 105
106 if (! (port->flags & ASYNC_INITIALIZED)) 106 if (! (port->port.flags & ASYNC_INITIALIZED))
107 return 0; 107 return 0;
108 108
109 /* get exclusive "write" access to this port (problem 3) */ 109 /* get exclusive "write" access to this port (problem 3) */
@@ -141,13 +141,13 @@ int gs_write(struct tty_struct * tty,
141 mutex_unlock(& port->port_write_mutex); 141 mutex_unlock(& port->port_write_mutex);
142 142
143 gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", 143 gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n",
144 (port->flags & GS_TX_INTEN)?"enabled": "disabled"); 144 (port->port.flags & GS_TX_INTEN)?"enabled": "disabled");
145 145
146 if (port->xmit_cnt && 146 if (port->xmit_cnt &&
147 !tty->stopped && 147 !tty->stopped &&
148 !tty->hw_stopped && 148 !tty->hw_stopped &&
149 !(port->flags & GS_TX_INTEN)) { 149 !(port->port.flags & GS_TX_INTEN)) {
150 port->flags |= GS_TX_INTEN; 150 port->port.flags |= GS_TX_INTEN;
151 port->rd->enable_tx_interrupts (port); 151 port->rd->enable_tx_interrupts (port);
152 } 152 }
153 func_exit (); 153 func_exit ();
@@ -208,7 +208,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
208 gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port); 208 gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port);
209 if (port) { 209 if (port) {
210 gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n", 210 gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n",
211 port->xmit_cnt, port->xmit_buf, port->tty); 211 port->xmit_cnt, port->xmit_buf, port->port.tty);
212 } 212 }
213 213
214 if (!port || port->xmit_cnt < 0 || !port->xmit_buf) { 214 if (!port || port->xmit_cnt < 0 || !port->xmit_buf) {
@@ -217,7 +217,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
217 return -EINVAL; /* This is an error which we don't know how to handle. */ 217 return -EINVAL; /* This is an error which we don't know how to handle. */
218 } 218 }
219 219
220 rcib = gs_real_chars_in_buffer(port->tty); 220 rcib = gs_real_chars_in_buffer(port->port.tty);
221 221
222 if(rcib <= 0) { 222 if(rcib <= 0) {
223 gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n"); 223 gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n");
@@ -236,7 +236,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
236 236
237 /* the expression is actually jiffies < end_jiffies, but that won't 237 /* the expression is actually jiffies < end_jiffies, but that won't
238 work around the wraparound. Tricky eh? */ 238 work around the wraparound. Tricky eh? */
239 while ((charsleft = gs_real_chars_in_buffer (port->tty)) && 239 while ((charsleft = gs_real_chars_in_buffer (port->port.tty)) &&
240 time_after (end_jiffies, jiffies)) { 240 time_after (end_jiffies, jiffies)) {
241 /* Units check: 241 /* Units check:
242 chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies! 242 chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies!
@@ -309,7 +309,7 @@ void gs_flush_chars(struct tty_struct * tty)
309 } 309 }
310 310
311 /* Beats me -- REW */ 311 /* Beats me -- REW */
312 port->flags |= GS_TX_INTEN; 312 port->port.flags |= GS_TX_INTEN;
313 port->rd->enable_tx_interrupts (port); 313 port->rd->enable_tx_interrupts (port);
314 func_exit (); 314 func_exit ();
315} 315}
@@ -329,8 +329,8 @@ void gs_stop(struct tty_struct * tty)
329 329
330 if (port->xmit_cnt && 330 if (port->xmit_cnt &&
331 port->xmit_buf && 331 port->xmit_buf &&
332 (port->flags & GS_TX_INTEN) ) { 332 (port->port.flags & GS_TX_INTEN) ) {
333 port->flags &= ~GS_TX_INTEN; 333 port->port.flags &= ~GS_TX_INTEN;
334 port->rd->disable_tx_interrupts (port); 334 port->rd->disable_tx_interrupts (port);
335 } 335 }
336 func_exit (); 336 func_exit ();
@@ -349,8 +349,8 @@ void gs_start(struct tty_struct * tty)
349 349
350 if (port->xmit_cnt && 350 if (port->xmit_cnt &&
351 port->xmit_buf && 351 port->xmit_buf &&
352 !(port->flags & GS_TX_INTEN) ) { 352 !(port->port.flags & GS_TX_INTEN) ) {
353 port->flags |= GS_TX_INTEN; 353 port->port.flags |= GS_TX_INTEN;
354 port->rd->enable_tx_interrupts (port); 354 port->rd->enable_tx_interrupts (port);
355 } 355 }
356 func_exit (); 356 func_exit ();
@@ -365,7 +365,7 @@ static void gs_shutdown_port (struct gs_port *port)
365 365
366 if (!port) return; 366 if (!port) return;
367 367
368 if (!(port->flags & ASYNC_INITIALIZED)) 368 if (!(port->port.flags & ASYNC_INITIALIZED))
369 return; 369 return;
370 370
371 spin_lock_irqsave(&port->driver_lock, flags); 371 spin_lock_irqsave(&port->driver_lock, flags);
@@ -375,12 +375,12 @@ static void gs_shutdown_port (struct gs_port *port)
375 port->xmit_buf = NULL; 375 port->xmit_buf = NULL;
376 } 376 }
377 377
378 if (port->tty) 378 if (port->port.tty)
379 set_bit(TTY_IO_ERROR, &port->tty->flags); 379 set_bit(TTY_IO_ERROR, &port->port.tty->flags);
380 380
381 port->rd->shutdown_port (port); 381 port->rd->shutdown_port (port);
382 382
383 port->flags &= ~ASYNC_INITIALIZED; 383 port->port.flags &= ~ASYNC_INITIALIZED;
384 spin_unlock_irqrestore(&port->driver_lock, flags); 384 spin_unlock_irqrestore(&port->driver_lock, flags);
385 385
386 func_exit(); 386 func_exit();
@@ -396,16 +396,16 @@ void gs_hangup(struct tty_struct *tty)
396 if (!tty) return; 396 if (!tty) return;
397 397
398 port = tty->driver_data; 398 port = tty->driver_data;
399 tty = port->tty; 399 tty = port->port.tty;
400 if (!tty) 400 if (!tty)
401 return; 401 return;
402 402
403 gs_shutdown_port (port); 403 gs_shutdown_port (port);
404 port->flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE); 404 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE);
405 port->tty = NULL; 405 port->port.tty = NULL;
406 port->count = 0; 406 port->port.count = 0;
407 407
408 wake_up_interruptible(&port->open_wait); 408 wake_up_interruptible(&port->port.open_wait);
409 func_exit (); 409 func_exit ();
410} 410}
411 411
@@ -424,7 +424,7 @@ int gs_block_til_ready(void *port_, struct file * filp)
424 424
425 if (!port) return 0; 425 if (!port) return 0;
426 426
427 tty = port->tty; 427 tty = port->port.tty;
428 428
429 if (!tty) return 0; 429 if (!tty) return 0;
430 430
@@ -433,9 +433,9 @@ int gs_block_til_ready(void *port_, struct file * filp)
433 * If the device is in the middle of being closed, then block 433 * If the device is in the middle of being closed, then block
434 * until it's done, and then try again. 434 * until it's done, and then try again.
435 */ 435 */
436 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { 436 if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) {
437 interruptible_sleep_on(&port->close_wait); 437 interruptible_sleep_on(&port->port.close_wait);
438 if (port->flags & ASYNC_HUP_NOTIFY) 438 if (port->port.flags & ASYNC_HUP_NOTIFY)
439 return -EAGAIN; 439 return -EAGAIN;
440 else 440 else
441 return -ERESTARTSYS; 441 return -ERESTARTSYS;
@@ -449,7 +449,7 @@ int gs_block_til_ready(void *port_, struct file * filp)
449 */ 449 */
450 if ((filp->f_flags & O_NONBLOCK) || 450 if ((filp->f_flags & O_NONBLOCK) ||
451 (tty->flags & (1 << TTY_IO_ERROR))) { 451 (tty->flags & (1 << TTY_IO_ERROR))) {
452 port->flags |= ASYNC_NORMAL_ACTIVE; 452 port->port.flags |= ASYNC_NORMAL_ACTIVE;
453 return 0; 453 return 0;
454 } 454 }
455 455
@@ -461,34 +461,34 @@ int gs_block_til_ready(void *port_, struct file * filp)
461 /* 461 /*
462 * Block waiting for the carrier detect and the line to become 462 * Block waiting for the carrier detect and the line to become
463 * free (i.e., not in use by the callout). While we are in 463 * free (i.e., not in use by the callout). While we are in
464 * this loop, port->count is dropped by one, so that 464 * this loop, port->port.count is dropped by one, so that
465 * rs_close() knows when to free things. We restore it upon 465 * rs_close() knows when to free things. We restore it upon
466 * exit, either normal or abnormal. 466 * exit, either normal or abnormal.
467 */ 467 */
468 retval = 0; 468 retval = 0;
469 469
470 add_wait_queue(&port->open_wait, &wait); 470 add_wait_queue(&port->port.open_wait, &wait);
471 471
472 gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n"); 472 gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n");
473 spin_lock_irqsave(&port->driver_lock, flags); 473 spin_lock_irqsave(&port->driver_lock, flags);
474 if (!tty_hung_up_p(filp)) { 474 if (!tty_hung_up_p(filp)) {
475 port->count--; 475 port->port.count--;
476 } 476 }
477 spin_unlock_irqrestore(&port->driver_lock, flags); 477 spin_unlock_irqrestore(&port->driver_lock, flags);
478 port->blocked_open++; 478 port->port.blocked_open++;
479 while (1) { 479 while (1) {
480 CD = port->rd->get_CD (port); 480 CD = port->rd->get_CD (port);
481 gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD); 481 gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD);
482 set_current_state (TASK_INTERRUPTIBLE); 482 set_current_state (TASK_INTERRUPTIBLE);
483 if (tty_hung_up_p(filp) || 483 if (tty_hung_up_p(filp) ||
484 !(port->flags & ASYNC_INITIALIZED)) { 484 !(port->port.flags & ASYNC_INITIALIZED)) {
485 if (port->flags & ASYNC_HUP_NOTIFY) 485 if (port->port.flags & ASYNC_HUP_NOTIFY)
486 retval = -EAGAIN; 486 retval = -EAGAIN;
487 else 487 else
488 retval = -ERESTARTSYS; 488 retval = -ERESTARTSYS;
489 break; 489 break;
490 } 490 }
491 if (!(port->flags & ASYNC_CLOSING) && 491 if (!(port->port.flags & ASYNC_CLOSING) &&
492 (do_clocal || CD)) 492 (do_clocal || CD))
493 break; 493 break;
494 gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n", 494 gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n",
@@ -500,17 +500,17 @@ int gs_block_til_ready(void *port_, struct file * filp)
500 schedule(); 500 schedule();
501 } 501 }
502 gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n", 502 gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n",
503 port->blocked_open); 503 port->port.blocked_open);
504 set_current_state (TASK_RUNNING); 504 set_current_state (TASK_RUNNING);
505 remove_wait_queue(&port->open_wait, &wait); 505 remove_wait_queue(&port->port.open_wait, &wait);
506 if (!tty_hung_up_p(filp)) { 506 if (!tty_hung_up_p(filp)) {
507 port->count++; 507 port->port.count++;
508 } 508 }
509 port->blocked_open--; 509 port->port.blocked_open--;
510 if (retval) 510 if (retval)
511 return retval; 511 return retval;
512 512
513 port->flags |= ASYNC_NORMAL_ACTIVE; 513 port->port.flags |= ASYNC_NORMAL_ACTIVE;
514 func_exit (); 514 func_exit ();
515 return 0; 515 return 0;
516} 516}
@@ -529,10 +529,10 @@ void gs_close(struct tty_struct * tty, struct file * filp)
529 529
530 if (!port) return; 530 if (!port) return;
531 531
532 if (!port->tty) { 532 if (!port->port.tty) {
533 /* This seems to happen when this is called from vhangup. */ 533 /* This seems to happen when this is called from vhangup. */
534 gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->tty is NULL\n"); 534 gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->port.tty is NULL\n");
535 port->tty = tty; 535 port->port.tty = tty;
536 } 536 }
537 537
538 spin_lock_irqsave(&port->driver_lock, flags); 538 spin_lock_irqsave(&port->driver_lock, flags);
@@ -545,23 +545,23 @@ void gs_close(struct tty_struct * tty, struct file * filp)
545 return; 545 return;
546 } 546 }
547 547
548 if ((tty->count == 1) && (port->count != 1)) { 548 if ((tty->count == 1) && (port->port.count != 1)) {
549 printk(KERN_ERR "gs: gs_close port %p: bad port count;" 549 printk(KERN_ERR "gs: gs_close port %p: bad port count;"
550 " tty->count is 1, port count is %d\n", port, port->count); 550 " tty->count is 1, port count is %d\n", port, port->port.count);
551 port->count = 1; 551 port->port.count = 1;
552 } 552 }
553 if (--port->count < 0) { 553 if (--port->port.count < 0) {
554 printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->count); 554 printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->port.count);
555 port->count = 0; 555 port->port.count = 0;
556 } 556 }
557 557
558 if (port->count) { 558 if (port->port.count) {
559 gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->count); 559 gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->port.count);
560 spin_unlock_irqrestore(&port->driver_lock, flags); 560 spin_unlock_irqrestore(&port->driver_lock, flags);
561 func_exit (); 561 func_exit ();
562 return; 562 return;
563 } 563 }
564 port->flags |= ASYNC_CLOSING; 564 port->port.flags |= ASYNC_CLOSING;
565 565
566 /* 566 /*
567 * Now we wait for the transmit buffer to clear; and we notify 567 * Now we wait for the transmit buffer to clear; and we notify
@@ -585,7 +585,7 @@ void gs_close(struct tty_struct * tty, struct file * filp)
585 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) 585 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
586 gs_wait_tx_flushed (port, port->closing_wait); 586 gs_wait_tx_flushed (port, port->closing_wait);
587 587
588 port->flags &= ~GS_ACTIVE; 588 port->port.flags &= ~GS_ACTIVE;
589 589
590 gs_flush_buffer(tty); 590 gs_flush_buffer(tty);
591 591
@@ -595,18 +595,18 @@ void gs_close(struct tty_struct * tty, struct file * filp)
595 port->event = 0; 595 port->event = 0;
596 port->rd->close (port); 596 port->rd->close (port);
597 port->rd->shutdown_port (port); 597 port->rd->shutdown_port (port);
598 port->tty = NULL; 598 port->port.tty = NULL;
599 599
600 if (port->blocked_open) { 600 if (port->port.blocked_open) {
601 if (port->close_delay) { 601 if (port->close_delay) {
602 spin_unlock_irqrestore(&port->driver_lock, flags); 602 spin_unlock_irqrestore(&port->driver_lock, flags);
603 msleep_interruptible(jiffies_to_msecs(port->close_delay)); 603 msleep_interruptible(jiffies_to_msecs(port->close_delay));
604 spin_lock_irqsave(&port->driver_lock, flags); 604 spin_lock_irqsave(&port->driver_lock, flags);
605 } 605 }
606 wake_up_interruptible(&port->open_wait); 606 wake_up_interruptible(&port->port.open_wait);
607 } 607 }
608 port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED); 608 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED);
609 wake_up_interruptible(&port->close_wait); 609 wake_up_interruptible(&port->port.close_wait);
610 610
611 func_exit (); 611 func_exit ();
612} 612}
@@ -626,10 +626,10 @@ void gs_set_termios (struct tty_struct * tty,
626 port = tty->driver_data; 626 port = tty->driver_data;
627 627
628 if (!port) return; 628 if (!port) return;
629 if (!port->tty) { 629 if (!port->port.tty) {
630 /* This seems to happen when this is called after gs_close. */ 630 /* This seems to happen when this is called after gs_close. */
631 gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->tty is NULL\n"); 631 gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->port.tty is NULL\n");
632 port->tty = tty; 632 port->port.tty = tty;
633 } 633 }
634 634
635 635
@@ -651,15 +651,15 @@ void gs_set_termios (struct tty_struct * tty,
651 baudrate = tty_get_baud_rate(tty); 651 baudrate = tty_get_baud_rate(tty);
652 652
653 if ((tiosp->c_cflag & CBAUD) == B38400) { 653 if ((tiosp->c_cflag & CBAUD) == B38400) {
654 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 654 if ( (port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
655 baudrate = 57600; 655 baudrate = 57600;
656 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 656 else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
657 baudrate = 115200; 657 baudrate = 115200;
658 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 658 else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
659 baudrate = 230400; 659 baudrate = 230400;
660 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 660 else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
661 baudrate = 460800; 661 baudrate = 460800;
662 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) 662 else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
663 baudrate = (port->baud_base / port->custom_divisor); 663 baudrate = (port->baud_base / port->custom_divisor);
664 } 664 }
665 665
@@ -715,7 +715,7 @@ int gs_init_port(struct gs_port *port)
715 715
716 func_enter (); 716 func_enter ();
717 717
718 if (port->flags & ASYNC_INITIALIZED) { 718 if (port->port.flags & ASYNC_INITIALIZED) {
719 func_exit (); 719 func_exit ();
720 return 0; 720 return 0;
721 } 721 }
@@ -737,15 +737,15 @@ int gs_init_port(struct gs_port *port)
737 } 737 }
738 738
739 spin_lock_irqsave (&port->driver_lock, flags); 739 spin_lock_irqsave (&port->driver_lock, flags);
740 if (port->tty) 740 if (port->port.tty)
741 clear_bit(TTY_IO_ERROR, &port->tty->flags); 741 clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
742 mutex_init(&port->port_write_mutex); 742 mutex_init(&port->port_write_mutex);
743 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 743 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
744 spin_unlock_irqrestore(&port->driver_lock, flags); 744 spin_unlock_irqrestore(&port->driver_lock, flags);
745 gs_set_termios(port->tty, NULL); 745 gs_set_termios(port->port.tty, NULL);
746 spin_lock_irqsave (&port->driver_lock, flags); 746 spin_lock_irqsave (&port->driver_lock, flags);
747 port->flags |= ASYNC_INITIALIZED; 747 port->port.flags |= ASYNC_INITIALIZED;
748 port->flags &= ~GS_TX_INTEN; 748 port->port.flags &= ~GS_TX_INTEN;
749 749
750 spin_unlock_irqrestore(&port->driver_lock, flags); 750 spin_unlock_irqrestore(&port->driver_lock, flags);
751 func_exit (); 751 func_exit ();
@@ -764,11 +764,11 @@ int gs_setserial(struct gs_port *port, struct serial_struct __user *sp)
764 if ((sio.baud_base != port->baud_base) || 764 if ((sio.baud_base != port->baud_base) ||
765 (sio.close_delay != port->close_delay) || 765 (sio.close_delay != port->close_delay) ||
766 ((sio.flags & ~ASYNC_USR_MASK) != 766 ((sio.flags & ~ASYNC_USR_MASK) !=
767 (port->flags & ~ASYNC_USR_MASK))) 767 (port->port.flags & ~ASYNC_USR_MASK)))
768 return(-EPERM); 768 return(-EPERM);
769 } 769 }
770 770
771 port->flags = (port->flags & ~ASYNC_USR_MASK) | 771 port->port.flags = (port->port.flags & ~ASYNC_USR_MASK) |
772 (sio.flags & ASYNC_USR_MASK); 772 (sio.flags & ASYNC_USR_MASK);
773 773
774 port->baud_base = sio.baud_base; 774 port->baud_base = sio.baud_base;
@@ -776,7 +776,7 @@ int gs_setserial(struct gs_port *port, struct serial_struct __user *sp)
776 port->closing_wait = sio.closing_wait; 776 port->closing_wait = sio.closing_wait;
777 port->custom_divisor = sio.custom_divisor; 777 port->custom_divisor = sio.custom_divisor;
778 778
779 gs_set_termios (port->tty, NULL); 779 gs_set_termios (port->port.tty, NULL);
780 780
781 return 0; 781 return 0;
782} 782}
@@ -793,7 +793,7 @@ int gs_getserial(struct gs_port *port, struct serial_struct __user *sp)
793 struct serial_struct sio; 793 struct serial_struct sio;
794 794
795 memset(&sio, 0, sizeof(struct serial_struct)); 795 memset(&sio, 0, sizeof(struct serial_struct));
796 sio.flags = port->flags; 796 sio.flags = port->port.flags;
797 sio.baud_base = port->baud_base; 797 sio.baud_base = port->baud_base;
798 sio.close_delay = port->close_delay; 798 sio.close_delay = port->close_delay;
799 sio.closing_wait = port->closing_wait; 799 sio.closing_wait = port->closing_wait;
@@ -821,10 +821,10 @@ void gs_got_break(struct gs_port *port)
821{ 821{
822 func_enter (); 822 func_enter ();
823 823
824 tty_insert_flip_char(port->tty, 0, TTY_BREAK); 824 tty_insert_flip_char(port->port.tty, 0, TTY_BREAK);
825 tty_schedule_flip(port->tty); 825 tty_schedule_flip(port->port.tty);
826 if (port->flags & ASYNC_SAK) { 826 if (port->port.flags & ASYNC_SAK) {
827 do_SAK (port->tty); 827 do_SAK (port->port.tty);
828 } 828 }
829 829
830 func_exit (); 830 func_exit ();
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index e49e6e6372f3..0cdfee152916 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -431,7 +431,7 @@ static void rio_disable_tx_interrupts(void *ptr)
431{ 431{
432 func_enter(); 432 func_enter();
433 433
434 /* port->gs.flags &= ~GS_TX_INTEN; */ 434 /* port->gs.port.flags &= ~GS_TX_INTEN; */
435 435
436 func_exit(); 436 func_exit();
437} 437}
@@ -455,7 +455,7 @@ static void rio_enable_tx_interrupts(void *ptr)
455 * In general we cannot count on "tx empty" interrupts, although 455 * In general we cannot count on "tx empty" interrupts, although
456 * the interrupt routine seems to be able to tell the difference. 456 * the interrupt routine seems to be able to tell the difference.
457 */ 457 */
458 PortP->gs.flags &= ~GS_TX_INTEN; 458 PortP->gs.port.flags &= ~GS_TX_INTEN;
459 459
460 func_exit(); 460 func_exit();
461} 461}
@@ -510,7 +510,7 @@ static void rio_shutdown_port(void *ptr)
510 func_enter(); 510 func_enter();
511 511
512 PortP = (struct Port *) ptr; 512 PortP = (struct Port *) ptr;
513 PortP->gs.tty = NULL; 513 PortP->gs.port.tty = NULL;
514 func_exit(); 514 func_exit();
515} 515}
516 516
@@ -529,7 +529,7 @@ static void rio_hungup(void *ptr)
529 func_enter(); 529 func_enter();
530 530
531 PortP = (struct Port *) ptr; 531 PortP = (struct Port *) ptr;
532 PortP->gs.tty = NULL; 532 PortP->gs.port.tty = NULL;
533 533
534 func_exit(); 534 func_exit();
535} 535}
@@ -549,12 +549,12 @@ static void rio_close(void *ptr)
549 549
550 riotclose(ptr); 550 riotclose(ptr);
551 551
552 if (PortP->gs.count) { 552 if (PortP->gs.port.count) {
553 printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count); 553 printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.port.count);
554 PortP->gs.count = 0; 554 PortP->gs.port.count = 0;
555 } 555 }
556 556
557 PortP->gs.tty = NULL; 557 PortP->gs.port.tty = NULL;
558 func_exit(); 558 func_exit();
559} 559}
560 560
@@ -849,8 +849,8 @@ static int rio_init_datastructures(void)
849 /* 849 /*
850 * Initializing wait queue 850 * Initializing wait queue
851 */ 851 */
852 init_waitqueue_head(&port->gs.open_wait); 852 init_waitqueue_head(&port->gs.port.open_wait);
853 init_waitqueue_head(&port->gs.close_wait); 853 init_waitqueue_head(&port->gs.port.close_wait);
854 } 854 }
855#else 855#else
856 /* We could postpone initializing them to when they are configured. */ 856 /* We could postpone initializing them to when they are configured. */
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index 391f0b4da7ea..01f2654d5a2e 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -484,12 +484,12 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
484 ** If the device is a modem, then check the modem 484 ** If the device is a modem, then check the modem
485 ** carrier. 485 ** carrier.
486 */ 486 */
487 if (PortP->gs.tty == NULL) 487 if (PortP->gs.port.tty == NULL)
488 break; 488 break;
489 if (PortP->gs.tty->termios == NULL) 489 if (PortP->gs.port.tty->termios == NULL)
490 break; 490 break;
491 491
492 if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) { 492 if (!(PortP->gs.port.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {
493 493
494 rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n"); 494 rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n");
495 /* 495 /*
@@ -506,7 +506,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
506 ** wakeup anyone in WOPEN 506 ** wakeup anyone in WOPEN
507 */ 507 */
508 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) 508 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
509 wake_up_interruptible(&PortP->gs.open_wait); 509 wake_up_interruptible(&PortP->gs.port.open_wait);
510 } 510 }
511 } else { 511 } else {
512 /* 512 /*
@@ -514,7 +514,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
514 */ 514 */
515 if (PortP->State & RIO_CARR_ON) { 515 if (PortP->State & RIO_CARR_ON) {
516 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) 516 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN))
517 tty_hangup(PortP->gs.tty); 517 tty_hangup(PortP->gs.port.tty);
518 PortP->State &= ~RIO_CARR_ON; 518 PortP->State &= ~RIO_CARR_ON;
519 rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); 519 rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
520 } 520 }
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c
index 11c7987821c4..71f87600907c 100644
--- a/drivers/char/rio/riointr.c
+++ b/drivers/char/rio/riointr.c
@@ -102,7 +102,7 @@ void RIOTxEnable(char *en)
102 102
103 PortP = (struct Port *) en; 103 PortP = (struct Port *) en;
104 p = (struct rio_info *) PortP->p; 104 p = (struct rio_info *) PortP->p;
105 tty = PortP->gs.tty; 105 tty = PortP->gs.port.tty;
106 106
107 107
108 rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt); 108 rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt);
@@ -158,7 +158,7 @@ void RIOTxEnable(char *en)
158 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 158 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
159 159
160 if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) 160 if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN))
161 tty_wakeup(PortP->gs.tty); 161 tty_wakeup(PortP->gs.port.tty);
162 162
163} 163}
164 164
@@ -241,7 +241,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP)
241 ** find corresponding tty structure. The process of mapping 241 ** find corresponding tty structure. The process of mapping
242 ** the ports puts these here. 242 ** the ports puts these here.
243 */ 243 */
244 ttyP = PortP->gs.tty; 244 ttyP = PortP->gs.port.tty;
245 245
246 /* 246 /*
247 ** Lock the port before we begin working on it. 247 ** Lock the port before we begin working on it.
@@ -335,7 +335,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP)
335 ** find corresponding tty structure. The process of mapping 335 ** find corresponding tty structure. The process of mapping
336 ** the ports puts these here. 336 ** the ports puts these here.
337 */ 337 */
338 ttyP = PortP->gs.tty; 338 ttyP = PortP->gs.port.tty;
339 /* If ttyP is NULL, the port is getting closed. Forget about it. */ 339 /* If ttyP is NULL, the port is getting closed. Forget about it. */
340 if (!ttyP) { 340 if (!ttyP) {
341 rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); 341 rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n");
@@ -542,7 +542,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
542 542
543 intCount++; 543 intCount++;
544 544
545 TtyP = PortP->gs.tty; 545 TtyP = PortP->gs.port.tty;
546 if (!TtyP) { 546 if (!TtyP) {
547 rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); 547 rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
548 return; 548 return;
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c
index 447ca34a6a72..d687c17be152 100644
--- a/drivers/char/rio/rioparam.c
+++ b/drivers/char/rio/rioparam.c
@@ -160,7 +160,7 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag)
160 160
161 func_enter(); 161 func_enter();
162 162
163 TtyP = PortP->gs.tty; 163 TtyP = PortP->gs.port.tty;
164 164
165 rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP); 165 rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP);
166 166
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index 95a88a4138e8..2fb49e89b324 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -140,14 +140,14 @@ int riotopen(struct tty_struct *tty, struct file *filp)
140 140
141 tty->driver_data = PortP; 141 tty->driver_data = PortP;
142 142
143 PortP->gs.tty = tty; 143 PortP->gs.port.tty = tty;
144 PortP->gs.count++; 144 PortP->gs.port.count++;
145 145
146 rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); 146 rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
147 147
148 retval = gs_init_port(&PortP->gs); 148 retval = gs_init_port(&PortP->gs);
149 if (retval) { 149 if (retval) {
150 PortP->gs.count--; 150 PortP->gs.port.count--;
151 return -ENXIO; 151 return -ENXIO;
152 } 152 }
153 /* 153 /*
@@ -293,7 +293,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
293 ** insert test for carrier here. -- ??? 293 ** insert test for carrier here. -- ???
294 ** I already see that test here. What's the deal? -- REW 294 ** I already see that test here. What's the deal? -- REW
295 */ 295 */
296 if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || 296 if ((PortP->gs.port.tty->termios->c_cflag & CLOCAL) ||
297 (PortP->ModemState & RIOC_MSVR1_CD)) { 297 (PortP->ModemState & RIOC_MSVR1_CD)) {
298 rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); 298 rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
299 /* 299 /*
@@ -301,16 +301,16 @@ int riotopen(struct tty_struct *tty, struct file *filp)
301 wakeup((caddr_t) &tp->tm.c_canq); 301 wakeup((caddr_t) &tp->tm.c_canq);
302 */ 302 */
303 PortP->State |= RIO_CARR_ON; 303 PortP->State |= RIO_CARR_ON;
304 wake_up_interruptible(&PortP->gs.open_wait); 304 wake_up_interruptible(&PortP->gs.port.open_wait);
305 } else { /* no carrier - wait for DCD */ 305 } else { /* no carrier - wait for DCD */
306 /* 306 /*
307 while (!(PortP->gs.tty->termios->c_state & CARR_ON) && 307 while (!(PortP->gs.port.tty->termios->c_state & CARR_ON) &&
308 !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) 308 !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
309 */ 309 */
310 while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { 310 while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
311 rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); 311 rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
312 /* 312 /*
313 PortP->gs.tty->termios->c_state |= WOPEN; 313 PortP->gs.port.tty->termios->c_state |= WOPEN;
314 */ 314 */
315 PortP->State |= RIO_WOPEN; 315 PortP->State |= RIO_WOPEN;
316 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 316 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
@@ -380,7 +380,7 @@ int riotclose(void *ptr)
380 /* PortP = p->RIOPortp[SysPort]; */ 380 /* PortP = p->RIOPortp[SysPort]; */
381 rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP); 381 rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
382 /* tp = PortP->TtyP; *//* Get tty */ 382 /* tp = PortP->TtyP; *//* Get tty */
383 tty = PortP->gs.tty; 383 tty = PortP->gs.port.tty;
384 rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty); 384 rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty);
385 385
386 if (PortP->gs.closing_wait) 386 if (PortP->gs.closing_wait)
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index b1a7a8cb65ea..b1239ee48b78 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1,4 +1,3 @@
1
2/* sx.c -- driver for the Specialix SX series cards. 1/* sx.c -- driver for the Specialix SX series cards.
3 * 2 *
4 * This driver will also support the older SI, and XIO cards. 3 * This driver will also support the older SI, and XIO cards.
@@ -930,7 +929,7 @@ static int sx_set_real_termios(void *ptr)
930 929
931 func_enter2(); 930 func_enter2();
932 931
933 if (!port->gs.tty) 932 if (!port->gs.port.tty)
934 return 0; 933 return 0;
935 934
936 /* What is this doing here? -- REW 935 /* What is this doing here? -- REW
@@ -941,19 +940,19 @@ static int sx_set_real_termios(void *ptr)
941 940
942 sx_set_baud(port); 941 sx_set_baud(port);
943 942
944#define CFLAG port->gs.tty->termios->c_cflag 943#define CFLAG port->gs.port.tty->termios->c_cflag
945 sx_write_channel_byte(port, hi_mr1, 944 sx_write_channel_byte(port, hi_mr1,
946 (C_PARENB(port->gs.tty) ? MR1_WITH : MR1_NONE) | 945 (C_PARENB(port->gs.port.tty) ? MR1_WITH : MR1_NONE) |
947 (C_PARODD(port->gs.tty) ? MR1_ODD : MR1_EVEN) | 946 (C_PARODD(port->gs.port.tty) ? MR1_ODD : MR1_EVEN) |
948 (C_CRTSCTS(port->gs.tty) ? MR1_RTS_RXFLOW : 0) | 947 (C_CRTSCTS(port->gs.port.tty) ? MR1_RTS_RXFLOW : 0) |
949 (((CFLAG & CSIZE) == CS8) ? MR1_8_BITS : 0) | 948 (((CFLAG & CSIZE) == CS8) ? MR1_8_BITS : 0) |
950 (((CFLAG & CSIZE) == CS7) ? MR1_7_BITS : 0) | 949 (((CFLAG & CSIZE) == CS7) ? MR1_7_BITS : 0) |
951 (((CFLAG & CSIZE) == CS6) ? MR1_6_BITS : 0) | 950 (((CFLAG & CSIZE) == CS6) ? MR1_6_BITS : 0) |
952 (((CFLAG & CSIZE) == CS5) ? MR1_5_BITS : 0)); 951 (((CFLAG & CSIZE) == CS5) ? MR1_5_BITS : 0));
953 952
954 sx_write_channel_byte(port, hi_mr2, 953 sx_write_channel_byte(port, hi_mr2,
955 (C_CRTSCTS(port->gs.tty) ? MR2_CTS_TXFLOW : 0) | 954 (C_CRTSCTS(port->gs.port.tty) ? MR2_CTS_TXFLOW : 0) |
956 (C_CSTOPB(port->gs.tty) ? MR2_2_STOP : 955 (C_CSTOPB(port->gs.port.tty) ? MR2_2_STOP :
957 MR2_1_STOP)); 956 MR2_1_STOP));
958 957
959 switch (CFLAG & CSIZE) { 958 switch (CFLAG & CSIZE) {
@@ -976,44 +975,44 @@ static int sx_set_real_termios(void *ptr)
976 } 975 }
977 976
978 sx_write_channel_byte(port, hi_prtcl, 977 sx_write_channel_byte(port, hi_prtcl,
979 (I_IXON(port->gs.tty) ? SP_TXEN : 0) | 978 (I_IXON(port->gs.port.tty) ? SP_TXEN : 0) |
980 (I_IXOFF(port->gs.tty) ? SP_RXEN : 0) | 979 (I_IXOFF(port->gs.port.tty) ? SP_RXEN : 0) |
981 (I_IXANY(port->gs.tty) ? SP_TANY : 0) | SP_DCEN); 980 (I_IXANY(port->gs.port.tty) ? SP_TANY : 0) | SP_DCEN);
982 981
983 sx_write_channel_byte(port, hi_break, 982 sx_write_channel_byte(port, hi_break,
984 (I_IGNBRK(port->gs.tty) ? BR_IGN : 0 | 983 (I_IGNBRK(port->gs.port.tty) ? BR_IGN : 0 |
985 I_BRKINT(port->gs.tty) ? BR_INT : 0)); 984 I_BRKINT(port->gs.port.tty) ? BR_INT : 0));
986 985
987 sx_write_channel_byte(port, hi_txon, START_CHAR(port->gs.tty)); 986 sx_write_channel_byte(port, hi_txon, START_CHAR(port->gs.port.tty));
988 sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.tty)); 987 sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.port.tty));
989 sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.tty)); 988 sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.port.tty));
990 sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.tty)); 989 sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.port.tty));
991 990
992 sx_reconfigure_port(port); 991 sx_reconfigure_port(port);
993 992
994 /* Tell line discipline whether we will do input cooking */ 993 /* Tell line discipline whether we will do input cooking */
995 if (I_OTHER(port->gs.tty)) { 994 if (I_OTHER(port->gs.port.tty)) {
996 clear_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); 995 clear_bit(TTY_HW_COOK_IN, &port->gs.port.tty->flags);
997 } else { 996 } else {
998 set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); 997 set_bit(TTY_HW_COOK_IN, &port->gs.port.tty->flags);
999 } 998 }
1000 sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ", 999 sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ",
1001 (unsigned int)port->gs.tty->termios->c_iflag, 1000 (unsigned int)port->gs.port.tty->termios->c_iflag,
1002 I_OTHER(port->gs.tty)); 1001 I_OTHER(port->gs.port.tty));
1003 1002
1004/* Tell line discipline whether we will do output cooking. 1003/* Tell line discipline whether we will do output cooking.
1005 * If OPOST is set and no other output flags are set then we can do output 1004 * If OPOST is set and no other output flags are set then we can do output
1006 * processing. Even if only *one* other flag in the O_OTHER group is set 1005 * processing. Even if only *one* other flag in the O_OTHER group is set
1007 * we do cooking in software. 1006 * we do cooking in software.
1008 */ 1007 */
1009 if (O_OPOST(port->gs.tty) && !O_OTHER(port->gs.tty)) { 1008 if (O_OPOST(port->gs.port.tty) && !O_OTHER(port->gs.port.tty)) {
1010 set_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); 1009 set_bit(TTY_HW_COOK_OUT, &port->gs.port.tty->flags);
1011 } else { 1010 } else {
1012 clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); 1011 clear_bit(TTY_HW_COOK_OUT, &port->gs.port.tty->flags);
1013 } 1012 }
1014 sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", 1013 sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n",
1015 (unsigned int)port->gs.tty->termios->c_oflag, 1014 (unsigned int)port->gs.port.tty->termios->c_oflag,
1016 O_OTHER(port->gs.tty)); 1015 O_OTHER(port->gs.port.tty));
1017 /* port->c_dcd = sx_get_CD (port); */ 1016 /* port->c_dcd = sx_get_CD (port); */
1018 func_exit(); 1017 func_exit();
1019 return 0; 1018 return 0;
@@ -1102,8 +1101,8 @@ static void sx_transmit_chars(struct sx_port *port)
1102 sx_disable_tx_interrupts(port); 1101 sx_disable_tx_interrupts(port);
1103 } 1102 }
1104 1103
1105 if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { 1104 if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.port.tty) {
1106 tty_wakeup(port->gs.tty); 1105 tty_wakeup(port->gs.port.tty);
1107 sx_dprintk(SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n", 1106 sx_dprintk(SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n",
1108 port->gs.wakeup_chars); 1107 port->gs.wakeup_chars);
1109 } 1108 }
@@ -1126,7 +1125,7 @@ static inline void sx_receive_chars(struct sx_port *port)
1126 unsigned char *rp; 1125 unsigned char *rp;
1127 1126
1128 func_enter2(); 1127 func_enter2();
1129 tty = port->gs.tty; 1128 tty = port->gs.port.tty;
1130 while (1) { 1129 while (1) {
1131 rx_op = sx_read_channel_byte(port, hi_rxopos); 1130 rx_op = sx_read_channel_byte(port, hi_rxopos);
1132 c = (sx_read_channel_byte(port, hi_rxipos) - rx_op) & 0xff; 1131 c = (sx_read_channel_byte(port, hi_rxipos) - rx_op) & 0xff;
@@ -1211,12 +1210,12 @@ static inline void sx_check_modem_signals(struct sx_port *port)
1211 /* DCD went UP */ 1210 /* DCD went UP */
1212 if ((sx_read_channel_byte(port, hi_hstat) != 1211 if ((sx_read_channel_byte(port, hi_hstat) !=
1213 HS_IDLE_CLOSED) && 1212 HS_IDLE_CLOSED) &&
1214 !(port->gs.tty->termios-> 1213 !(port->gs.port.tty->termios->
1215 c_cflag & CLOCAL)) { 1214 c_cflag & CLOCAL)) {
1216 /* Are we blocking in open? */ 1215 /* Are we blocking in open? */
1217 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " 1216 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD "
1218 "active, unblocking open\n"); 1217 "active, unblocking open\n");
1219 wake_up_interruptible(&port->gs. 1218 wake_up_interruptible(&port->gs.port.
1220 open_wait); 1219 open_wait);
1221 } else { 1220 } else {
1222 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " 1221 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD "
@@ -1224,10 +1223,10 @@ static inline void sx_check_modem_signals(struct sx_port *port)
1224 } 1223 }
1225 } else { 1224 } else {
1226 /* DCD went down! */ 1225 /* DCD went down! */
1227 if (!(port->gs.tty->termios->c_cflag & CLOCAL)){ 1226 if (!(port->gs.port.tty->termios->c_cflag & CLOCAL)){
1228 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " 1227 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD "
1229 "dropped. hanging up....\n"); 1228 "dropped. hanging up....\n");
1230 tty_hangup(port->gs.tty); 1229 tty_hangup(port->gs.port.tty);
1231 } else { 1230 } else {
1232 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " 1231 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD "
1233 "dropped. ignoring.\n"); 1232 "dropped. ignoring.\n");
@@ -1325,7 +1324,7 @@ static irqreturn_t sx_interrupt(int irq, void *ptr)
1325 1324
1326 for (i = 0; i < board->nports; i++) { 1325 for (i = 0; i < board->nports; i++) {
1327 port = &board->ports[i]; 1326 port = &board->ports[i];
1328 if (port->gs.flags & GS_ACTIVE) { 1327 if (port->gs.port.flags & GS_ACTIVE) {
1329 if (sx_read_channel_byte(port, hi_state)) { 1328 if (sx_read_channel_byte(port, hi_state)) {
1330 sx_dprintk(SX_DEBUG_INTERRUPTS, "Port %d: " 1329 sx_dprintk(SX_DEBUG_INTERRUPTS, "Port %d: "
1331 "modem signal change?... \n",i); 1330 "modem signal change?... \n",i);
@@ -1334,7 +1333,7 @@ static irqreturn_t sx_interrupt(int irq, void *ptr)
1334 if (port->gs.xmit_cnt) { 1333 if (port->gs.xmit_cnt) {
1335 sx_transmit_chars(port); 1334 sx_transmit_chars(port);
1336 } 1335 }
1337 if (!(port->gs.flags & SX_RX_THROTTLE)) { 1336 if (!(port->gs.port.flags & SX_RX_THROTTLE)) {
1338 sx_receive_chars(port); 1337 sx_receive_chars(port);
1339 } 1338 }
1340 } 1339 }
@@ -1373,7 +1372,7 @@ static void sx_disable_tx_interrupts(void *ptr)
1373 struct sx_port *port = ptr; 1372 struct sx_port *port = ptr;
1374 func_enter2(); 1373 func_enter2();
1375 1374
1376 port->gs.flags &= ~GS_TX_INTEN; 1375 port->gs.port.flags &= ~GS_TX_INTEN;
1377 1376
1378 func_exit(); 1377 func_exit();
1379} 1378}
@@ -1394,7 +1393,7 @@ static void sx_enable_tx_interrupts(void *ptr)
1394 1393
1395 /* XXX Must be "HIGH_WATER" for SI card according to doc. */ 1394 /* XXX Must be "HIGH_WATER" for SI card according to doc. */
1396 if (data_in_buffer < LOW_WATER) 1395 if (data_in_buffer < LOW_WATER)
1397 port->gs.flags &= ~GS_TX_INTEN; 1396 port->gs.port.flags &= ~GS_TX_INTEN;
1398 1397
1399 func_exit(); 1398 func_exit();
1400} 1399}
@@ -1442,8 +1441,8 @@ static void sx_shutdown_port(void *ptr)
1442 1441
1443 func_enter(); 1442 func_enter();
1444 1443
1445 port->gs.flags &= ~GS_ACTIVE; 1444 port->gs.port.flags &= ~GS_ACTIVE;
1446 if (port->gs.tty && (port->gs.tty->termios->c_cflag & HUPCL)) { 1445 if (port->gs.port.tty && (port->gs.port.tty->termios->c_cflag & HUPCL)) {
1447 sx_setsignals(port, 0, 0); 1446 sx_setsignals(port, 0, 0);
1448 sx_reconfigure_port(port); 1447 sx_reconfigure_port(port);
1449 } 1448 }
@@ -1485,8 +1484,8 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1485 spin_lock_irqsave(&port->gs.driver_lock, flags); 1484 spin_lock_irqsave(&port->gs.driver_lock, flags);
1486 1485
1487 tty->driver_data = port; 1486 tty->driver_data = port;
1488 port->gs.tty = tty; 1487 port->gs.port.tty = tty;
1489 port->gs.count++; 1488 port->gs.port.count++;
1490 spin_unlock_irqrestore(&port->gs.driver_lock, flags); 1489 spin_unlock_irqrestore(&port->gs.driver_lock, flags);
1491 1490
1492 sx_dprintk(SX_DEBUG_OPEN, "starting port\n"); 1491 sx_dprintk(SX_DEBUG_OPEN, "starting port\n");
@@ -1497,12 +1496,12 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1497 retval = gs_init_port(&port->gs); 1496 retval = gs_init_port(&port->gs);
1498 sx_dprintk(SX_DEBUG_OPEN, "done gs_init\n"); 1497 sx_dprintk(SX_DEBUG_OPEN, "done gs_init\n");
1499 if (retval) { 1498 if (retval) {
1500 port->gs.count--; 1499 port->gs.port.count--;
1501 return retval; 1500 return retval;
1502 } 1501 }
1503 1502
1504 port->gs.flags |= GS_ACTIVE; 1503 port->gs.port.flags |= GS_ACTIVE;
1505 if (port->gs.count <= 1) 1504 if (port->gs.port.count <= 1)
1506 sx_setsignals(port, 1, 1); 1505 sx_setsignals(port, 1, 1);
1507 1506
1508#if 0 1507#if 0
@@ -1513,12 +1512,12 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1513 my_hd_io(port->board->base + port->ch_base, sizeof(*port)); 1512 my_hd_io(port->board->base + port->ch_base, sizeof(*port));
1514#endif 1513#endif
1515 1514
1516 if (port->gs.count <= 1) { 1515 if (port->gs.port.count <= 1) {
1517 if (sx_send_command(port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) { 1516 if (sx_send_command(port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) {
1518 printk(KERN_ERR "sx: Card didn't respond to LOPEN " 1517 printk(KERN_ERR "sx: Card didn't respond to LOPEN "
1519 "command.\n"); 1518 "command.\n");
1520 spin_lock_irqsave(&port->gs.driver_lock, flags); 1519 spin_lock_irqsave(&port->gs.driver_lock, flags);
1521 port->gs.count--; 1520 port->gs.port.count--;
1522 spin_unlock_irqrestore(&port->gs.driver_lock, flags); 1521 spin_unlock_irqrestore(&port->gs.driver_lock, flags);
1523 return -EIO; 1522 return -EIO;
1524 } 1523 }
@@ -1526,11 +1525,11 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1526 1525
1527 retval = gs_block_til_ready(port, filp); 1526 retval = gs_block_til_ready(port, filp);
1528 sx_dprintk(SX_DEBUG_OPEN, "Block til ready returned %d. Count=%d\n", 1527 sx_dprintk(SX_DEBUG_OPEN, "Block til ready returned %d. Count=%d\n",
1529 retval, port->gs.count); 1528 retval, port->gs.port.count);
1530 1529
1531 if (retval) { 1530 if (retval) {
1532/* 1531/*
1533 * Don't lower gs.count here because sx_close() will be called later 1532 * Don't lower gs.port.count here because sx_close() will be called later
1534 */ 1533 */
1535 1534
1536 return retval; 1535 return retval;
@@ -1571,14 +1570,14 @@ static void sx_close(void *ptr)
1571 } 1570 }
1572 1571
1573 sx_dprintk(SX_DEBUG_CLOSE, "waited %d jiffies for close. count=%d\n", 1572 sx_dprintk(SX_DEBUG_CLOSE, "waited %d jiffies for close. count=%d\n",
1574 5 * HZ - to - 1, port->gs.count); 1573 5 * HZ - to - 1, port->gs.port.count);
1575 1574
1576 if (port->gs.count) { 1575 if (port->gs.port.count) {
1577 sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n", 1576 sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n",
1578 port->gs.count); 1577 port->gs.port.count);
1579 /*printk("%s SETTING port count to zero: %p count: %d\n", 1578 /*printk("%s SETTING port count to zero: %p count: %d\n",
1580 __func__, port, port->gs.count); 1579 __func__, port, port->gs.port.count);
1581 port->gs.count = 0;*/ 1580 port->gs.port.count = 0;*/
1582 } 1581 }
1583 1582
1584 func_exit(); 1583 func_exit();
@@ -1939,7 +1938,7 @@ static void sx_throttle(struct tty_struct *tty)
1939 * control then throttle the port. 1938 * control then throttle the port.
1940 */ 1939 */
1941 if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) { 1940 if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) {
1942 port->gs.flags |= SX_RX_THROTTLE; 1941 port->gs.port.flags |= SX_RX_THROTTLE;
1943 } 1942 }
1944 func_exit(); 1943 func_exit();
1945} 1944}
@@ -1953,7 +1952,7 @@ static void sx_unthrottle(struct tty_struct *tty)
1953 * this port in case we disabled flow control while the port 1952 * this port in case we disabled flow control while the port
1954 * was throttled 1953 * was throttled
1955 */ 1954 */
1956 port->gs.flags &= ~SX_RX_THROTTLE; 1955 port->gs.port.flags &= ~SX_RX_THROTTLE;
1957 func_exit(); 1956 func_exit();
1958 return; 1957 return;
1959} 1958}
@@ -2408,9 +2407,7 @@ static int sx_init_portstructs(int nboards, int nports)
2408 /* 2407 /*
2409 * Initializing wait queue 2408 * Initializing wait queue
2410 */ 2409 */
2411 init_waitqueue_head(&port->gs.open_wait); 2410 tty_port_init(&port->gs.port);
2412 init_waitqueue_head(&port->gs.close_wait);
2413
2414 port++; 2411 port++;
2415 } 2412 }
2416 } 2413 }
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 110833666e37..4cc913939817 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -14,6 +14,7 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/tty.h>
17 18
18struct real_driver { 19struct real_driver {
19 void (*disable_tx_interrupts) (void *); 20 void (*disable_tx_interrupts) (void *);
@@ -33,17 +34,12 @@ struct real_driver {
33 34
34struct gs_port { 35struct gs_port {
35 int magic; 36 int magic;
37 struct tty_port port;
36 unsigned char *xmit_buf; 38 unsigned char *xmit_buf;
37 int xmit_head; 39 int xmit_head;
38 int xmit_tail; 40 int xmit_tail;
39 int xmit_cnt; 41 int xmit_cnt;
40 struct mutex port_write_mutex; 42 struct mutex port_write_mutex;
41 int flags;
42 wait_queue_head_t open_wait;
43 wait_queue_head_t close_wait;
44 int count;
45 int blocked_open;
46 struct tty_struct *tty;
47 unsigned long event; 43 unsigned long event;
48 unsigned short closing_wait; 44 unsigned short closing_wait;
49 int close_delay; 45 int close_delay;