Commit b5391e29f428d11755ca2c91074c6db6f5c69d7c
Committed by
Linus Torvalds
1 parent
4982d6b37a
Exists in
master
and in
7 other branches
gs: use tty_port
Switch drivers using the old "generic serial" driver to use the tty_port structures Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 8 changed files with 166 additions and 173 deletions Side-by-side Diff
drivers/char/generic_serial.c
... | ... | @@ -60,7 +60,7 @@ |
60 | 60 | |
61 | 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 | 65 | /* Take a lock on the serial tranmit buffer! */ |
66 | 66 | mutex_lock(& port->port_write_mutex); |
... | ... | @@ -103,7 +103,7 @@ |
103 | 103 | |
104 | 104 | if (!port) return 0; |
105 | 105 | |
106 | - if (! (port->flags & ASYNC_INITIALIZED)) | |
106 | + if (! (port->port.flags & ASYNC_INITIALIZED)) | |
107 | 107 | return 0; |
108 | 108 | |
109 | 109 | /* get exclusive "write" access to this port (problem 3) */ |
110 | 110 | |
... | ... | @@ -141,13 +141,13 @@ |
141 | 141 | mutex_unlock(& port->port_write_mutex); |
142 | 142 | |
143 | 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 | 146 | if (port->xmit_cnt && |
147 | 147 | !tty->stopped && |
148 | 148 | !tty->hw_stopped && |
149 | - !(port->flags & GS_TX_INTEN)) { | |
150 | - port->flags |= GS_TX_INTEN; | |
149 | + !(port->port.flags & GS_TX_INTEN)) { | |
150 | + port->port.flags |= GS_TX_INTEN; | |
151 | 151 | port->rd->enable_tx_interrupts (port); |
152 | 152 | } |
153 | 153 | func_exit (); |
... | ... | @@ -208,7 +208,7 @@ |
208 | 208 | gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port); |
209 | 209 | if (port) { |
210 | 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 | 214 | if (!port || port->xmit_cnt < 0 || !port->xmit_buf) { |
... | ... | @@ -217,7 +217,7 @@ |
217 | 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 | 222 | if(rcib <= 0) { |
223 | 223 | gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n"); |
... | ... | @@ -236,7 +236,7 @@ |
236 | 236 | |
237 | 237 | /* the expression is actually jiffies < end_jiffies, but that won't |
238 | 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 | 240 | time_after (end_jiffies, jiffies)) { |
241 | 241 | /* Units check: |
242 | 242 | chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies! |
... | ... | @@ -309,7 +309,7 @@ |
309 | 309 | } |
310 | 310 | |
311 | 311 | /* Beats me -- REW */ |
312 | - port->flags |= GS_TX_INTEN; | |
312 | + port->port.flags |= GS_TX_INTEN; | |
313 | 313 | port->rd->enable_tx_interrupts (port); |
314 | 314 | func_exit (); |
315 | 315 | } |
... | ... | @@ -329,8 +329,8 @@ |
329 | 329 | |
330 | 330 | if (port->xmit_cnt && |
331 | 331 | port->xmit_buf && |
332 | - (port->flags & GS_TX_INTEN) ) { | |
333 | - port->flags &= ~GS_TX_INTEN; | |
332 | + (port->port.flags & GS_TX_INTEN) ) { | |
333 | + port->port.flags &= ~GS_TX_INTEN; | |
334 | 334 | port->rd->disable_tx_interrupts (port); |
335 | 335 | } |
336 | 336 | func_exit (); |
... | ... | @@ -349,8 +349,8 @@ |
349 | 349 | |
350 | 350 | if (port->xmit_cnt && |
351 | 351 | port->xmit_buf && |
352 | - !(port->flags & GS_TX_INTEN) ) { | |
353 | - port->flags |= GS_TX_INTEN; | |
352 | + !(port->port.flags & GS_TX_INTEN) ) { | |
353 | + port->port.flags |= GS_TX_INTEN; | |
354 | 354 | port->rd->enable_tx_interrupts (port); |
355 | 355 | } |
356 | 356 | func_exit (); |
... | ... | @@ -365,7 +365,7 @@ |
365 | 365 | |
366 | 366 | if (!port) return; |
367 | 367 | |
368 | - if (!(port->flags & ASYNC_INITIALIZED)) | |
368 | + if (!(port->port.flags & ASYNC_INITIALIZED)) | |
369 | 369 | return; |
370 | 370 | |
371 | 371 | spin_lock_irqsave(&port->driver_lock, flags); |
372 | 372 | |
... | ... | @@ -375,12 +375,12 @@ |
375 | 375 | port->xmit_buf = NULL; |
376 | 376 | } |
377 | 377 | |
378 | - if (port->tty) | |
379 | - set_bit(TTY_IO_ERROR, &port->tty->flags); | |
378 | + if (port->port.tty) | |
379 | + set_bit(TTY_IO_ERROR, &port->port.tty->flags); | |
380 | 380 | |
381 | 381 | port->rd->shutdown_port (port); |
382 | 382 | |
383 | - port->flags &= ~ASYNC_INITIALIZED; | |
383 | + port->port.flags &= ~ASYNC_INITIALIZED; | |
384 | 384 | spin_unlock_irqrestore(&port->driver_lock, flags); |
385 | 385 | |
386 | 386 | func_exit(); |
387 | 387 | |
388 | 388 | |
... | ... | @@ -396,16 +396,16 @@ |
396 | 396 | if (!tty) return; |
397 | 397 | |
398 | 398 | port = tty->driver_data; |
399 | - tty = port->tty; | |
399 | + tty = port->port.tty; | |
400 | 400 | if (!tty) |
401 | 401 | return; |
402 | 402 | |
403 | 403 | gs_shutdown_port (port); |
404 | - port->flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE); | |
405 | - port->tty = NULL; | |
406 | - port->count = 0; | |
404 | + port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE); | |
405 | + port->port.tty = NULL; | |
406 | + port->port.count = 0; | |
407 | 407 | |
408 | - wake_up_interruptible(&port->open_wait); | |
408 | + wake_up_interruptible(&port->port.open_wait); | |
409 | 409 | func_exit (); |
410 | 410 | } |
411 | 411 | |
... | ... | @@ -424,7 +424,7 @@ |
424 | 424 | |
425 | 425 | if (!port) return 0; |
426 | 426 | |
427 | - tty = port->tty; | |
427 | + tty = port->port.tty; | |
428 | 428 | |
429 | 429 | if (!tty) return 0; |
430 | 430 | |
... | ... | @@ -433,9 +433,9 @@ |
433 | 433 | * If the device is in the middle of being closed, then block |
434 | 434 | * until it's done, and then try again. |
435 | 435 | */ |
436 | - if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { | |
437 | - interruptible_sleep_on(&port->close_wait); | |
438 | - if (port->flags & ASYNC_HUP_NOTIFY) | |
436 | + if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) { | |
437 | + interruptible_sleep_on(&port->port.close_wait); | |
438 | + if (port->port.flags & ASYNC_HUP_NOTIFY) | |
439 | 439 | return -EAGAIN; |
440 | 440 | else |
441 | 441 | return -ERESTARTSYS; |
... | ... | @@ -449,7 +449,7 @@ |
449 | 449 | */ |
450 | 450 | if ((filp->f_flags & O_NONBLOCK) || |
451 | 451 | (tty->flags & (1 << TTY_IO_ERROR))) { |
452 | - port->flags |= ASYNC_NORMAL_ACTIVE; | |
452 | + port->port.flags |= ASYNC_NORMAL_ACTIVE; | |
453 | 453 | return 0; |
454 | 454 | } |
455 | 455 | |
456 | 456 | |
457 | 457 | |
458 | 458 | |
459 | 459 | |
460 | 460 | |
... | ... | @@ -461,34 +461,34 @@ |
461 | 461 | /* |
462 | 462 | * Block waiting for the carrier detect and the line to become |
463 | 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 | 465 | * rs_close() knows when to free things. We restore it upon |
466 | 466 | * exit, either normal or abnormal. |
467 | 467 | */ |
468 | 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 | 472 | gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n"); |
473 | 473 | spin_lock_irqsave(&port->driver_lock, flags); |
474 | 474 | if (!tty_hung_up_p(filp)) { |
475 | - port->count--; | |
475 | + port->port.count--; | |
476 | 476 | } |
477 | 477 | spin_unlock_irqrestore(&port->driver_lock, flags); |
478 | - port->blocked_open++; | |
478 | + port->port.blocked_open++; | |
479 | 479 | while (1) { |
480 | 480 | CD = port->rd->get_CD (port); |
481 | 481 | gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD); |
482 | 482 | set_current_state (TASK_INTERRUPTIBLE); |
483 | 483 | if (tty_hung_up_p(filp) || |
484 | - !(port->flags & ASYNC_INITIALIZED)) { | |
485 | - if (port->flags & ASYNC_HUP_NOTIFY) | |
484 | + !(port->port.flags & ASYNC_INITIALIZED)) { | |
485 | + if (port->port.flags & ASYNC_HUP_NOTIFY) | |
486 | 486 | retval = -EAGAIN; |
487 | 487 | else |
488 | 488 | retval = -ERESTARTSYS; |
489 | 489 | break; |
490 | 490 | } |
491 | - if (!(port->flags & ASYNC_CLOSING) && | |
491 | + if (!(port->port.flags & ASYNC_CLOSING) && | |
492 | 492 | (do_clocal || CD)) |
493 | 493 | break; |
494 | 494 | gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n", |
495 | 495 | |
496 | 496 | |
497 | 497 | |
498 | 498 | |
... | ... | @@ -500,17 +500,17 @@ |
500 | 500 | schedule(); |
501 | 501 | } |
502 | 502 | gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n", |
503 | - port->blocked_open); | |
503 | + port->port.blocked_open); | |
504 | 504 | set_current_state (TASK_RUNNING); |
505 | - remove_wait_queue(&port->open_wait, &wait); | |
505 | + remove_wait_queue(&port->port.open_wait, &wait); | |
506 | 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 | 510 | if (retval) |
511 | 511 | return retval; |
512 | 512 | |
513 | - port->flags |= ASYNC_NORMAL_ACTIVE; | |
513 | + port->port.flags |= ASYNC_NORMAL_ACTIVE; | |
514 | 514 | func_exit (); |
515 | 515 | return 0; |
516 | 516 | } |
517 | 517 | |
... | ... | @@ -529,10 +529,10 @@ |
529 | 529 | |
530 | 530 | if (!port) return; |
531 | 531 | |
532 | - if (!port->tty) { | |
532 | + if (!port->port.tty) { | |
533 | 533 | /* This seems to happen when this is called from vhangup. */ |
534 | - gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->tty is NULL\n"); | |
535 | - port->tty = tty; | |
534 | + gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->port.tty is NULL\n"); | |
535 | + port->port.tty = tty; | |
536 | 536 | } |
537 | 537 | |
538 | 538 | spin_lock_irqsave(&port->driver_lock, flags); |
539 | 539 | |
540 | 540 | |
541 | 541 | |
542 | 542 | |
... | ... | @@ -545,23 +545,23 @@ |
545 | 545 | return; |
546 | 546 | } |
547 | 547 | |
548 | - if ((tty->count == 1) && (port->count != 1)) { | |
548 | + if ((tty->count == 1) && (port->port.count != 1)) { | |
549 | 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); | |
551 | - port->count = 1; | |
550 | + " tty->count is 1, port count is %d\n", port, port->port.count); | |
551 | + port->port.count = 1; | |
552 | 552 | } |
553 | - if (--port->count < 0) { | |
554 | - printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->count); | |
555 | - 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->port.count); | |
555 | + port->port.count = 0; | |
556 | 556 | } |
557 | 557 | |
558 | - if (port->count) { | |
559 | - gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->count); | |
558 | + if (port->port.count) { | |
559 | + gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->port.count); | |
560 | 560 | spin_unlock_irqrestore(&port->driver_lock, flags); |
561 | 561 | func_exit (); |
562 | 562 | return; |
563 | 563 | } |
564 | - port->flags |= ASYNC_CLOSING; | |
564 | + port->port.flags |= ASYNC_CLOSING; | |
565 | 565 | |
566 | 566 | /* |
567 | 567 | * Now we wait for the transmit buffer to clear; and we notify |
... | ... | @@ -585,7 +585,7 @@ |
585 | 585 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
586 | 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 | 590 | gs_flush_buffer(tty); |
591 | 591 | |
592 | 592 | |
593 | 593 | |
594 | 594 | |
... | ... | @@ -595,18 +595,18 @@ |
595 | 595 | port->event = 0; |
596 | 596 | port->rd->close (port); |
597 | 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 | 601 | if (port->close_delay) { |
602 | 602 | spin_unlock_irqrestore(&port->driver_lock, flags); |
603 | 603 | msleep_interruptible(jiffies_to_msecs(port->close_delay)); |
604 | 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); | |
609 | - wake_up_interruptible(&port->close_wait); | |
608 | + port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED); | |
609 | + wake_up_interruptible(&port->port.close_wait); | |
610 | 610 | |
611 | 611 | func_exit (); |
612 | 612 | } |
613 | 613 | |
... | ... | @@ -626,10 +626,10 @@ |
626 | 626 | port = tty->driver_data; |
627 | 627 | |
628 | 628 | if (!port) return; |
629 | - if (!port->tty) { | |
629 | + if (!port->port.tty) { | |
630 | 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"); | |
632 | - port->tty = tty; | |
631 | + gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->port.tty is NULL\n"); | |
632 | + port->port.tty = tty; | |
633 | 633 | } |
634 | 634 | |
635 | 635 | |
636 | 636 | |
637 | 637 | |
638 | 638 | |
639 | 639 | |
... | ... | @@ -651,15 +651,15 @@ |
651 | 651 | baudrate = tty_get_baud_rate(tty); |
652 | 652 | |
653 | 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 | 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 | 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 | 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 | 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 | 663 | baudrate = (port->baud_base / port->custom_divisor); |
664 | 664 | } |
665 | 665 | |
... | ... | @@ -715,7 +715,7 @@ |
715 | 715 | |
716 | 716 | func_enter (); |
717 | 717 | |
718 | - if (port->flags & ASYNC_INITIALIZED) { | |
718 | + if (port->port.flags & ASYNC_INITIALIZED) { | |
719 | 719 | func_exit (); |
720 | 720 | return 0; |
721 | 721 | } |
722 | 722 | |
723 | 723 | |
... | ... | @@ -737,15 +737,15 @@ |
737 | 737 | } |
738 | 738 | |
739 | 739 | spin_lock_irqsave (&port->driver_lock, flags); |
740 | - if (port->tty) | |
741 | - clear_bit(TTY_IO_ERROR, &port->tty->flags); | |
740 | + if (port->port.tty) | |
741 | + clear_bit(TTY_IO_ERROR, &port->port.tty->flags); | |
742 | 742 | mutex_init(&port->port_write_mutex); |
743 | 743 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
744 | 744 | spin_unlock_irqrestore(&port->driver_lock, flags); |
745 | - gs_set_termios(port->tty, NULL); | |
745 | + gs_set_termios(port->port.tty, NULL); | |
746 | 746 | spin_lock_irqsave (&port->driver_lock, flags); |
747 | - port->flags |= ASYNC_INITIALIZED; | |
748 | - port->flags &= ~GS_TX_INTEN; | |
747 | + port->port.flags |= ASYNC_INITIALIZED; | |
748 | + port->port.flags &= ~GS_TX_INTEN; | |
749 | 749 | |
750 | 750 | spin_unlock_irqrestore(&port->driver_lock, flags); |
751 | 751 | func_exit (); |
752 | 752 | |
... | ... | @@ -764,11 +764,11 @@ |
764 | 764 | if ((sio.baud_base != port->baud_base) || |
765 | 765 | (sio.close_delay != port->close_delay) || |
766 | 766 | ((sio.flags & ~ASYNC_USR_MASK) != |
767 | - (port->flags & ~ASYNC_USR_MASK))) | |
767 | + (port->port.flags & ~ASYNC_USR_MASK))) | |
768 | 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 | 772 | (sio.flags & ASYNC_USR_MASK); |
773 | 773 | |
774 | 774 | port->baud_base = sio.baud_base; |
... | ... | @@ -776,7 +776,7 @@ |
776 | 776 | port->closing_wait = sio.closing_wait; |
777 | 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 | 781 | return 0; |
782 | 782 | } |
... | ... | @@ -793,7 +793,7 @@ |
793 | 793 | struct serial_struct sio; |
794 | 794 | |
795 | 795 | memset(&sio, 0, sizeof(struct serial_struct)); |
796 | - sio.flags = port->flags; | |
796 | + sio.flags = port->port.flags; | |
797 | 797 | sio.baud_base = port->baud_base; |
798 | 798 | sio.close_delay = port->close_delay; |
799 | 799 | sio.closing_wait = port->closing_wait; |
... | ... | @@ -821,10 +821,10 @@ |
821 | 821 | { |
822 | 822 | func_enter (); |
823 | 823 | |
824 | - tty_insert_flip_char(port->tty, 0, TTY_BREAK); | |
825 | - tty_schedule_flip(port->tty); | |
826 | - if (port->flags & ASYNC_SAK) { | |
827 | - do_SAK (port->tty); | |
824 | + tty_insert_flip_char(port->port.tty, 0, TTY_BREAK); | |
825 | + tty_schedule_flip(port->port.tty); | |
826 | + if (port->port.flags & ASYNC_SAK) { | |
827 | + do_SAK (port->port.tty); | |
828 | 828 | } |
829 | 829 | |
830 | 830 | func_exit (); |
drivers/char/rio/rio_linux.c
... | ... | @@ -431,7 +431,7 @@ |
431 | 431 | { |
432 | 432 | func_enter(); |
433 | 433 | |
434 | - /* port->gs.flags &= ~GS_TX_INTEN; */ | |
434 | + /* port->gs.port.flags &= ~GS_TX_INTEN; */ | |
435 | 435 | |
436 | 436 | func_exit(); |
437 | 437 | } |
... | ... | @@ -455,7 +455,7 @@ |
455 | 455 | * In general we cannot count on "tx empty" interrupts, although |
456 | 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 | 460 | func_exit(); |
461 | 461 | } |
... | ... | @@ -510,7 +510,7 @@ |
510 | 510 | func_enter(); |
511 | 511 | |
512 | 512 | PortP = (struct Port *) ptr; |
513 | - PortP->gs.tty = NULL; | |
513 | + PortP->gs.port.tty = NULL; | |
514 | 514 | func_exit(); |
515 | 515 | } |
516 | 516 | |
... | ... | @@ -529,7 +529,7 @@ |
529 | 529 | func_enter(); |
530 | 530 | |
531 | 531 | PortP = (struct Port *) ptr; |
532 | - PortP->gs.tty = NULL; | |
532 | + PortP->gs.port.tty = NULL; | |
533 | 533 | |
534 | 534 | func_exit(); |
535 | 535 | } |
536 | 536 | |
... | ... | @@ -549,12 +549,12 @@ |
549 | 549 | |
550 | 550 | riotclose(ptr); |
551 | 551 | |
552 | - if (PortP->gs.count) { | |
553 | - printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count); | |
554 | - PortP->gs.count = 0; | |
552 | + if (PortP->gs.port.count) { | |
553 | + printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.port.count); | |
554 | + PortP->gs.port.count = 0; | |
555 | 555 | } |
556 | 556 | |
557 | - PortP->gs.tty = NULL; | |
557 | + PortP->gs.port.tty = NULL; | |
558 | 558 | func_exit(); |
559 | 559 | } |
560 | 560 | |
... | ... | @@ -849,8 +849,8 @@ |
849 | 849 | /* |
850 | 850 | * Initializing wait queue |
851 | 851 | */ |
852 | - init_waitqueue_head(&port->gs.open_wait); | |
853 | - init_waitqueue_head(&port->gs.close_wait); | |
852 | + init_waitqueue_head(&port->gs.port.open_wait); | |
853 | + init_waitqueue_head(&port->gs.port.close_wait); | |
854 | 854 | } |
855 | 855 | #else |
856 | 856 | /* We could postpone initializing them to when they are configured. */ |
drivers/char/rio/riocmd.c
... | ... | @@ -484,12 +484,12 @@ |
484 | 484 | ** If the device is a modem, then check the modem |
485 | 485 | ** carrier. |
486 | 486 | */ |
487 | - if (PortP->gs.tty == NULL) | |
487 | + if (PortP->gs.port.tty == NULL) | |
488 | 488 | break; |
489 | - if (PortP->gs.tty->termios == NULL) | |
489 | + if (PortP->gs.port.tty->termios == NULL) | |
490 | 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 | 494 | rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n"); |
495 | 495 | /* |
... | ... | @@ -506,7 +506,7 @@ |
506 | 506 | ** wakeup anyone in WOPEN |
507 | 507 | */ |
508 | 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 | 511 | } else { |
512 | 512 | /* |
... | ... | @@ -514,7 +514,7 @@ |
514 | 514 | */ |
515 | 515 | if (PortP->State & RIO_CARR_ON) { |
516 | 516 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) |
517 | - tty_hangup(PortP->gs.tty); | |
517 | + tty_hangup(PortP->gs.port.tty); | |
518 | 518 | PortP->State &= ~RIO_CARR_ON; |
519 | 519 | rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); |
520 | 520 | } |
drivers/char/rio/riointr.c
... | ... | @@ -102,7 +102,7 @@ |
102 | 102 | |
103 | 103 | PortP = (struct Port *) en; |
104 | 104 | p = (struct rio_info *) PortP->p; |
105 | - tty = PortP->gs.tty; | |
105 | + tty = PortP->gs.port.tty; | |
106 | 106 | |
107 | 107 | |
108 | 108 | rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt); |
... | ... | @@ -158,7 +158,7 @@ |
158 | 158 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
159 | 159 | |
160 | 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 @@ |
241 | 241 | ** find corresponding tty structure. The process of mapping |
242 | 242 | ** the ports puts these here. |
243 | 243 | */ |
244 | - ttyP = PortP->gs.tty; | |
244 | + ttyP = PortP->gs.port.tty; | |
245 | 245 | |
246 | 246 | /* |
247 | 247 | ** Lock the port before we begin working on it. |
... | ... | @@ -335,7 +335,7 @@ |
335 | 335 | ** find corresponding tty structure. The process of mapping |
336 | 336 | ** the ports puts these here. |
337 | 337 | */ |
338 | - ttyP = PortP->gs.tty; | |
338 | + ttyP = PortP->gs.port.tty; | |
339 | 339 | /* If ttyP is NULL, the port is getting closed. Forget about it. */ |
340 | 340 | if (!ttyP) { |
341 | 341 | rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); |
... | ... | @@ -542,7 +542,7 @@ |
542 | 542 | |
543 | 543 | intCount++; |
544 | 544 | |
545 | - TtyP = PortP->gs.tty; | |
545 | + TtyP = PortP->gs.port.tty; | |
546 | 546 | if (!TtyP) { |
547 | 547 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); |
548 | 548 | return; |
drivers/char/rio/rioparam.c
... | ... | @@ -160,7 +160,7 @@ |
160 | 160 | |
161 | 161 | func_enter(); |
162 | 162 | |
163 | - TtyP = PortP->gs.tty; | |
163 | + TtyP = PortP->gs.port.tty; | |
164 | 164 | |
165 | 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 |
drivers/char/rio/riotty.c
... | ... | @@ -140,14 +140,14 @@ |
140 | 140 | |
141 | 141 | tty->driver_data = PortP; |
142 | 142 | |
143 | - PortP->gs.tty = tty; | |
144 | - PortP->gs.count++; | |
143 | + PortP->gs.port.tty = tty; | |
144 | + PortP->gs.port.count++; | |
145 | 145 | |
146 | 146 | rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); |
147 | 147 | |
148 | 148 | retval = gs_init_port(&PortP->gs); |
149 | 149 | if (retval) { |
150 | - PortP->gs.count--; | |
150 | + PortP->gs.port.count--; | |
151 | 151 | return -ENXIO; |
152 | 152 | } |
153 | 153 | /* |
... | ... | @@ -293,7 +293,7 @@ |
293 | 293 | ** insert test for carrier here. -- ??? |
294 | 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 | 297 | (PortP->ModemState & RIOC_MSVR1_CD)) { |
298 | 298 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); |
299 | 299 | /* |
300 | 300 | |
301 | 301 | |
... | ... | @@ -301,16 +301,16 @@ |
301 | 301 | wakeup((caddr_t) &tp->tm.c_canq); |
302 | 302 | */ |
303 | 303 | PortP->State |= RIO_CARR_ON; |
304 | - wake_up_interruptible(&PortP->gs.open_wait); | |
304 | + wake_up_interruptible(&PortP->gs.port.open_wait); | |
305 | 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 | 308 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) |
309 | 309 | */ |
310 | 310 | while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { |
311 | 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 | 315 | PortP->State |= RIO_WOPEN; |
316 | 316 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
... | ... | @@ -380,7 +380,7 @@ |
380 | 380 | /* PortP = p->RIOPortp[SysPort]; */ |
381 | 381 | rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP); |
382 | 382 | /* tp = PortP->TtyP; *//* Get tty */ |
383 | - tty = PortP->gs.tty; | |
383 | + tty = PortP->gs.port.tty; | |
384 | 384 | rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty); |
385 | 385 | |
386 | 386 | if (PortP->gs.closing_wait) |
drivers/char/sx.c
1 | - | |
2 | 1 | /* sx.c -- driver for the Specialix SX series cards. |
3 | 2 | * |
4 | 3 | * This driver will also support the older SI, and XIO cards. |
... | ... | @@ -930,7 +929,7 @@ |
930 | 929 | |
931 | 930 | func_enter2(); |
932 | 931 | |
933 | - if (!port->gs.tty) | |
932 | + if (!port->gs.port.tty) | |
934 | 933 | return 0; |
935 | 934 | |
936 | 935 | /* What is this doing here? -- REW |
937 | 936 | |
938 | 937 | |
... | ... | @@ -941,19 +940,19 @@ |
941 | 940 | |
942 | 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 | 944 | sx_write_channel_byte(port, hi_mr1, |
946 | - (C_PARENB(port->gs.tty) ? MR1_WITH : MR1_NONE) | | |
947 | - (C_PARODD(port->gs.tty) ? MR1_ODD : MR1_EVEN) | | |
948 | - (C_CRTSCTS(port->gs.tty) ? MR1_RTS_RXFLOW : 0) | | |
945 | + (C_PARENB(port->gs.port.tty) ? MR1_WITH : MR1_NONE) | | |
946 | + (C_PARODD(port->gs.port.tty) ? MR1_ODD : MR1_EVEN) | | |
947 | + (C_CRTSCTS(port->gs.port.tty) ? MR1_RTS_RXFLOW : 0) | | |
949 | 948 | (((CFLAG & CSIZE) == CS8) ? MR1_8_BITS : 0) | |
950 | 949 | (((CFLAG & CSIZE) == CS7) ? MR1_7_BITS : 0) | |
951 | 950 | (((CFLAG & CSIZE) == CS6) ? MR1_6_BITS : 0) | |
952 | 951 | (((CFLAG & CSIZE) == CS5) ? MR1_5_BITS : 0)); |
953 | 952 | |
954 | 953 | sx_write_channel_byte(port, hi_mr2, |
955 | - (C_CRTSCTS(port->gs.tty) ? MR2_CTS_TXFLOW : 0) | | |
956 | - (C_CSTOPB(port->gs.tty) ? MR2_2_STOP : | |
954 | + (C_CRTSCTS(port->gs.port.tty) ? MR2_CTS_TXFLOW : 0) | | |
955 | + (C_CSTOPB(port->gs.port.tty) ? MR2_2_STOP : | |
957 | 956 | MR2_1_STOP)); |
958 | 957 | |
959 | 958 | switch (CFLAG & CSIZE) { |
960 | 959 | |
961 | 960 | |
962 | 961 | |
963 | 962 | |
964 | 963 | |
965 | 964 | |
966 | 965 | |
967 | 966 | |
... | ... | @@ -976,44 +975,44 @@ |
976 | 975 | } |
977 | 976 | |
978 | 977 | sx_write_channel_byte(port, hi_prtcl, |
979 | - (I_IXON(port->gs.tty) ? SP_TXEN : 0) | | |
980 | - (I_IXOFF(port->gs.tty) ? SP_RXEN : 0) | | |
981 | - (I_IXANY(port->gs.tty) ? SP_TANY : 0) | SP_DCEN); | |
978 | + (I_IXON(port->gs.port.tty) ? SP_TXEN : 0) | | |
979 | + (I_IXOFF(port->gs.port.tty) ? SP_RXEN : 0) | | |
980 | + (I_IXANY(port->gs.port.tty) ? SP_TANY : 0) | SP_DCEN); | |
982 | 981 | |
983 | 982 | sx_write_channel_byte(port, hi_break, |
984 | - (I_IGNBRK(port->gs.tty) ? BR_IGN : 0 | | |
985 | - I_BRKINT(port->gs.tty) ? BR_INT : 0)); | |
983 | + (I_IGNBRK(port->gs.port.tty) ? BR_IGN : 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)); | |
988 | - sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.tty)); | |
989 | - sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.tty)); | |
990 | - sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.tty)); | |
986 | + sx_write_channel_byte(port, hi_txon, START_CHAR(port->gs.port.tty)); | |
987 | + sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.port.tty)); | |
988 | + sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.port.tty)); | |
989 | + sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.port.tty)); | |
991 | 990 | |
992 | 991 | sx_reconfigure_port(port); |
993 | 992 | |
994 | 993 | /* Tell line discipline whether we will do input cooking */ |
995 | - if (I_OTHER(port->gs.tty)) { | |
996 | - clear_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); | |
994 | + if (I_OTHER(port->gs.port.tty)) { | |
995 | + clear_bit(TTY_HW_COOK_IN, &port->gs.port.tty->flags); | |
997 | 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 | 999 | sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ", |
1001 | - (unsigned int)port->gs.tty->termios->c_iflag, | |
1002 | - I_OTHER(port->gs.tty)); | |
1000 | + (unsigned int)port->gs.port.tty->termios->c_iflag, | |
1001 | + I_OTHER(port->gs.port.tty)); | |
1003 | 1002 | |
1004 | 1003 | /* Tell line discipline whether we will do output cooking. |
1005 | 1004 | * If OPOST is set and no other output flags are set then we can do output |
1006 | 1005 | * processing. Even if only *one* other flag in the O_OTHER group is set |
1007 | 1006 | * we do cooking in software. |
1008 | 1007 | */ |
1009 | - if (O_OPOST(port->gs.tty) && !O_OTHER(port->gs.tty)) { | |
1010 | - set_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); | |
1008 | + if (O_OPOST(port->gs.port.tty) && !O_OTHER(port->gs.port.tty)) { | |
1009 | + set_bit(TTY_HW_COOK_OUT, &port->gs.port.tty->flags); | |
1011 | 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 | 1013 | sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", |
1015 | - (unsigned int)port->gs.tty->termios->c_oflag, | |
1016 | - O_OTHER(port->gs.tty)); | |
1014 | + (unsigned int)port->gs.port.tty->termios->c_oflag, | |
1015 | + O_OTHER(port->gs.port.tty)); | |
1017 | 1016 | /* port->c_dcd = sx_get_CD (port); */ |
1018 | 1017 | func_exit(); |
1019 | 1018 | return 0; |
... | ... | @@ -1102,8 +1101,8 @@ |
1102 | 1101 | sx_disable_tx_interrupts(port); |
1103 | 1102 | } |
1104 | 1103 | |
1105 | - if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { | |
1106 | - tty_wakeup(port->gs.tty); | |
1104 | + if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.port.tty) { | |
1105 | + tty_wakeup(port->gs.port.tty); | |
1107 | 1106 | sx_dprintk(SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n", |
1108 | 1107 | port->gs.wakeup_chars); |
1109 | 1108 | } |
... | ... | @@ -1126,7 +1125,7 @@ |
1126 | 1125 | unsigned char *rp; |
1127 | 1126 | |
1128 | 1127 | func_enter2(); |
1129 | - tty = port->gs.tty; | |
1128 | + tty = port->gs.port.tty; | |
1130 | 1129 | while (1) { |
1131 | 1130 | rx_op = sx_read_channel_byte(port, hi_rxopos); |
1132 | 1131 | c = (sx_read_channel_byte(port, hi_rxipos) - rx_op) & 0xff; |
1133 | 1132 | |
... | ... | @@ -1211,12 +1210,12 @@ |
1211 | 1210 | /* DCD went UP */ |
1212 | 1211 | if ((sx_read_channel_byte(port, hi_hstat) != |
1213 | 1212 | HS_IDLE_CLOSED) && |
1214 | - !(port->gs.tty->termios-> | |
1213 | + !(port->gs.port.tty->termios-> | |
1215 | 1214 | c_cflag & CLOCAL)) { |
1216 | 1215 | /* Are we blocking in open? */ |
1217 | 1216 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1218 | 1217 | "active, unblocking open\n"); |
1219 | - wake_up_interruptible(&port->gs. | |
1218 | + wake_up_interruptible(&port->gs.port. | |
1220 | 1219 | open_wait); |
1221 | 1220 | } else { |
1222 | 1221 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1223 | 1222 | |
... | ... | @@ -1224,10 +1223,10 @@ |
1224 | 1223 | } |
1225 | 1224 | } else { |
1226 | 1225 | /* DCD went down! */ |
1227 | - if (!(port->gs.tty->termios->c_cflag & CLOCAL)){ | |
1226 | + if (!(port->gs.port.tty->termios->c_cflag & CLOCAL)){ | |
1228 | 1227 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1229 | 1228 | "dropped. hanging up....\n"); |
1230 | - tty_hangup(port->gs.tty); | |
1229 | + tty_hangup(port->gs.port.tty); | |
1231 | 1230 | } else { |
1232 | 1231 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1233 | 1232 | "dropped. ignoring.\n"); |
... | ... | @@ -1325,7 +1324,7 @@ |
1325 | 1324 | |
1326 | 1325 | for (i = 0; i < board->nports; i++) { |
1327 | 1326 | port = &board->ports[i]; |
1328 | - if (port->gs.flags & GS_ACTIVE) { | |
1327 | + if (port->gs.port.flags & GS_ACTIVE) { | |
1329 | 1328 | if (sx_read_channel_byte(port, hi_state)) { |
1330 | 1329 | sx_dprintk(SX_DEBUG_INTERRUPTS, "Port %d: " |
1331 | 1330 | "modem signal change?... \n",i); |
... | ... | @@ -1334,7 +1333,7 @@ |
1334 | 1333 | if (port->gs.xmit_cnt) { |
1335 | 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 | 1337 | sx_receive_chars(port); |
1339 | 1338 | } |
1340 | 1339 | } |
... | ... | @@ -1373,7 +1372,7 @@ |
1373 | 1372 | struct sx_port *port = ptr; |
1374 | 1373 | func_enter2(); |
1375 | 1374 | |
1376 | - port->gs.flags &= ~GS_TX_INTEN; | |
1375 | + port->gs.port.flags &= ~GS_TX_INTEN; | |
1377 | 1376 | |
1378 | 1377 | func_exit(); |
1379 | 1378 | } |
... | ... | @@ -1394,7 +1393,7 @@ |
1394 | 1393 | |
1395 | 1394 | /* XXX Must be "HIGH_WATER" for SI card according to doc. */ |
1396 | 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 | 1398 | func_exit(); |
1400 | 1399 | } |
... | ... | @@ -1442,8 +1441,8 @@ |
1442 | 1441 | |
1443 | 1442 | func_enter(); |
1444 | 1443 | |
1445 | - port->gs.flags &= ~GS_ACTIVE; | |
1446 | - if (port->gs.tty && (port->gs.tty->termios->c_cflag & HUPCL)) { | |
1444 | + port->gs.port.flags &= ~GS_ACTIVE; | |
1445 | + if (port->gs.port.tty && (port->gs.port.tty->termios->c_cflag & HUPCL)) { | |
1447 | 1446 | sx_setsignals(port, 0, 0); |
1448 | 1447 | sx_reconfigure_port(port); |
1449 | 1448 | } |
... | ... | @@ -1485,8 +1484,8 @@ |
1485 | 1484 | spin_lock_irqsave(&port->gs.driver_lock, flags); |
1486 | 1485 | |
1487 | 1486 | tty->driver_data = port; |
1488 | - port->gs.tty = tty; | |
1489 | - port->gs.count++; | |
1487 | + port->gs.port.tty = tty; | |
1488 | + port->gs.port.count++; | |
1490 | 1489 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); |
1491 | 1490 | |
1492 | 1491 | sx_dprintk(SX_DEBUG_OPEN, "starting port\n"); |
1493 | 1492 | |
... | ... | @@ -1497,12 +1496,12 @@ |
1497 | 1496 | retval = gs_init_port(&port->gs); |
1498 | 1497 | sx_dprintk(SX_DEBUG_OPEN, "done gs_init\n"); |
1499 | 1498 | if (retval) { |
1500 | - port->gs.count--; | |
1499 | + port->gs.port.count--; | |
1501 | 1500 | return retval; |
1502 | 1501 | } |
1503 | 1502 | |
1504 | - port->gs.flags |= GS_ACTIVE; | |
1505 | - if (port->gs.count <= 1) | |
1503 | + port->gs.port.flags |= GS_ACTIVE; | |
1504 | + if (port->gs.port.count <= 1) | |
1506 | 1505 | sx_setsignals(port, 1, 1); |
1507 | 1506 | |
1508 | 1507 | #if 0 |
1509 | 1508 | |
... | ... | @@ -1513,12 +1512,12 @@ |
1513 | 1512 | my_hd_io(port->board->base + port->ch_base, sizeof(*port)); |
1514 | 1513 | #endif |
1515 | 1514 | |
1516 | - if (port->gs.count <= 1) { | |
1515 | + if (port->gs.port.count <= 1) { | |
1517 | 1516 | if (sx_send_command(port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) { |
1518 | 1517 | printk(KERN_ERR "sx: Card didn't respond to LOPEN " |
1519 | 1518 | "command.\n"); |
1520 | 1519 | spin_lock_irqsave(&port->gs.driver_lock, flags); |
1521 | - port->gs.count--; | |
1520 | + port->gs.port.count--; | |
1522 | 1521 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); |
1523 | 1522 | return -EIO; |
1524 | 1523 | } |
1525 | 1524 | |
... | ... | @@ -1526,11 +1525,11 @@ |
1526 | 1525 | |
1527 | 1526 | retval = gs_block_til_ready(port, filp); |
1528 | 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 | 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 | 1535 | return retval; |
1537 | 1536 | |
1538 | 1537 | |
1539 | 1538 | |
... | ... | @@ -1571,14 +1570,14 @@ |
1571 | 1570 | } |
1572 | 1571 | |
1573 | 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 | 1576 | sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n", |
1578 | - port->gs.count); | |
1577 | + port->gs.port.count); | |
1579 | 1578 | /*printk("%s SETTING port count to zero: %p count: %d\n", |
1580 | - __func__, port, port->gs.count); | |
1581 | - port->gs.count = 0;*/ | |
1579 | + __func__, port, port->gs.port.count); | |
1580 | + port->gs.port.count = 0;*/ | |
1582 | 1581 | } |
1583 | 1582 | |
1584 | 1583 | func_exit(); |
... | ... | @@ -1939,7 +1938,7 @@ |
1939 | 1938 | * control then throttle the port. |
1940 | 1939 | */ |
1941 | 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 | 1943 | func_exit(); |
1945 | 1944 | } |
... | ... | @@ -1953,7 +1952,7 @@ |
1953 | 1952 | * this port in case we disabled flow control while the port |
1954 | 1953 | * was throttled |
1955 | 1954 | */ |
1956 | - port->gs.flags &= ~SX_RX_THROTTLE; | |
1955 | + port->gs.port.flags &= ~SX_RX_THROTTLE; | |
1957 | 1956 | func_exit(); |
1958 | 1957 | return; |
1959 | 1958 | } |
... | ... | @@ -2408,9 +2407,7 @@ |
2408 | 2407 | /* |
2409 | 2408 | * Initializing wait queue |
2410 | 2409 | */ |
2411 | - init_waitqueue_head(&port->gs.open_wait); | |
2412 | - init_waitqueue_head(&port->gs.close_wait); | |
2413 | - | |
2410 | + tty_port_init(&port->gs.port); | |
2414 | 2411 | port++; |
2415 | 2412 | } |
2416 | 2413 | } |
include/linux/generic_serial.h
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | |
15 | 15 | #ifdef __KERNEL__ |
16 | 16 | #include <linux/mutex.h> |
17 | +#include <linux/tty.h> | |
17 | 18 | |
18 | 19 | struct real_driver { |
19 | 20 | void (*disable_tx_interrupts) (void *); |
20 | 21 | |
... | ... | @@ -33,17 +34,12 @@ |
33 | 34 | |
34 | 35 | struct gs_port { |
35 | 36 | int magic; |
37 | + struct tty_port port; | |
36 | 38 | unsigned char *xmit_buf; |
37 | 39 | int xmit_head; |
38 | 40 | int xmit_tail; |
39 | 41 | int xmit_cnt; |
40 | 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 | 43 | unsigned long event; |
48 | 44 | unsigned short closing_wait; |
49 | 45 | int close_delay; |