Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ee9cbb3 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds
Browse files

tty_ioctl: locking for tty_wait_until_sent



This function still depends on the big kernel lock in some cases.  Push
locking into the function ready for removal of the BKL from ioctl call paths.

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5d0fdf1e
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>

#include <asm/io.h>
#include <asm/uaccess.h>
@@ -61,12 +62,14 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout)
		return;
	if (!timeout)
		timeout = MAX_SCHEDULE_TIMEOUT;
	lock_kernel();
	if (wait_event_interruptible_timeout(tty->write_wait,
			!tty->driver->chars_in_buffer(tty), timeout) < 0)
		return;
			!tty->driver->chars_in_buffer(tty), timeout) >= 0) {
		if (tty->driver->wait_until_sent)
			tty->driver->wait_until_sent(tty, timeout);
	}
	unlock_kernel();
}
EXPORT_SYMBOL(tty_wait_until_sent);

static void unset_locked_termios(struct ktermios *termios,