tty: Remove tty_hung_up_p() tests from tty drivers' open()
[firefly-linux-kernel-4.4.55.git] / drivers / tty / synclink.c
index d48e040cd8c5d5abc86fa77c99347899ed901b4b..b7991707ffc0a52589a487d080595c3742ef1294 100644 (file)
@@ -3267,7 +3267,6 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
        DECLARE_WAITQUEUE(wait, current);
        int             retval;
        bool            do_clocal = false;
-       bool            extra_count = false;
        unsigned long   flags;
        int             dcd;
        struct tty_port *port = &info->port;
@@ -3300,10 +3299,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                         __FILE__,__LINE__, tty->driver->name, port->count );
 
        spin_lock_irqsave(&info->irq_spinlock, flags);
-       if (!tty_hung_up_p(filp)) {
-               extra_count = true;
-               port->count--;
-       }
+       port->count--;
        spin_unlock_irqrestore(&info->irq_spinlock, flags);
        port->blocked_open++;
        
@@ -3342,7 +3338,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
        remove_wait_queue(&port->open_wait, &wait);
        
        /* FIXME: Racy on hangup during close wait */
-       if (extra_count)
+       if (!tty_hung_up_p(filp))
                port->count++;
        port->blocked_open--;
        
@@ -3403,7 +3399,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
                         __FILE__,__LINE__,tty->driver->name, info->port.count);
 
        /* If port is closing, signal caller to try again */
-       if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){
+       if (info->port.flags & ASYNC_CLOSING){
                wait_event_interruptible_tty(tty, info->port.close_wait,
                                     !(info->port.flags & ASYNC_CLOSING));
                retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ?