upstream: [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)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:52:50 +0000 (11:52 +0900)
commit9be777da0b67ce79b0b8052ffbd80073d4dda7e2
tree982d33acb05102d796bcbb248a305344726a51e8
parent8dbd29b2ea9fc79988744c091013ea196eea2f53
upstream: [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