summaryrefslogtreecommitdiff
path: root/drivers/media/platform/exynos4-is/fimc-capture.c
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2013-03-25 23:50:50 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-05 03:24:32 +0400
commit9ea89e2b62c70f3986c89363818a89c8c11c96c4 (patch)
tree4b59e979af0bac64ff3fe0936fa1ac6efd4b6b9d /drivers/media/platform/exynos4-is/fimc-capture.c
parent439797980af4bddfc2b86a44ddb573c5e48a1fcc (diff)
downloadlinux-9ea89e2b62c70f3986c89363818a89c8c11c96c4.tar.xz
[media] exynos4-is: Ensure proper media pipeline state on device close
Make sure media_entity_pipeline_stop() is called on video device close in cases where there was VIDIOC_STREAMON ioctl and no VIDIOC_STREAMOFF. This patch fixes media entities stream_count state which could prevent links from being disconnected, due to non-zero stream_count. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/exynos4-is/fimc-capture.c')
-rw-r--r--drivers/media/platform/exynos4-is/fimc-capture.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
index 965b07f36e3c..28c6b26f6ff5 100644
--- a/drivers/media/platform/exynos4-is/fimc-capture.c
+++ b/drivers/media/platform/exynos4-is/fimc-capture.c
@@ -551,6 +551,7 @@ unlock:
static int fimc_capture_release(struct file *file)
{
struct fimc_dev *fimc = video_drvdata(file);
+ struct fimc_vid_cap *vc = &fimc->vid_cap;
int ret;
dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state);
@@ -558,6 +559,10 @@ static int fimc_capture_release(struct file *file)
mutex_lock(&fimc->lock);
if (v4l2_fh_is_singular_file(file)) {
+ if (vc->streaming) {
+ media_entity_pipeline_stop(&vc->vfd.entity);
+ vc->streaming = false;
+ }
clear_bit(ST_CAPT_BUSY, &fimc->state);
fimc_stop_capture(fimc, false);
fimc_pipeline_call(fimc, close, &fimc->pipeline);
@@ -1243,8 +1248,10 @@ static int fimc_cap_streamon(struct file *file, void *priv,
}
ret = vb2_ioctl_streamon(file, priv, type);
- if (!ret)
+ if (!ret) {
+ vc->streaming = true;
return ret;
+ }
err_p_stop:
media_entity_pipeline_stop(entity);
@@ -1258,11 +1265,12 @@ static int fimc_cap_streamoff(struct file *file, void *priv,
int ret;
ret = vb2_ioctl_streamoff(file, priv, type);
+ if (ret < 0)
+ return ret;
- if (ret == 0)
- media_entity_pipeline_stop(&fimc->vid_cap.vfd.entity);
-
- return ret;
+ media_entity_pipeline_stop(&fimc->vid_cap.vfd.entity);
+ fimc->vid_cap.streaming = false;
+ return 0;
}
static int fimc_cap_reqbufs(struct file *file, void *priv,