diff options
author | Dmitry Kalinkin <dmitry.kalinkin@gmail.com> | 2015-02-26 10:53:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-06 20:03:22 -0500 |
commit | 0cd189a42da07c89c809debc1f6a75f5ec0f5c43 (patch) | |
tree | b4a47d098d8d8afb60324548e62132f8e6b84320 | |
parent | ad22d55c4b304a163c7372c00768f50adaecc686 (diff) |
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>
-rw-r--r-- | drivers/staging/vme/devices/vme_user.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 8b1f53331433..87318386034b 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c | |||
@@ -41,7 +41,6 @@ | |||
41 | 41 | ||
42 | #include "vme_user.h" | 42 | #include "vme_user.h" |
43 | 43 | ||
44 | static DEFINE_MUTEX(vme_user_mutex); | ||
45 | static const char driver_name[] = "vme_user"; | 44 | static const char driver_name[] = "vme_user"; |
46 | 45 | ||
47 | static int bus[VME_USER_BUS_MAX]; | 46 | static int bus[VME_USER_BUS_MAX]; |
@@ -555,10 +554,12 @@ static long | |||
555 | vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 554 | vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
556 | { | 555 | { |
557 | int ret; | 556 | int ret; |
557 | struct inode *inode = file_inode(file); | ||
558 | unsigned int minor = MINOR(inode->i_rdev); | ||
558 | 559 | ||
559 | mutex_lock(&vme_user_mutex); | 560 | mutex_lock(&image[minor].mutex); |
560 | ret = vme_user_ioctl(file_inode(file), file, cmd, arg); | 561 | ret = vme_user_ioctl(inode, file, cmd, arg); |
561 | mutex_unlock(&vme_user_mutex); | 562 | mutex_unlock(&image[minor].mutex); |
562 | 563 | ||
563 | return ret; | 564 | return ret; |
564 | } | 565 | } |