From: Hans de Goede Date: Fri, 31 Dec 2010 07:51:36 +0000 (-0300) Subject: [media] gspca_main: Set memory type to GSPCA_MEMORY_NO on buffer release X-Git-Tag: v2.6.38-rc2~1^2~82 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d642de2ed472df308f8ee49417e29030f69b2095;p=pandora-kernel.git [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 Acked-by: Jean-Francois Moine Signed-off-by: Mauro Carvalho Chehab --- Reading git-diff-tree failed