media: v4l2-core: push taking ioctl mutex down to ioctl handler
authorHans Verkuil <hansverk@cisco.com>
Fri, 11 May 2018 09:32:24 +0000 (05:32 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 28 May 2018 20:31:44 +0000 (16:31 -0400)
commit73a110623e7b7592defea69f028cccae495d69a4
tree9b1c21779d0317c9d18715cb9ce7197e8f2e0117
parenteba09b5b3dfb1b79db4428b6f379f68db4b62056
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>
drivers/media/v4l2-core/v4l2-dev.c
drivers/media/v4l2-core/v4l2-ioctl.c
drivers/media/v4l2-core/v4l2-subdev.c
include/media/v4l2-dev.h
include/media/v4l2-ioctl.h