summaryrefslogtreecommitdiff
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-09-29 02:00:43 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 09:18:16 -0700
commit5785c95baede8459d70c4aa0f7becb6e8b5fde4b (patch)
tree17744eac694b4eab81cba4db28c4e083d779b753 /drivers/char/tty_io.c
parent54306cf04c0ea0a8c432603dbc657ab62a438668 (diff)
downloadlwn-5785c95baede8459d70c4aa0f7becb6e8b5fde4b.tar.gz
lwn-5785c95baede8459d70c4aa0f7becb6e8b5fde4b.zip
[PATCH] tty: make termios_sem a mutex
[akpm@osdl.org: fix] Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r--drivers/char/tty_io.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index b4f37c65b95c..142427c6e8f3 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -618,9 +618,9 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags);
static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
{
- down(&tty->termios_sem);
+ mutex_lock(&tty->termios_mutex);
tty->termios->c_line = num;
- up(&tty->termios_sem);
+ mutex_unlock(&tty->termios_mutex);
}
/*
@@ -1338,9 +1338,9 @@ static void do_tty_hangup(void *data)
*/
if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS)
{
- down(&tty->termios_sem);
+ mutex_lock(&tty->termios_mutex);
*tty->termios = tty->driver->init_termios;
- up(&tty->termios_sem);
+ mutex_unlock(&tty->termios_mutex);
}
/* Defer ldisc switch */
@@ -2750,9 +2750,9 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg)
{
int err;
- down(&tty->termios_sem);
+ mutex_lock(&tty->termios_mutex);
err = copy_to_user(arg, &tty->winsize, sizeof(*arg));
- up(&tty->termios_sem);
+ mutex_unlock(&tty->termios_mutex);
return err ? -EFAULT: 0;
}
@@ -2782,14 +2782,15 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
if (copy_from_user(&tmp_ws, arg, sizeof(*arg)))
return -EFAULT;
- down(&tty->termios_sem);
+ mutex_lock(&tty->termios_mutex);
if (!memcmp(&tmp_ws, &tty->winsize, sizeof(*arg)))
goto done;
#ifdef CONFIG_VT
if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) {
- if (vc_lock_resize(tty->driver_data, tmp_ws.ws_col, tmp_ws.ws_row)) {
- up(&tty->termios_sem);
+ if (vc_lock_resize(tty->driver_data, tmp_ws.ws_col,
+ tmp_ws.ws_row)) {
+ mutex_unlock(&tty->termios_mutex);
return -ENXIO;
}
}
@@ -2801,7 +2802,7 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
tty->winsize = tmp_ws;
real_tty->winsize = tmp_ws;
done:
- up(&tty->termios_sem);
+ mutex_unlock(&tty->termios_mutex);
return 0;
}
@@ -3576,7 +3577,7 @@ static void initialize_tty_struct(struct tty_struct *tty)
tty_buffer_init(tty);
INIT_WORK(&tty->buf.work, flush_to_ldisc, tty);
init_MUTEX(&tty->buf.pty_sem);
- init_MUTEX(&tty->termios_sem);
+ mutex_init(&tty->termios_mutex);
init_waitqueue_head(&tty->write_wait);
init_waitqueue_head(&tty->read_wait);
INIT_WORK(&tty->hangup_work, do_tty_hangup, tty);