static int solo_v4l2_open(struct file *file) { struct solo6010_dev *solo_dev = video_drvdata(file); struct solo_filehandle *fh; int ret; if ((fh = kzalloc(sizeof(*fh), GFP_KERNEL)) == NULL) return -ENOMEM; spin_lock_init(&fh->slock); INIT_LIST_HEAD(&fh->vidq_active); fh->solo_dev = solo_dev; file->private_data = fh; if ((ret = solo_start_thread(fh))) { kfree(fh); return ret; } videobuf_queue_dma_contig_init(&fh->vidq, &solo_video_qops, &solo_dev->pdev->dev, &fh->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, SOLO_DISP_PIX_FIELD, sizeof(struct videobuf_buffer), fh); return 0; }
static int solo_start_streaming(struct vb2_queue *q, unsigned int count) { struct solo_dev *solo_dev = vb2_get_drv_priv(q); solo_dev->sequence = 0; return solo_start_thread(solo_dev); }
static int solo_v4l2_open(struct inode *ino, struct file *file) #endif { struct solo_dev *solo_dev = video_drvdata(file); struct solo_filehandle *fh; int ret; fh = kzalloc(sizeof(*fh), GFP_KERNEL); if (fh == NULL) return -ENOMEM; spin_lock_init(&fh->slock); INIT_LIST_HEAD(&fh->vidq_active); fh->solo_dev = solo_dev; file->private_data = fh; ret = solo_start_thread(fh); if (ret) { kfree(fh); return ret; } #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 37) videobuf_queue_dma_contig_init(&fh->vidq, &solo_video_qops, &solo_dev->pdev->dev, &fh->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, SOLO_DISP_PIX_FIELD, sizeof(struct videobuf_buffer), fh, NULL); #else videobuf_queue_dma_contig_init(&fh->vidq, &solo_video_qops, &solo_dev->pdev->dev, &fh->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, SOLO_DISP_PIX_FIELD, sizeof(struct videobuf_buffer), fh); #endif return 0; }