aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-05-06 08:28:19 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-14 08:26:57 -0400
commit2333565d94c1efd199782bdedc9f4d9b06198583 (patch)
tree9bb6455e9a962069a6cc8dbb6da59abe24de5a90 /drivers/media/video/gspca/gspca.c
parentf4c1605a74c46100d93f465238b9962ac9499e36 (diff)
[media] gscpa: Use v4l2_fh and add G/S_PRIORITY support
In order to support control event gspca has to use struct v4l2_fh. As a bonus feature this also gives priority handling for free. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index dbebed90bbac..ed33a8773f7e 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -39,6 +39,7 @@
39#include <linux/ktime.h> 39#include <linux/ktime.h>
40#include <media/v4l2-ioctl.h> 40#include <media/v4l2-ioctl.h>
41#include <media/v4l2-ctrls.h> 41#include <media/v4l2-ctrls.h>
42#include <media/v4l2-fh.h>
42 43
43#include "gspca.h" 44#include "gspca.h"
44 45
@@ -1327,6 +1328,7 @@ static void gspca_release(struct video_device *vfd)
1327 video_device_node_name(&gspca_dev->vdev)); 1328 video_device_node_name(&gspca_dev->vdev));
1328 1329
1329 v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler); 1330 v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler);
1331 v4l2_device_unregister(&gspca_dev->v4l2_dev);
1330 kfree(gspca_dev->usb_buf); 1332 kfree(gspca_dev->usb_buf);
1331 kfree(gspca_dev); 1333 kfree(gspca_dev);
1332} 1334}
@@ -1352,7 +1354,7 @@ static int dev_open(struct file *file)
1352 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL 1354 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL
1353 | V4L2_DEBUG_IOCTL_ARG); 1355 | V4L2_DEBUG_IOCTL_ARG);
1354#endif 1356#endif
1355 return 0; 1357 return v4l2_fh_open(file);
1356} 1358}
1357 1359
1358static int dev_close(struct file *file) 1360static int dev_close(struct file *file)
@@ -1378,7 +1380,7 @@ static int dev_close(struct file *file)
1378 1380
1379 PDEBUG(D_STREAM, "close done"); 1381 PDEBUG(D_STREAM, "close done");
1380 1382
1381 return 0; 1383 return v4l2_fh_release(file);
1382} 1384}
1383 1385
1384static int vidioc_querycap(struct file *file, void *priv, 1386static int vidioc_querycap(struct file *file, void *priv,
@@ -2345,12 +2347,16 @@ int gspca_dev_probe2(struct usb_interface *intf,
2345 } 2347 }
2346 } 2348 }
2347 2349
2350 ret = v4l2_device_register(&intf->dev, &gspca_dev->v4l2_dev);
2351 if (ret)
2352 goto out;
2348 gspca_dev->sd_desc = sd_desc; 2353 gspca_dev->sd_desc = sd_desc;
2349 gspca_dev->nbufread = 2; 2354 gspca_dev->nbufread = 2;
2350 gspca_dev->empty_packet = -1; /* don't check the empty packets */ 2355 gspca_dev->empty_packet = -1; /* don't check the empty packets */
2351 gspca_dev->vdev = gspca_template; 2356 gspca_dev->vdev = gspca_template;
2352 gspca_dev->vdev.parent = &intf->dev; 2357 gspca_dev->vdev.v4l2_dev = &gspca_dev->v4l2_dev;
2353 video_set_drvdata(&gspca_dev->vdev, gspca_dev); 2358 video_set_drvdata(&gspca_dev->vdev, gspca_dev);
2359 set_bit(V4L2_FL_USE_FH_PRIO, &gspca_dev->vdev.flags);
2354 gspca_dev->module = module; 2360 gspca_dev->module = module;
2355 gspca_dev->present = 1; 2361 gspca_dev->present = 1;
2356 2362
@@ -2462,6 +2468,7 @@ void gspca_disconnect(struct usb_interface *intf)
2462 2468
2463 /* the device is freed at exit of this function */ 2469 /* the device is freed at exit of this function */
2464 gspca_dev->dev = NULL; 2470 gspca_dev->dev = NULL;
2471 v4l2_device_disconnect(&gspca_dev->v4l2_dev);
2465 mutex_unlock(&gspca_dev->usb_lock); 2472 mutex_unlock(&gspca_dev->usb_lock);
2466 2473
2467 usb_set_intfdata(intf, NULL); 2474 usb_set_intfdata(intf, NULL);