struct em2820 *h,*dev = NULL; struct list_head *list;  list_for_each(list,&em2820_devlist) { h = list_entry(list, struct em2820, devlist); if (h->vdev->minor == minor) { dev  = h; } }  filp->private_data=dev;
static int em2820_v4l2_open(struct inode *inode, struct file *filp){	struct video_device *vdev = video_devdata(filp);	int minor = iminor(inode);	struct em2820 *dev = (struct em2820 *)video_get_drvdata(vdev);	int errCode = 0;	em2820_videodbg("users=%d", dev->users);	if (!down_read_trylock(&em2820_disconnect))		return -ERESTARTSYS;	if (dev->users) {		em2820_warn("this driver can be opened only once\n");		up_read(&em2820_disconnect);		return -EBUSY;	}/*	if(dev->vbi_dev->minor == minor){		dev->type=V4L2_BUF_TYPE_VBI_CAPTURE;	}*/	if (dev->vdev->minor == minor) {		dev->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;	}	init_MUTEX(&dev->fileop_lock);	/* to 1 == available */	spin_lock_init(&dev->queue_lock);	init_waitqueue_head(&dev->wait_frame);	init_waitqueue_head(&dev->wait_stream);	down(&dev->lock);	em2820_set_alternate(dev);	dev->width = norm_maxw(dev);	dev->height = norm_maxh(dev);	dev->frame_size = dev->width * dev->height * 2;	dev->field_size = dev->frame_size >> 1;	/*both_fileds ? dev->frame_size>>1 : dev->frame_size; */	dev->bytesperline = dev->width * 2;	dev->hscale = 0;	dev->vscale = 0;	em2820_capture_start(dev, 1);	em2820_resolution_set(dev);	/* start the transfer */	errCode = em2820_init_isoc(dev);	if (errCode)		goto err;	dev->users++;	filp->private_data = dev;	dev->io = IO_NONE;	dev->stream = STREAM_OFF;	dev->num_frames = 0;	/* prepare queues */	em2820_empty_framequeues(dev);	dev->state |= DEV_INITIALIZED;      err:	up(&dev->lock);	up_read(&em2820_disconnect);	return errCode;}