tty: Remove tty_hung_up_p() tests from tty drivers' open()
[firefly-linux-kernel-4.4.55.git] / drivers / tty / synclink.c
index 5ae14b46cce0709aab95904ca0082ac3a29f7d7a..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) ?
@@ -7866,6 +7862,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                                              HDLC_FLAG_TXC_TXCPIN | HDLC_FLAG_TXC_DPLL |
                                              HDLC_FLAG_TXC_BRG    | HDLC_FLAG_TXC_RXCPIN);
 
+               memset(&new_line, 0, sizeof(new_line));
                switch (flags){
                case (HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_TXC_TXCPIN): new_line.clock_type = CLOCK_EXT; break;
                case (HDLC_FLAG_RXC_BRG    | HDLC_FLAG_TXC_BRG):    new_line.clock_type = CLOCK_INT; break;