[media] vb2: push the mmap semaphore down to __buf_prepare()
authorHans Verkuil <hans.verkuil@cisco.com>
Fri, 13 Dec 2013 16:13:38 +0000 (13:13 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 7 Jan 2014 09:00:04 +0000 (07:00 -0200)
commitb18a8ff29d80b132018d33479e86ab8ecaee6b46
treef8bc0cec256e75717d36952b278181f887252041
parentb4fcdaf7654f9506f80d4e3f2b045a78333d62dc
[media] vb2: push the mmap semaphore down to __buf_prepare()

Rather than taking the mmap semaphore at a relatively high-level function,
push it down to the place where it is really needed.

It was placed in vb2_queue_or_prepare_buf() to prevent racing with other
vb2 calls. The only way I can see that a race can happen is when two
threads queue the same buffer. The solution for that it to introduce
a PREPARING state.

Moving it down offers opportunities to simplify the code.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/v4l2-core/videobuf2-core.c
include/media/videobuf2-core.h