Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330702
b: refs/heads/master
c: 00ccdc3
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Aug 9, 2012
1 parent 6de7260 commit dea8b09
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: de40cb227d1948490da7fd833100ae7a4ae7d825
refs/heads/master: 00ccdc3c3316fbe01ef810bbc52239843af5eef9
29 changes: 21 additions & 8 deletions trunk/drivers/media/video/s5p-tv/mixer_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,18 +750,20 @@ static int mxr_video_open(struct file *file)
int ret = 0;

mxr_dbg(mdev, "%s:%d\n", __func__, __LINE__);
if (mutex_lock_interruptible(&layer->mutex))
return -ERESTARTSYS;
/* assure device probe is finished */
wait_for_device_probe();
/* creating context for file descriptor */
ret = v4l2_fh_open(file);
if (ret) {
mxr_err(mdev, "v4l2_fh_open failed\n");
return ret;
goto unlock;
}

/* leaving if layer is already initialized */
if (!v4l2_fh_is_singular_file(file))
return 0;
goto unlock;

/* FIXME: should power be enabled on open? */
ret = mxr_power_get(mdev);
Expand All @@ -779,6 +781,7 @@ static int mxr_video_open(struct file *file)
layer->fmt = layer->fmt_array[0];
/* setup default geometry */
mxr_layer_default_geo(layer);
mutex_unlock(&layer->mutex);

return 0;

Expand All @@ -788,38 +791,52 @@ static int mxr_video_open(struct file *file)
fail_fh_open:
v4l2_fh_release(file);

unlock:
mutex_unlock(&layer->mutex);

return ret;
}

static unsigned int
mxr_video_poll(struct file *file, struct poll_table_struct *wait)
{
struct mxr_layer *layer = video_drvdata(file);
unsigned int res;

mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__);

return vb2_poll(&layer->vb_queue, file, wait);
mutex_lock(&layer->mutex);
res = vb2_poll(&layer->vb_queue, file, wait);
mutex_unlock(&layer->mutex);
return res;
}

static int mxr_video_mmap(struct file *file, struct vm_area_struct *vma)
{
struct mxr_layer *layer = video_drvdata(file);
int ret;

mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__);

return vb2_mmap(&layer->vb_queue, vma);
if (mutex_lock_interruptible(&layer->mutex))
return -ERESTARTSYS;
ret = vb2_mmap(&layer->vb_queue, vma);
mutex_unlock(&layer->mutex);
return ret;
}

static int mxr_video_release(struct file *file)
{
struct mxr_layer *layer = video_drvdata(file);

mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__);
mutex_lock(&layer->mutex);
if (v4l2_fh_is_singular_file(file)) {
vb2_queue_release(&layer->vb_queue);
mxr_power_put(layer->mdev);
}
v4l2_fh_release(file);
mutex_unlock(&layer->mutex);
return 0;
}

Expand Down Expand Up @@ -1069,10 +1086,6 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev,
set_bit(V4L2_FL_USE_FH_PRIO, &layer->vfd.flags);

video_set_drvdata(&layer->vfd, layer);
/* Locking in file operations other than ioctl should be done
by the driver, not the V4L2 core.
This driver needs auditing so that this flag can be removed. */
set_bit(V4L2_FL_LOCK_ALL_FOPS, &layer->vfd.flags);
layer->vfd.lock = &layer->mutex;
layer->vfd.v4l2_dev = &mdev->v4l2_dev;

Expand Down

0 comments on commit dea8b09

Please sign in to comment.