{"id":15864,"url":"https://patchwork.libcamera.org/api/1.1/patches/15864/?format=json","web_url":"https://patchwork.libcamera.org/patch/15864/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220510115147.19360-25-laurent.pinchart@ideasonboard.com>","date":"2022-05-10T11:51:21","name":"[libcamera-devel,24/50] staging: media: imx: imx7-media-csi: Avoid unnecessary casts","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"397d4921eb77b42551f83b7499b32f125504713a","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15864/mbox/","series":[{"id":3106,"url":"https://patchwork.libcamera.org/api/1.1/series/3106/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3106","date":"2022-05-10T11:50:57","name":"staging: media: imx: Prepare destaging of imx7-media-csi","version":1,"mbox":"https://patchwork.libcamera.org/series/3106/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15864/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15864/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 12DBCC3271\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 May 2022 11:52:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B495F65688;\n\tTue, 10 May 2022 13:52:26 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 960ED6564F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 May 2022 13:52:17 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BAD9A824;\n\tTue, 10 May 2022 13:52:16 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652183546;\n\tbh=D5kh5m5dVFSdvWBJedF03x3RCtpo2Vy/S76Gby0LnNI=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=GsEM763CxqRQrx8nRTSW9eCSFCYo29t5joUkR4Z6WQ/vGu0PBqwO8WRZmmhdwn9y+\n\tzyUR1Uzqc0tOjr+kbKHrFDjT1whftdUOI9IBD81GCL1oFEDGY71rWI28W2msyq0MVI\n\tCstI5YDCz73+9KqI+VhTF5rnD848qf9wHfXKAWsCgrThNmdn8Fu9OIChw/F+b9NLnv\n\tjrtXz8XuxBBK08jy4h3F1iCmSP9LBjYpdYbywyCasS67nfMzL+sKVIzcMq1HwoWu6O\n\tOmrlBs4MG8EsPfD/hm9BFRN4t80ppoyKUz9uTHz9NZRQfKfOO54NAFdNfToV+mIS3S\n\tbRrsxBKra7Ppw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652183537;\n\tbh=D5kh5m5dVFSdvWBJedF03x3RCtpo2Vy/S76Gby0LnNI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=sU2hVazhFyW3QXWodhFCns0eMkI5EHdNotatgJQpzKpgTFdJGFIGHJUAk6OXzghXq\n\tlTVQsfJcy3UzmEqltVBHrLdLuXlb1BMxM3zwRKo3eiGPau1tJGeb4EUAhW4Sutmr6M\n\traOU8MAVSzmbjSUgjpo7xqQs0eiMOx7YkITCF1oQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"sU2hVazh\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 10 May 2022 14:51:21 +0300","Message-Id":"<20220510115147.19360-25-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>","References":"<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 24/50] staging: media: imx:\n\timx7-media-csi: Avoid unnecessary casts","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Martin Kepplinger <martin.kepplinger@puri.sm>, kernel@pengutronix.de,\n\tDorota Czaplejewicz <dorota.czaplejewicz@puri.sm>,\n\tAlexander Stein <alexander.stein@ew.tq-group.com>,\n\tRui Miguel Silva <rmfrfs@gmail.com>,\n\tPhilipp Zabel <p.zabel@pengutronix.de>, \n\tSteve Longerbeam <slongerbeam@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Simplify the imx7_csi_media_pipeline_set_stream() function by passing it\nthe imx7_csi pointer, which avoids going from subdev to entity and back\nto subdev.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n drivers/staging/media/imx/imx7-media-csi.c | 31 +++++++---------------\n 1 file changed, 10 insertions(+), 21 deletions(-)","diff":"diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c\nindex 1c8ee7c88f46..8600fc4d6be2 100644\n--- a/drivers/staging/media/imx/imx7-media-csi.c\n+++ b/drivers/staging/media/imx/imx7-media-csi.c\n@@ -1067,33 +1067,24 @@ static int imx7_csi_video_validate_fmt(struct imx7_csi *csi)\n \treturn 0;\n }\n \n-/*\n- * Turn current pipeline streaming on/off starting from entity.\n- */\n-static int imx7_csi_media_pipeline_set_stream(struct imx_media_dev *imxmd,\n-\t\t\t\t\t      struct media_entity *entity,\n-\t\t\t\t\t      bool on)\n+static int imx7_csi_media_pipeline_set_stream(struct imx7_csi *csi, bool on)\n {\n-\tstruct v4l2_subdev *sd;\n+\tstruct imx_media_dev *imxmd = &csi->imxmd;\n \tint ret = 0;\n \n-\tif (!is_media_entity_v4l2_subdev(entity))\n-\t\treturn -EINVAL;\n-\tsd = media_entity_to_v4l2_subdev(entity);\n-\n \tmutex_lock(&imxmd->md.graph_mutex);\n \n \tif (on) {\n-\t\tret = __media_pipeline_start(entity, &imxmd->pipe);\n+\t\tret = __media_pipeline_start(&csi->sd.entity, &imxmd->pipe);\n \t\tif (ret)\n \t\t\tgoto out;\n-\t\tret = v4l2_subdev_call(sd, video, s_stream, 1);\n+\t\tret = v4l2_subdev_call(&csi->sd, video, s_stream, 1);\n \t\tif (ret)\n-\t\t\t__media_pipeline_stop(entity);\n+\t\t\t__media_pipeline_stop(&csi->sd.entity);\n \t} else {\n-\t\tv4l2_subdev_call(sd, video, s_stream, 0);\n-\t\tif (entity->pipe)\n-\t\t\t__media_pipeline_stop(entity);\n+\t\tv4l2_subdev_call(&csi->sd, video, s_stream, 0);\n+\t\tif (csi->sd.entity.pipe)\n+\t\t\t__media_pipeline_stop(&csi->sd.entity);\n \t}\n \n out:\n@@ -1115,8 +1106,7 @@ static int imx7_csi_video_start_streaming(struct vb2_queue *vq,\n \t\tgoto return_bufs;\n \t}\n \n-\tret = imx7_csi_media_pipeline_set_stream(&csi->imxmd, &csi->sd.entity,\n-\t\t\t\t\t\t true);\n+\tret = imx7_csi_media_pipeline_set_stream(csi, true);\n \tif (ret) {\n \t\tdev_err(csi->dev, \"pipeline start failed with %d\\n\", ret);\n \t\tgoto return_bufs;\n@@ -1142,8 +1132,7 @@ static void imx7_csi_video_stop_streaming(struct vb2_queue *vq)\n \tunsigned long flags;\n \tint ret;\n \n-\tret = imx7_csi_media_pipeline_set_stream(&csi->imxmd, &csi->sd.entity,\n-\t\t\t\t\t\t false);\n+\tret = imx7_csi_media_pipeline_set_stream(csi, false);\n \tif (ret)\n \t\tdev_warn(csi->dev, \"pipeline stop failed with %d\\n\", ret);\n \n","prefixes":["libcamera-devel","24/50"]}