From cf54a5af68a371d83b0aa0e4c14fc01dc4f09c45 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 2 Oct 2004 01:46:35 -0700 Subject: [PATCH] Update termios to use per tty semaphore This makes the agreed change of termios locking to be semaphore based sleep locking. This is needed for USB in particular as it has to use messaging to issue terminal mode changes. This code passes Torvalds test grades 0, 1 and 2 (it looks ok, it compiles and it booted). It does mean that a driver cannot take an atomic peek at termios data during an interrupt. Nobody seems to be doing this although some of the driver receive paths for line disciplines will eventually want to (n_tty currently doesn't do this locked on the receive path). Since the ldisc is given a chance to copy any essential bits on the ->set_termios path this seems not to be a problem. --- include/linux/tty.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/tty.h b/include/linux/tty.h index 24b4a7383b53..f9fd14991956 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -244,6 +244,7 @@ struct tty_struct { struct tty_driver *driver; int index; struct tty_ldisc ldisc; + struct semaphore termios_sem; struct termios *termios, *termios_locked; char name[64]; int pgrp; -- cgit v1.2.3