summaryrefslogtreecommitdiff
path: root/drivers/staging/media/imx/imx7-media-csi.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-09 23:32:33 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-07-08 18:02:47 +0100
commita3ec6bc1af391b3115c683711d80bc704e8dd16b (patch)
tree647cbfbe2eaf3babbc8aa4f6b5ee6eed821ef2d9 /drivers/staging/media/imx/imx7-media-csi.c
parent9d75fc9917708c1852650fab3ff743a97d5fec3c (diff)
media: staging: media: imx: imx7-media-csi: Avoid unnecessary casts
Simplify the imx7_csi_media_pipeline_set_stream() function by passing it the imx7_csi pointer, which avoids going from subdev to entity and back to subdev. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/staging/media/imx/imx7-media-csi.c')
-rw-r--r--drivers/staging/media/imx/imx7-media-csi.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index 51e6bb4bd8b6..86a0ca9b82e8 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -1067,33 +1067,24 @@ static int imx7_csi_video_validate_fmt(struct imx7_csi *csi)
return 0;
}
-/*
- * Turn current pipeline streaming on/off starting from entity.
- */
-static int imx7_csi_media_pipeline_set_stream(struct imx_media_dev *imxmd,
- struct media_entity *entity,
- bool on)
+static int imx7_csi_media_pipeline_set_stream(struct imx7_csi *csi, bool on)
{
- struct v4l2_subdev *sd;
+ struct imx_media_dev *imxmd = &csi->imxmd;
int ret = 0;
- if (!is_media_entity_v4l2_subdev(entity))
- return -EINVAL;
- sd = media_entity_to_v4l2_subdev(entity);
-
mutex_lock(&imxmd->md.graph_mutex);
if (on) {
- ret = __media_pipeline_start(entity, &imxmd->pipe);
+ ret = __media_pipeline_start(&csi->sd.entity, &imxmd->pipe);
if (ret)
goto out;
- ret = v4l2_subdev_call(sd, video, s_stream, 1);
+ ret = v4l2_subdev_call(&csi->sd, video, s_stream, 1);
if (ret)
- __media_pipeline_stop(entity);
+ __media_pipeline_stop(&csi->sd.entity);
} else {
- v4l2_subdev_call(sd, video, s_stream, 0);
- if (entity->pipe)
- __media_pipeline_stop(entity);
+ v4l2_subdev_call(&csi->sd, video, s_stream, 0);
+ if (csi->sd.entity.pipe)
+ __media_pipeline_stop(&csi->sd.entity);
}
out:
@@ -1115,8 +1106,7 @@ static int imx7_csi_video_start_streaming(struct vb2_queue *vq,
goto return_bufs;
}
- ret = imx7_csi_media_pipeline_set_stream(&csi->imxmd, &csi->sd.entity,
- true);
+ ret = imx7_csi_media_pipeline_set_stream(csi, true);
if (ret) {
dev_err(csi->dev, "pipeline start failed with %d\n", ret);
goto return_bufs;
@@ -1142,8 +1132,7 @@ static void imx7_csi_video_stop_streaming(struct vb2_queue *vq)
unsigned long flags;
int ret;
- ret = imx7_csi_media_pipeline_set_stream(&csi->imxmd, &csi->sd.entity,
- false);
+ ret = imx7_csi_media_pipeline_set_stream(csi, false);
if (ret)
dev_warn(csi->dev, "pipeline stop failed with %d\n", ret);