tty: Remove tty_hung_up_p() tests from tty drivers' open()
[firefly-linux-kernel-4.4.55.git] / drivers / tty / serial / crisv10.c
index d567ac5d3af4dcc5a0b8411fef6fab8a7e0d51a9..58e6f61a87e4fe5a747a3f0777446ee702621a73 100644 (file)
@@ -3831,14 +3831,13 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
        DECLARE_WAITQUEUE(wait, current);
        unsigned long   flags;
        int             retval;
-       int             do_clocal = 0, extra_count = 0;
+       int             do_clocal = 0;
 
        /*
         * If the device is in the middle of being closed, then block
         * until it's done, and then 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));
 #ifdef SERIAL_DO_RESTART
@@ -3879,10 +3878,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
               info->line, info->port.count);
 #endif
        local_irq_save(flags);
-       if (!tty_hung_up_p(filp)) {
-               extra_count++;
-               info->port.count--;
-       }
+       info->port.count--;
        local_irq_restore(flags);
        info->port.blocked_open++;
        while (1) {
@@ -3921,7 +3917,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
        }
        set_current_state(TASK_RUNNING);
        remove_wait_queue(&info->port.open_wait, &wait);
-       if (extra_count)
+       if (!tty_hung_up_p(filp))
                info->port.count++;
        info->port.blocked_open--;
 #ifdef SERIAL_DEBUG_OPEN
@@ -3976,8 +3972,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
        /*
         * If the port is in the middle of closing, bail out now
         */
-       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));
 #ifdef SERIAL_DO_RESTART