mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 23:04:43 +00:00
media: v4l2-core: push taking ioctl mutex down to ioctl handler
The ioctl serialization mutex (vdev->lock or q->lock for vb2 queues) was taken at the highest level in v4l2-dev.c. This prevents more fine-grained locking since at that level we cannot examine the ioctl arguments, we can only do that after video_usercopy is called. So push the locking down to __video_do_ioctl() and subdev_do_ioctl_lock(). This also allows us to make a few functions in v4l2-ioctl.c static and video_usercopy() is no longer exported. The locking scheme is not changed by this patch, just pushed down. Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
eba09b5b3d
commit
73a110623e
5 changed files with 33 additions and 31 deletions
|
@ -360,14 +360,8 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|||
int ret = -ENODEV;
|
||||
|
||||
if (vdev->fops->unlocked_ioctl) {
|
||||
struct mutex *lock = v4l2_ioctl_get_lock(vdev, cmd);
|
||||
|
||||
if (lock && mutex_lock_interruptible(lock))
|
||||
return -ERESTARTSYS;
|
||||
if (video_is_registered(vdev))
|
||||
ret = vdev->fops->unlocked_ioctl(filp, cmd, arg);
|
||||
if (lock)
|
||||
mutex_unlock(lock);
|
||||
} else
|
||||
ret = -ENOTTY;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue