staging: vme: use image mutex for ioctl()
This implements more granular locking in vme_user_ioctl() by using separate locks for each devfs device. This also provides a synchronization between vme_user_read(), vme_user_write() and vme_user_ioctl(). Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com> Cc: Martyn Welch <martyn.welch@ge.com> Cc: Igor Alekseev <igor.alekseev@itep.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ad22d55c4b
commit
0cd189a42d
|
@ -41,7 +41,6 @@
|
||||||
|
|
||||||
#include "vme_user.h"
|
#include "vme_user.h"
|
||||||
|
|
||||||
static DEFINE_MUTEX(vme_user_mutex);
|
|
||||||
static const char driver_name[] = "vme_user";
|
static const char driver_name[] = "vme_user";
|
||||||
|
|
||||||
static int bus[VME_USER_BUS_MAX];
|
static int bus[VME_USER_BUS_MAX];
|
||||||
|
@ -555,10 +554,12 @@ static long
|
||||||
vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
struct inode *inode = file_inode(file);
|
||||||
|
unsigned int minor = MINOR(inode->i_rdev);
|
||||||
|
|
||||||
mutex_lock(&vme_user_mutex);
|
mutex_lock(&image[minor].mutex);
|
||||||
ret = vme_user_ioctl(file_inode(file), file, cmd, arg);
|
ret = vme_user_ioctl(inode, file, cmd, arg);
|
||||||
mutex_unlock(&vme_user_mutex);
|
mutex_unlock(&image[minor].mutex);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue