[media] media: mx3_camera: buf_init() add buffer state check
authorAlex Gershgorin <alexg@meprolight.com>
Wed, 1 Aug 2012 08:05:10 +0000 (05:05 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 15 Aug 2012 22:23:10 +0000 (19:23 -0300)
commit1690d86aa33fa14c0ae4ac97e59d806eeddccd2c
treec78814611d12950ce5acfd0be9d0f3f8932b4ead
parentbe0c44fb480fe43fe8794ec4bff0b0e7e0b50c72
[media] media: mx3_camera: buf_init() add buffer state check

This patch checks the state of the buffer when calling .buf_init() method.
This is needed for the USERPTR buffer type, because in that case
.buf_init() is called every time a buffer is queued, and not only once
during the preparation stage, like in the MMAP case. Without this check
buffers get initialised repeatedly, which also leads to the allocation
of new DMA descriptors, of which there is only a final relatively small
number available. Both MMAP and USERPTR methods were successfully tested.

Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
[g.liakhovetski@gmx.de: remove mx3_camera_buffer::state completely]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/mx3_camera.c