[RFC 6/9] tty: never hold tty_lock() while getting tty_mutex

From: Arnd Bergmann
Date: Tue Mar 30 2010 - 16:58:11 EST


From: Arnd Bergmann <arnd@xxxxxxxxxxxxxxxx>

This avoids having to annotate every mutex_lock(&tty_mutex)
as mutex_lock_tty.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
drivers/char/pty.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 72fb501..0a87b52 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -638,9 +638,11 @@ static int __ptmx_open(struct inode *inode, struct file *filp)
if (index < 0)
return index;

+ tty_unlock();
mutex_lock(&tty_mutex);
tty = tty_init_dev(ptm_driver, index, 1);
mutex_unlock(&tty_mutex);
+ tty_lock();

if (IS_ERR(tty)) {
retval = PTR_ERR(tty);
--
1.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/