diff options
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r-- | drivers/char/synclinkmp.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 8da976bd7314..ac447c7eb572 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -812,13 +812,15 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
812 | 812 | ||
813 | if (tty_port_close_start(&info->port, tty, filp) == 0) | 813 | if (tty_port_close_start(&info->port, tty, filp) == 0) |
814 | goto cleanup; | 814 | goto cleanup; |
815 | 815 | ||
816 | mutex_lock(&info->port.mutex); | ||
816 | if (info->port.flags & ASYNC_INITIALIZED) | 817 | if (info->port.flags & ASYNC_INITIALIZED) |
817 | wait_until_sent(tty, info->timeout); | 818 | wait_until_sent(tty, info->timeout); |
818 | 819 | ||
819 | flush_buffer(tty); | 820 | flush_buffer(tty); |
820 | tty_ldisc_flush(tty); | 821 | tty_ldisc_flush(tty); |
821 | shutdown(info); | 822 | shutdown(info); |
823 | mutex_unlock(&info->port.mutex); | ||
822 | 824 | ||
823 | tty_port_close_end(&info->port, tty); | 825 | tty_port_close_end(&info->port, tty); |
824 | info->port.tty = NULL; | 826 | info->port.tty = NULL; |
@@ -834,6 +836,7 @@ cleanup: | |||
834 | static void hangup(struct tty_struct *tty) | 836 | static void hangup(struct tty_struct *tty) |
835 | { | 837 | { |
836 | SLMP_INFO *info = tty->driver_data; | 838 | SLMP_INFO *info = tty->driver_data; |
839 | unsigned long flags; | ||
837 | 840 | ||
838 | if (debug_level >= DEBUG_LEVEL_INFO) | 841 | if (debug_level >= DEBUG_LEVEL_INFO) |
839 | printk("%s(%d):%s hangup()\n", | 842 | printk("%s(%d):%s hangup()\n", |
@@ -842,12 +845,16 @@ static void hangup(struct tty_struct *tty) | |||
842 | if (sanity_check(info, tty->name, "hangup")) | 845 | if (sanity_check(info, tty->name, "hangup")) |
843 | return; | 846 | return; |
844 | 847 | ||
848 | mutex_lock(&info->port.mutex); | ||
845 | flush_buffer(tty); | 849 | flush_buffer(tty); |
846 | shutdown(info); | 850 | shutdown(info); |
847 | 851 | ||
852 | spin_lock_irqsave(&info->port.lock, flags); | ||
848 | info->port.count = 0; | 853 | info->port.count = 0; |
849 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; | 854 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
850 | info->port.tty = NULL; | 855 | info->port.tty = NULL; |
856 | spin_unlock_irqrestore(&info->port.lock, flags); | ||
857 | mutex_unlock(&info->port.mutex); | ||
851 | 858 | ||
852 | wake_up_interruptible(&info->port.open_wait); | 859 | wake_up_interruptible(&info->port.open_wait); |
853 | } | 860 | } |