diff options
-rw-r--r-- | drivers/tty/tty_ldisc.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 1dbe27824220..6368dd95e137 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -393,16 +393,6 @@ static void __lockfunc tty_ldisc_unlock_pair(struct tty_struct *tty, | |||
393 | __tty_ldisc_unlock(tty2); | 393 | __tty_ldisc_unlock(tty2); |
394 | } | 394 | } |
395 | 395 | ||
396 | static void __lockfunc tty_ldisc_enable_pair(struct tty_struct *tty, | ||
397 | struct tty_struct *tty2) | ||
398 | { | ||
399 | clear_bit(TTY_LDISC_HALTED, &tty->flags); | ||
400 | if (tty2) | ||
401 | clear_bit(TTY_LDISC_HALTED, &tty2->flags); | ||
402 | |||
403 | tty_ldisc_unlock_pair(tty, tty2); | ||
404 | } | ||
405 | |||
406 | /** | 396 | /** |
407 | * tty_ldisc_flush - flush line discipline queue | 397 | * tty_ldisc_flush - flush line discipline queue |
408 | * @tty: tty | 398 | * @tty: tty |
@@ -535,14 +525,13 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
535 | { | 525 | { |
536 | int retval; | 526 | int retval; |
537 | struct tty_ldisc *old_ldisc, *new_ldisc; | 527 | struct tty_ldisc *old_ldisc, *new_ldisc; |
538 | struct tty_struct *o_tty = tty->link; | ||
539 | 528 | ||
540 | new_ldisc = tty_ldisc_get(tty, ldisc); | 529 | new_ldisc = tty_ldisc_get(tty, ldisc); |
541 | if (IS_ERR(new_ldisc)) | 530 | if (IS_ERR(new_ldisc)) |
542 | return PTR_ERR(new_ldisc); | 531 | return PTR_ERR(new_ldisc); |
543 | 532 | ||
544 | tty_lock(tty); | 533 | tty_lock(tty); |
545 | retval = tty_ldisc_lock_pair_timeout(tty, o_tty, 5 * HZ); | 534 | retval = tty_ldisc_lock(tty, 5 * HZ); |
546 | if (retval) { | 535 | if (retval) { |
547 | tty_ldisc_put(new_ldisc); | 536 | tty_ldisc_put(new_ldisc); |
548 | tty_unlock(tty); | 537 | tty_unlock(tty); |
@@ -554,7 +543,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
554 | */ | 543 | */ |
555 | 544 | ||
556 | if (tty->ldisc->ops->num == ldisc) { | 545 | if (tty->ldisc->ops->num == ldisc) { |
557 | tty_ldisc_enable_pair(tty, o_tty); | 546 | tty_ldisc_unlock(tty); |
558 | tty_ldisc_put(new_ldisc); | 547 | tty_ldisc_put(new_ldisc); |
559 | tty_unlock(tty); | 548 | tty_unlock(tty); |
560 | return 0; | 549 | return 0; |
@@ -565,7 +554,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
565 | if (test_bit(TTY_HUPPED, &tty->flags)) { | 554 | if (test_bit(TTY_HUPPED, &tty->flags)) { |
566 | /* We were raced by the hangup method. It will have stomped | 555 | /* We were raced by the hangup method. It will have stomped |
567 | the ldisc data and closed the ldisc down */ | 556 | the ldisc data and closed the ldisc down */ |
568 | tty_ldisc_enable_pair(tty, o_tty); | 557 | tty_ldisc_unlock(tty); |
569 | tty_ldisc_put(new_ldisc); | 558 | tty_ldisc_put(new_ldisc); |
570 | tty_unlock(tty); | 559 | tty_unlock(tty); |
571 | return -EIO; | 560 | return -EIO; |
@@ -599,13 +588,11 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
599 | /* | 588 | /* |
600 | * Allow ldisc referencing to occur again | 589 | * Allow ldisc referencing to occur again |
601 | */ | 590 | */ |
602 | tty_ldisc_enable_pair(tty, o_tty); | 591 | tty_ldisc_unlock(tty); |
603 | 592 | ||
604 | /* Restart the work queue in case no characters kick it off. Safe if | 593 | /* Restart the work queue in case no characters kick it off. Safe if |
605 | already running */ | 594 | already running */ |
606 | schedule_work(&tty->port->buf.work); | 595 | schedule_work(&tty->port->buf.work); |
607 | if (o_tty) | ||
608 | schedule_work(&o_tty->port->buf.work); | ||
609 | 596 | ||
610 | tty_unlock(tty); | 597 | tty_unlock(tty); |
611 | return retval; | 598 | return retval; |