]> git.karo-electronics.de Git - mv-sheeva.git/commit
[media] gspca_main: Set memory type to GSPCA_MEMORY_NO on buffer release
authorHans de Goede <hdegoede@redhat.com>
Fri, 31 Dec 2010 07:51:36 +0000 (04:51 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 Jan 2011 13:44:57 +0000 (11:44 -0200)
commitd642de2ed472df308f8ee49417e29030f69b2095
tree1ac77d33b3866e0542172f8e4ecd9c33c2cf772b
parent7f6eb118df84715b128e25e99dc6a3ebc5b133d6
[media] gspca_main: Set memory type to GSPCA_MEMORY_NO on buffer release

Before this patch we were not setting the memory type to GSPCA_MEMORY_NO
when the buffers were released by the app doing a reqbufs 0. Nor would
the memory type be set to GSPCA_MEMORY_NO on device close, as capture_file
already is NULL on device close because of the reqbufs 0. This caused the
following problem:
-app1 does reqbufs USERPTR for 4 buffers
-app1 does reqbufs USERPTR for 0 buffers
-app2 tries to do reqbufs MMAP for 4 buffers
 fails because gspca_dev->memory still is USERPTR

Fixing this also allows an app to switch memory type's by unrequesting
the buffers and re-requesting them of a different type.

This patch also moves the setting of gspca_dev->frsz and gscpa_dev->memory
to after alloc_frame succeeding, so that they are not changed when allocating
fails.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c