aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/generic_serial.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-16 16:55:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:12:36 -0400
commitb5391e29f428d11755ca2c91074c6db6f5c69d7c (patch)
treec7d98ff50e5f22569290066ecb33077a7a3165b5 /drivers/char/generic_serial.c
parent4982d6b37a5ccebe6c2af79970c7a15c1939243a (diff)
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>
Diffstat (limited to 'drivers/char/generic_serial.c')
-rw-r--r--drivers/char/generic_serial.c158
1 files changed, 79 insertions, 79 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 ();