diff options
Diffstat (limited to 'drivers/char/stallion.c')
-rw-r--r-- | drivers/char/stallion.c | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 77eef61c46f3..e1e0dd89ac9a 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -833,40 +833,20 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
833 | pr_debug("stl_close(tty=%p,filp=%p)\n", tty, filp); | 833 | pr_debug("stl_close(tty=%p,filp=%p)\n", tty, filp); |
834 | 834 | ||
835 | portp = tty->driver_data; | 835 | portp = tty->driver_data; |
836 | if (portp == NULL) | 836 | BUG_ON(portp == NULL); |
837 | return; | 837 | |
838 | port = &portp->port; | 838 | port = &portp->port; |
839 | 839 | ||
840 | spin_lock_irqsave(&port->lock, flags); | 840 | if (tty_port_close_start(port, tty, filp) == 0) |
841 | if (tty_hung_up_p(filp)) { | ||
842 | spin_unlock_irqrestore(&port->lock, flags); | ||
843 | return; | 841 | return; |
844 | } | ||
845 | if (tty->count == 1 && port->count != 1) | ||
846 | port->count = 1; | ||
847 | if (port->count-- > 1) { | ||
848 | spin_unlock_irqrestore(&port->lock, flags); | ||
849 | return; | ||
850 | } | ||
851 | |||
852 | port->count = 0; | ||
853 | port->flags |= ASYNC_CLOSING; | ||
854 | |||
855 | /* | 842 | /* |
856 | * May want to wait for any data to drain before closing. The BUSY | 843 | * May want to wait for any data to drain before closing. The BUSY |
857 | * flag keeps track of whether we are still sending or not - it is | 844 | * flag keeps track of whether we are still sending or not - it is |
858 | * very accurate for the cd1400, not quite so for the sc26198. | 845 | * very accurate for the cd1400, not quite so for the sc26198. |
859 | * (The sc26198 has no "end-of-data" interrupt only empty FIFO) | 846 | * (The sc26198 has no "end-of-data" interrupt only empty FIFO) |
860 | */ | 847 | */ |
861 | tty->closing = 1; | ||
862 | |||
863 | spin_unlock_irqrestore(&port->lock, flags); | ||
864 | |||
865 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) | ||
866 | tty_wait_until_sent(tty, portp->closing_wait); | ||
867 | stl_waituntilsent(tty, (HZ / 2)); | 848 | stl_waituntilsent(tty, (HZ / 2)); |
868 | 849 | ||
869 | |||
870 | spin_lock_irqsave(&port->lock, flags); | 850 | spin_lock_irqsave(&port->lock, flags); |
871 | portp->port.flags &= ~ASYNC_INITIALIZED; | 851 | portp->port.flags &= ~ASYNC_INITIALIZED; |
872 | spin_unlock_irqrestore(&port->lock, flags); | 852 | spin_unlock_irqrestore(&port->lock, flags); |
@@ -883,20 +863,9 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
883 | portp->tx.head = NULL; | 863 | portp->tx.head = NULL; |
884 | portp->tx.tail = NULL; | 864 | portp->tx.tail = NULL; |
885 | } | 865 | } |
886 | set_bit(TTY_IO_ERROR, &tty->flags); | ||
887 | tty_ldisc_flush(tty); | ||
888 | 866 | ||
889 | tty->closing = 0; | 867 | tty_port_close_end(port, tty); |
890 | tty_port_tty_set(port, NULL); | 868 | tty_port_tty_set(port, NULL); |
891 | |||
892 | if (port->blocked_open) { | ||
893 | if (portp->close_delay) | ||
894 | msleep_interruptible(jiffies_to_msecs(portp->close_delay)); | ||
895 | wake_up_interruptible(&portp->port.open_wait); | ||
896 | } | ||
897 | |||
898 | portp->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | ||
899 | wake_up_interruptible(&port->close_wait); | ||
900 | } | 869 | } |
901 | 870 | ||
902 | /*****************************************************************************/ | 871 | /*****************************************************************************/ |