summaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/tty_ioctl.c')
-rw-r--r--drivers/tty/tty_ioctl.c49
1 files changed, 14 insertions, 35 deletions
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 6fd60fece6b..62380ccf70f 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -402,7 +402,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
#ifdef BOTHER
/* If the user asked for a precise weird speed give a precise weird
- answer. If they asked for a Bfoo speed they many have problems
+ answer. If they asked for a Bfoo speed they may have problems
digesting non-exact replies so fuzz a bit */
if ((termios->c_cflag & CBAUD) == BOTHER)
@@ -912,35 +912,6 @@ static int set_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars)
#endif
/**
- * send_prio_char - send priority character
- *
- * Send a high priority character to the tty even if stopped
- *
- * Locking: none for xchar method, write ordering for write method.
- */
-
-static int send_prio_char(struct tty_struct *tty, char ch)
-{
- int was_stopped = tty->stopped;
-
- if (tty->ops->send_xchar) {
- tty->ops->send_xchar(tty, ch);
- return 0;
- }
-
- if (tty_write_lock(tty, 0) < 0)
- return -ERESTARTSYS;
-
- if (was_stopped)
- start_tty(tty);
- tty->ops->write(tty, &ch, 1);
- if (was_stopped)
- stop_tty(tty);
- tty_write_unlock(tty);
- return 0;
-}
-
-/**
* tty_change_softcar - carrier change ioctl helper
* @tty: tty to update
* @arg: enable/disable CLOCAL
@@ -1177,29 +1148,37 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
return retval;
switch (arg) {
case TCOOFF:
+ spin_lock_irq(&tty->flow_lock);
if (!tty->flow_stopped) {
tty->flow_stopped = 1;
- stop_tty(tty);
+ __stop_tty(tty);
}
+ spin_unlock_irq(&tty->flow_lock);
break;
case TCOON:
+ spin_lock_irq(&tty->flow_lock);
if (tty->flow_stopped) {
tty->flow_stopped = 0;
- start_tty(tty);
+ __start_tty(tty);
}
+ spin_unlock_irq(&tty->flow_lock);
break;
case TCIOFF:
+ down_read(&tty->termios_rwsem);
if (STOP_CHAR(tty) != __DISABLED_CHAR)
- return send_prio_char(tty, STOP_CHAR(tty));
+ retval = tty_send_xchar(tty, STOP_CHAR(tty));
+ up_read(&tty->termios_rwsem);
break;
case TCION:
+ down_read(&tty->termios_rwsem);
if (START_CHAR(tty) != __DISABLED_CHAR)
- return send_prio_char(tty, START_CHAR(tty));
+ retval = tty_send_xchar(tty, START_CHAR(tty));
+ up_read(&tty->termios_rwsem);
break;
default:
return -EINVAL;
}
- return 0;
+ return retval;
case TCFLSH:
retval = tty_check_change(tty);
if (retval)