diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2014-10-16 21:33:25 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-06 01:34:36 +0100 |
commit | 6054c16e80318d32ee084a0f5620a863ae8cea33 (patch) | |
tree | ad3c3d6cbcc440714a529d772ca6be940b6acbbc /drivers/tty/pty.c | |
parent | pty: Use spin_lock_irq() for pty_set_termios() (diff) | |
download | linux-6054c16e80318d32ee084a0f5620a863ae8cea33.tar.xz linux-6054c16e80318d32ee084a0f5620a863ae8cea33.zip |
tty: Use spin_lock_irq() for ctrl_lock when interrupts enabled
Interrupts are enabled in the n_tty_read() loop, ioctl(TIOCPKT)
and pty driver flush_buffer() routine; no need to save and restore
local interrupt state.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 394374789292..29b5eeb01856 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -178,13 +178,12 @@ static int pty_get_lock(struct tty_struct *tty, int __user *arg) /* Set the packet mode on a pty */ static int pty_set_pktmode(struct tty_struct *tty, int __user *arg) { - unsigned long flags; int pktmode; if (get_user(pktmode, arg)) return -EFAULT; - spin_lock_irqsave(&tty->ctrl_lock, flags); + spin_lock_irq(&tty->ctrl_lock); if (pktmode) { if (!tty->packet) { tty->packet = 1; @@ -192,7 +191,7 @@ static int pty_set_pktmode(struct tty_struct *tty, int __user *arg) } } else tty->packet = 0; - spin_unlock_irqrestore(&tty->ctrl_lock, flags); + spin_unlock_irq(&tty->ctrl_lock); return 0; } @@ -221,16 +220,15 @@ static int pty_signal(struct tty_struct *tty, int sig) static void pty_flush_buffer(struct tty_struct *tty) { struct tty_struct *to = tty->link; - unsigned long flags; if (!to) return; /* tty_buffer_flush(to); FIXME */ if (to->packet) { - spin_lock_irqsave(&tty->ctrl_lock, flags); + spin_lock_irq(&tty->ctrl_lock); tty->ctrl_status |= TIOCPKT_FLUSHWRITE; wake_up_interruptible(&to->read_wait); - spin_unlock_irqrestore(&tty->ctrl_lock, flags); + spin_unlock_irq(&tty->ctrl_lock); } } |