[media] v4l: vb2-dma-contig: add reference counting for a device from allocator context
authorTomasz Stanislawski <t.stanislaws@samsung.com>
Tue, 7 Aug 2012 16:19:49 +0000 (13:19 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 25 Nov 2012 19:21:20 +0000 (17:21 -0200)
commit67a5d0cebf30020bdc4846892adf360c57610268
tree87bae9a35aa00d739455289abecc576ce36983b1
parent9ef2cbeb819213520a8be77d4c3f7330a1a06ac5
[media] v4l: vb2-dma-contig: add reference counting for a device from allocator context

This patch adds taking reference to the device for MMAP buffers.
Such buffers, may be exported using DMABUF mechanism. If the driver that
created a queue is unloaded then the queue is released, the device might be
released too.  However, buffers cannot be released if they are referenced by
DMABUF descriptor(s). The device pointer kept in a buffer must be valid for the
whole buffer's lifetime. Therefore MMAP buffers should take a reference to the
device to avoid risk of dangling pointers.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/videobuf2-dma-contig.c