tty_lock: Localise the lock
In each remaining case the tty_lock is associated with a specific tty. This means we can now lock on a per tty basis. We do need tty_lock_pair() for the pty case. Uglier but still a step in the right direction. [fixed up calls in 3 missing drivers - gregkh] Signed-off-by: Alan Cox <alan@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
d739e65bb2
commit
d29f3ef39b
@@ -1065,7 +1065,8 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
|
||||
|
||||
TRACE_L("read()");
|
||||
|
||||
tty_lock();
|
||||
/* FIXME: should use a private lock */
|
||||
tty_lock(tty);
|
||||
|
||||
pClient = findClient(pInfo, task_pid(current));
|
||||
if (pClient) {
|
||||
@@ -1077,7 +1078,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
|
||||
goto unlock;
|
||||
}
|
||||
/* block until there is a message: */
|
||||
wait_event_interruptible_tty(pInfo->read_wait,
|
||||
wait_event_interruptible_tty(tty, pInfo->read_wait,
|
||||
(pMsg = remove_msg(pInfo, pClient)));
|
||||
}
|
||||
|
||||
@@ -1107,7 +1108,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
|
||||
}
|
||||
ret = -EPERM;
|
||||
unlock:
|
||||
tty_unlock();
|
||||
tty_unlock(tty);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1156,7 +1157,7 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
|
||||
pHeader->locks = 0;
|
||||
pHeader->owner = NULL;
|
||||
|
||||
tty_lock();
|
||||
tty_lock(tty);
|
||||
|
||||
pClient = findClient(pInfo, task_pid(current));
|
||||
if (pClient) {
|
||||
@@ -1175,7 +1176,7 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
|
||||
add_tx_queue(pInfo, pHeader);
|
||||
trigger_transmit(pInfo);
|
||||
|
||||
tty_unlock();
|
||||
tty_unlock(tty);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user