]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/staging/cx25821/cx25821-vidups10.c
V4L/DVB (13554a): v4l: Use the video_drvdata function in drivers
[net-next-2.6.git] / drivers / staging / cx25821 / cx25821-vidups10.c
index 77b63b06040563282ec4398b3a21c1d8d6618d20..4e0033fa205bc97f8671f322ddcf29709e11a14e 100644 (file)
@@ -95,35 +95,18 @@ static struct videobuf_queue_ops cx25821_video_qops = {
 static int video_open(struct file *file)
 {
        int minor = video_devdata(file)->minor;
-       struct cx25821_dev *h, *dev = NULL;
+       struct cx25821_dev *dev = video_drvdata(file);
        struct cx25821_fh *fh;
-       struct list_head *list;
-       enum v4l2_buf_type type = 0;
-
-       lock_kernel();
-       list_for_each(list, &cx25821_devlist) {
-               h = list_entry(list, struct cx25821_dev, devlist);
-
-               if (h->video_dev[SRAM_CH10]
-                   && h->video_dev[SRAM_CH10]->minor == minor) {
-                       dev = h;
-                       type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-               }
-       }
-
-       if (NULL == dev) {
-               unlock_kernel();
-               return -ENODEV;
-       }
+       enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
        printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
        /* allocate + initialize per filehandle data */
        fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-       if (NULL == fh) {
-               unlock_kernel();
+       if (NULL == fh)
                return -ENOMEM;
-       }
+
+       lock_kernel();
 
        file->private_data = fh;
        fh->dev = dev;