/* cx231xx_v4l2_poll() will allocate buffers when called for the first time  */
static unsigned int cx231xx_v4l2_poll(struct file *filp, poll_table *wait)
/* cx231xx_v4l2_poll() will allocate buffers when called for the first time  */
static unsigned int cx231xx_v4l2_poll(struct file *filp, poll_table *wait)
{
	struct cx231xx_fh *fh = filp->private_data;
	struct cx231xx *dev = fh->dev;
	int rc;
	rc = check_dev(dev);
	if (rc < 0)
		return rc;
	mutex_lock(&dev->lock);
	rc = res_get(fh);
	mutex_unlock(&dev->lock);
	if (unlikely(rc < 0))
		return POLLERR;
	if ((V4L2_BUF_TYPE_VIDEO_CAPTURE == fh->type) ||
	    (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type))
		return videobuf_poll_stream(filp, &fh->vb_vidq, wait);
	else
		return POLLERR;
}