Patch Detail
Show a patch.
GET /api/1.1/patches/15865/?format=api
{ "id": 15865, "url": "https://patchwork.libcamera.org/api/1.1/patches/15865/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15865/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "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-26-laurent.pinchart@ideasonboard.com>", "date": "2022-05-10T11:51:22", "name": "[libcamera-devel,25/50] staging: media: imx: imx7-media-csi: Inline pipeline start/stop", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "75c0260dfeb4701dc25502a056e9403ce5167256", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15865/mbox/", "series": [ { "id": 3106, "url": "https://patchwork.libcamera.org/api/1.1/series/3106/?format=api", "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/15865/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15865/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 B522EC3272\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 4343165675;\n\tTue, 10 May 2022 13:52:27 +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 7389C65680\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 May 2022 13:52:18 +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 91FFEB9A;\n\tTue, 10 May 2022 13:52:17 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652183547;\n\tbh=FoyLYFnys/3AHuA1i8+u18sJF+/odDK5/oJembX9Pbs=;\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=A8hgDSle0Ao2RCgDpGB9m4UO0xVcuNIWAgvWpvSxD7cVfdpmOwxIGJ4eHK/R7qt7I\n\t4auceCHsGYQxfhRKeleYq2xKEakcQwBL09s3Ru+Ls6nly8ZvxFTCSHbsyDP84qonis\n\tAgWWUxLKqdiO5+RlB6Kavcpi66VRgsHjtMsPhdpWHJdRbjvHWSu+ARkz+ehU4cjSnf\n\tNyNFILzrRTF/3pBu3COzNP78JEaIf6r08+2JIiIwQApJrm/1TPPplCt4b0IjdNTSHm\n\tcSAHmX879v/7o9w4R5/6PTk+81a5kY+iwSvPe8tWk76kIWdEjRag9HT3uB8MS1L17U\n\teewcFAyeNXN0A==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652183538;\n\tbh=FoyLYFnys/3AHuA1i8+u18sJF+/odDK5/oJembX9Pbs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ag6xtEXPE/rme2wp/0rCz8XE142LVeBm3N+8xqV03LnLPBiOw0zskdyQPY9RKxWsh\n\tVreiwKk5bo3WpYzBWhXKHSBC73n3H06rho57V+tSyK8rcrcUppggC8qDJHHtlXeufJ\n\tyuO1a90H8bbhKVw8PIr5sLYzojfcaDFzNASzh4RU=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ag6xtEXP\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 10 May 2022 14:51:22 +0300", "Message-Id": "<20220510115147.19360-26-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 25/50] staging: media: imx:\n\timx7-media-csi: Inline pipeline start/stop", "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": "The imx7_csi_media_pipeline_set_stream() function has separate branches\nfor the start and stop paths, surrounded by mutex lock/unlock. That is\nvery little shared code, inline the locking and corresponding branch in\neach of the two callers.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n drivers/staging/media/imx/imx7-media-csi.c | 58 ++++++++--------------\n 1 file changed, 22 insertions(+), 36 deletions(-)", "diff": "diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c\nindex 8600fc4d6be2..44c19c73da97 100644\n--- a/drivers/staging/media/imx/imx7-media-csi.c\n+++ b/drivers/staging/media/imx/imx7-media-csi.c\n@@ -1067,31 +1067,6 @@ static int imx7_csi_video_validate_fmt(struct imx7_csi *csi)\n \treturn 0;\n }\n \n-static int imx7_csi_media_pipeline_set_stream(struct imx7_csi *csi, bool on)\n-{\n-\tstruct imx_media_dev *imxmd = &csi->imxmd;\n-\tint ret = 0;\n-\n-\tmutex_lock(&imxmd->md.graph_mutex);\n-\n-\tif (on) {\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(&csi->sd, video, s_stream, 1);\n-\t\tif (ret)\n-\t\t\t__media_pipeline_stop(&csi->sd.entity);\n-\t} else {\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-\tmutex_unlock(&imxmd->md.graph_mutex);\n-\treturn ret;\n-}\n-\n static int imx7_csi_video_start_streaming(struct vb2_queue *vq,\n \t\t\t\t\t unsigned int count)\n {\n@@ -1103,18 +1078,29 @@ static int imx7_csi_video_start_streaming(struct vb2_queue *vq,\n \tret = imx7_csi_video_validate_fmt(csi);\n \tif (ret) {\n \t\tdev_err(csi->dev, \"capture format not valid\\n\");\n-\t\tgoto return_bufs;\n+\t\tgoto err_buffers;\n \t}\n \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-\t}\n+\tmutex_lock(&csi->imxmd.md.graph_mutex);\n+\n+\tret = __media_pipeline_start(&csi->sd.entity, &csi->imxmd.pipe);\n+\tif (ret)\n+\t\tgoto err_unlock;\n+\n+\tret = v4l2_subdev_call(&csi->sd, video, s_stream, 1);\n+\tif (ret)\n+\t\tgoto err_stop;\n+\n+\tmutex_unlock(&csi->imxmd.md.graph_mutex);\n \n \treturn 0;\n \n-return_bufs:\n+err_stop:\n+\t__media_pipeline_stop(&csi->sd.entity);\n+err_unlock:\n+\tmutex_unlock(&csi->imxmd.md.graph_mutex);\n+\tdev_err(csi->dev, \"pipeline start failed with %d\\n\", ret);\n+err_buffers:\n \tspin_lock_irqsave(&csi->q_lock, flags);\n \tlist_for_each_entry_safe(buf, tmp, &csi->ready_q, list) {\n \t\tlist_del(&buf->list);\n@@ -1130,11 +1116,11 @@ static void imx7_csi_video_stop_streaming(struct vb2_queue *vq)\n \tstruct imx_media_buffer *frame;\n \tstruct imx_media_buffer *tmp;\n \tunsigned long flags;\n-\tint ret;\n \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+\tmutex_lock(&csi->imxmd.md.graph_mutex);\n+\tv4l2_subdev_call(&csi->sd, video, s_stream, 0);\n+\t__media_pipeline_stop(&csi->sd.entity);\n+\tmutex_unlock(&csi->imxmd.md.graph_mutex);\n \n \t/* release all active buffers */\n \tspin_lock_irqsave(&csi->q_lock, flags);\n", "prefixes": [ "libcamera-devel", "25/50" ] }