Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275784
b: refs/heads/master
c: df92d05
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Nov 17, 2011
1 parent 08256b5 commit 7cfc9b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6edf0c9b1c26d047370cf2f35ff6bb3082243ec3
refs/heads/master: df92d0561de364de53c42abc5d43e04ab6f326a5
11 changes: 6 additions & 5 deletions trunk/drivers/tty/tty_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,15 +547,16 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
/**
* tty_ldisc_wait_idle - wait for the ldisc to become idle
* @tty: tty to wait for
* @timeout: for how long to wait at most
*
* Wait for the line discipline to become idle. The discipline must
* have been halted for this to guarantee it remains idle.
*/
static int tty_ldisc_wait_idle(struct tty_struct *tty)
static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout)
{
int ret;
long ret;
ret = wait_event_timeout(tty_ldisc_idle,
atomic_read(&tty->ldisc->users) == 1, 5 * HZ);
atomic_read(&tty->ldisc->users) == 1, timeout);
if (ret < 0)
return ret;
return ret > 0 ? 0 : -EBUSY;
Expand Down Expand Up @@ -665,7 +666,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)

tty_ldisc_flush_works(tty);

retval = tty_ldisc_wait_idle(tty);
retval = tty_ldisc_wait_idle(tty, 5 * HZ);

tty_lock();
mutex_lock(&tty->ldisc_mutex);
Expand Down Expand Up @@ -762,7 +763,7 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
if (IS_ERR(ld))
return -1;

WARN_ON_ONCE(tty_ldisc_wait_idle(tty));
WARN_ON_ONCE(tty_ldisc_wait_idle(tty, 5 * HZ));

tty_ldisc_close(tty, tty->ldisc);
tty_ldisc_put(tty->ldisc);
Expand Down

0 comments on commit 7cfc9b5

Please sign in to comment.