Subject: linux-next: manual merge of the tty tree with the tip tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 10 Nov 2014 15:46:21 +1100

Hi Greg,

Today's linux-next merge of the tty tree got a conflict in
drivers/tty/n_tty.c between commit 97d9e28d1a27 ("sched, tty: Deal with
nested sleeps") from the tip tree and commits 1aa1bf111527 ("tty: Fix
missed wakeup from packet mode status update") and 52bce7f8d4fc ("pty,
n_tty: Simplify input processing on final close") from the tty tree.

I fixed it up (I hope - see below) and can carry the fix as necessary
(no action is required).

-- 
Cheers,
Stephen Rothwell                    [email-masked]

diff --cc drivers/tty/n_tty.c
index 26f097f60b10,112eda7c56bc..000000000000
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@@ -2193,46 -2197,30 +2192,30 @@@ static ssize_t n_tty_read(struct tty_st
  
  		if (!input_available_p(tty, 0)) {
  			if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) {
- 				up_read(&tty->termios_rwsem);
- 				tty_flush_to_ldisc(tty);
- 				down_read(&tty->termios_rwsem);
- 				if (!input_available_p(tty, 0)) {
- 					retval = -EIO;
- 					break;
- 				}
- 			} else {
- 				if (tty_hung_up_p(file))
- 					break;
- 				if (!timeout)
- 					break;
- 				if (file->f_flags & O_NONBLOCK) {
- 					retval = -EAGAIN;
- 					break;
- 				}
- 				if (signal_pending(current)) {
- 					retval = -ERESTARTSYS;
- 					break;
- 				}
- 				n_tty_set_room(tty);
- 				up_read(&tty->termios_rwsem);
- 
- 				timeout = wait_woken(&wait, TASK_INTERRUPTIBLE,
- 						     timeout);
- 
- 				down_read(&tty->termios_rwsem);
- 				continue;
+ 				retval = -EIO;
+ 				break;
  			}
- 		}
- 
- 		/* Deal with packet mode. */
- 		if (packet && b == buf) {
- 			if (tty_put_user(tty, TIOCPKT_DATA, b++)) {
- 				retval = -EFAULT;
- 				b--;
+ 			if (tty_hung_up_p(file))
+ 				break;
+ 			if (!timeout)
+ 				break;
+ 			if (file->f_flags & O_NONBLOCK) {
+ 				retval = -EAGAIN;
  				break;
  			}
- 			nr--;
+ 			if (signal_pending(current)) {
+ 				retval = -ERESTARTSYS;
+ 				break;
+ 			}
+ 			n_tty_set_room(tty);
+ 			up_read(&tty->termios_rwsem);
+ 
 -			timeout = schedule_timeout(timeout);
++			timeout = wait_woken(&wait, TASK_INTERRUPTIBLE,
++					     timeout);
+ 
+ 			down_read(&tty->termios_rwsem);
+ 			continue;
  		}
 -		__set_current_state(TASK_RUNNING);
  
  		if (ldata->icanon && !L_EXTPROC(tty)) {
  			retval = canon_copy_from_read_buf(tty, &b, &nr);