[media] s5p-fimc: Use video entity for marking media pipeline as streaming

It doesn't matter whether we start from the sensor of from
the video node entity. Remove use of pipeline->subdevs array
where possible, so we can partly drop dependency on struct
fimc_pipeline in the fimc-lite module, which is also used
by the exynos5-is driver.
Also make sure we revert any media entity pipeline operations
when vb2_streamon() function fails.

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>
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c
index 47fbf7b..d8afbbc 100644
--- a/drivers/media/platform/s5p-fimc/fimc-lite.c
+++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
@@ -800,20 +800,20 @@
 			      enum v4l2_buf_type type)
 {
 	struct fimc_lite *fimc = video_drvdata(file);
-	struct v4l2_subdev *sensor = fimc->pipeline.subdevs[IDX_SENSOR];
+	struct media_entity *entity = &fimc->vfd.entity;
 	struct fimc_pipeline *p = &fimc->pipeline;
 	int ret;
 
 	if (fimc_lite_active(fimc))
 		return -EBUSY;
 
-	ret = media_entity_pipeline_start(&sensor->entity, p->m_pipeline);
+	ret = media_entity_pipeline_start(entity, p->m_pipeline);
 	if (ret < 0)
 		return ret;
 
 	ret = fimc_pipeline_validate(fimc);
 	if (ret) {
-		media_entity_pipeline_stop(&sensor->entity);
+		media_entity_pipeline_stop(entity);
 		return ret;
 	}
 
@@ -824,12 +824,11 @@
 			       enum v4l2_buf_type type)
 {
 	struct fimc_lite *fimc = video_drvdata(file);
-	struct v4l2_subdev *sd = fimc->pipeline.subdevs[IDX_SENSOR];
 	int ret;
 
 	ret = vb2_streamoff(&fimc->vb_queue, type);
 	if (ret == 0)
-		media_entity_pipeline_stop(&sd->entity);
+		media_entity_pipeline_stop(&fimc->vfd.entity);
 	return ret;
 }