Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309607
b: refs/heads/master
c: fde86d3
h: refs/heads/master
i:
  309605: 39f8d65
  309603: dbabaf2
  309599: 5f4b9ff
v: v3
  • Loading branch information
Eric Dumazet authored and Linus Torvalds committed May 31, 2012
1 parent 097c774 commit 9563dc5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1d59d61f606547f0712aa6971f91f71154071c99
refs/heads/master: fde86d310886372a377213251e72fb87aaa406c9
19 changes: 15 additions & 4 deletions trunk/drivers/tty/tty_mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,30 @@

/* Legacy tty mutex glue */

enum {
TTY_MUTEX_NORMAL,
TTY_MUTEX_NESTED,
};

/*
* Getting the big tty mutex.
*/

void __lockfunc tty_lock(struct tty_struct *tty)
static void __lockfunc tty_lock_nested(struct tty_struct *tty,
unsigned int subclass)
{
if (tty->magic != TTY_MAGIC) {
printk(KERN_ERR "L Bad %p\n", tty);
WARN_ON(1);
return;
}
tty_kref_get(tty);
mutex_lock(&tty->legacy_mutex);
mutex_lock_nested(&tty->legacy_mutex, subclass);
}

void __lockfunc tty_lock(struct tty_struct *tty)
{
return tty_lock_nested(tty, TTY_MUTEX_NORMAL);
}
EXPORT_SYMBOL(tty_lock);

Expand All @@ -43,11 +54,11 @@ void __lockfunc tty_lock_pair(struct tty_struct *tty,
{
if (tty < tty2) {
tty_lock(tty);
tty_lock(tty2);
tty_lock_nested(tty2, TTY_MUTEX_NESTED);
} else {
if (tty2 && tty2 != tty)
tty_lock(tty2);
tty_lock(tty);
tty_lock_nested(tty, TTY_MUTEX_NESTED);
}
}
EXPORT_SYMBOL(tty_lock_pair);
Expand Down

0 comments on commit 9563dc5

Please sign in to comment.