Patch Detail
Show a patch.
GET /api/patches/15845/?format=api
{ "id": 15845, "url": "https://patchwork.libcamera.org/api/patches/15845/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15845/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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-6-laurent.pinchart@ideasonboard.com>", "date": "2022-05-10T11:51:02", "name": "[libcamera-devel,05/50] staging: media: imx: imx7-media-csi: Drop the imx_media notifier", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "7db8728d35f603cbf1fea83651e6801ee54771a4", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15845/mbox/", "series": [ { "id": 3106, "url": "https://patchwork.libcamera.org/api/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/15845/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15845/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 1ADCBC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 May 2022 11:52:05 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 91EB165653;\n\tTue, 10 May 2022 13:52:04 +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 0FC636564A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 May 2022 13:52:01 +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 39982E0C;\n\tTue, 10 May 2022 13:52:00 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652183524;\n\tbh=vVaxZhjLlAQkxGPt/Aih151SXhS9D/3jxSOJe0M5h7Q=;\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=b97q0VgRe5yTGL0SLu1LBJHLpETvtSYB/5NWHuHtDuzeDXNWZuRNTxTyPkqPoh000\n\t08LwEDwy2ET2isXtmlSr3Yu81xkxGYwNK6h33Z9PCdOQK0U9ipmlcQMCyRHeRtwCbA\n\tDWb1VbYKoEXhPLL80kV2R42MsGRz4E2XZ23fSGho+FU9Epdwb7cd0x1XRRZWM6T/O2\n\t898Piy762neLsTMuu2+0GRecnzJPzcxBMGZsZDmZuaPi8+RoWIdKqXG0S+UiI4EsP2\n\tIUZQK1tT4Tx6c9hkW7eau17YhMzgCHAA2tWK2U3Grzc9CGRTi91NaiYdC/2nkKEReY\n\tWxdaW1whmV/Bg==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652183520;\n\tbh=vVaxZhjLlAQkxGPt/Aih151SXhS9D/3jxSOJe0M5h7Q=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=jbDgeBdPaafIyFAbKkC7qKyBITE8IE8DigN3Uded1kQlU63eEft5M+OfzH62Cbuu/\n\t+5DJXHtk5s9OZSlJY3rBQHNrf/jPviyUupITzs7SnO3TihMbjonmgdtvrjjMcLXS1Q\n\tPXSJmmFO9xx1t15HRz3WOQER1U3vj+eAZBcV0WYA=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"jbDgeBdP\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 10 May 2022 14:51:02 +0300", "Message-Id": "<20220510115147.19360-6-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 05/50] staging: media: imx:\n\timx7-media-csi: Drop the imx_media notifier", "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 V4L2 async notifier embedded in the imx_media_dev structure is\ntriggered when the CSI bridge subdev is registered. We don't need an\nasync notifier for this, as we can call the .complete() handler directly\nfrom the CSI bridge subdev .registered() handler.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n drivers/staging/media/imx/imx7-media-csi.c | 63 +++++++---------------\n 1 file changed, 19 insertions(+), 44 deletions(-)", "diff": "diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c\nindex e2d6dabad007..984f7bec15af 100644\n--- a/drivers/staging/media/imx/imx7-media-csi.c\n+++ b/drivers/staging/media/imx/imx7-media-csi.c\n@@ -721,11 +721,6 @@ static irqreturn_t imx7_csi_irq_handler(int irq, void *data)\n * Temporary copy of imx_media_dev helpers\n */\n \n-static inline struct imx_media_dev *notifier2dev(struct v4l2_async_notifier *n)\n-{\n-\treturn container_of(n, struct imx_media_dev, notifier);\n-}\n-\n /*\n * adds given video device to given imx-media source pad vdev list.\n * Continues upstream from the pad entity's sink pads.\n@@ -848,9 +843,8 @@ static int imx_media_create_pad_vdev_lists(struct imx_media_dev *imxmd)\n }\n \n /* async subdev complete notifier */\n-static int __imx_media_probe_complete(struct v4l2_async_notifier *notifier)\n+static int __imx_media_probe_complete(struct imx_media_dev *imxmd)\n {\n-\tstruct imx_media_dev *imxmd = notifier2dev(notifier);\n \tint ret;\n \n \tmutex_lock(&imxmd->mutex);\n@@ -868,33 +862,6 @@ static int __imx_media_probe_complete(struct v4l2_async_notifier *notifier)\n \treturn media_device_register(&imxmd->md);\n }\n \n-static const struct v4l2_async_notifier_operations imx_media_notifier_ops = {\n-\t.complete = __imx_media_probe_complete,\n-};\n-\n-static int __imx_media_dev_notifier_register(struct imx_media_dev *imxmd,\n-\t\t\t const struct v4l2_async_notifier_operations *ops)\n-{\n-\tint ret;\n-\n-\t/* no subdevs? just bail */\n-\tif (list_empty(&imxmd->notifier.asd_list)) {\n-\t\tv4l2_err(&imxmd->v4l2_dev, \"no subdevs\\n\");\n-\t\treturn -ENODEV;\n-\t}\n-\n-\t/* prepare the async subdev notifier and register it */\n-\timxmd->notifier.ops = ops ? ops : &imx_media_notifier_ops;\n-\tret = v4l2_async_nf_register(&imxmd->v4l2_dev, &imxmd->notifier);\n-\tif (ret) {\n-\t\tv4l2_err(&imxmd->v4l2_dev,\n-\t\t\t \"v4l2_async_nf_register failed with %d\\n\", ret);\n-\t\treturn ret;\n-\t}\n-\n-\treturn 0;\n-}\n-\n /* -----------------------------------------------------------------------------\n * V4L2 Subdev Operations\n */\n@@ -1247,10 +1214,12 @@ static int imx7_csi_registered(struct v4l2_subdev *sd)\n \n \tret = imx_media_capture_device_register(csi->vdev,\n \t\t\t\t\t\tMEDIA_LNK_FL_IMMUTABLE);\n-\tif (ret)\n+\tif (ret) {\n \t\timx_media_capture_device_remove(csi->vdev);\n+\t\treturn ret;\n+\t}\n \n-\treturn ret;\n+\treturn __imx_media_probe_complete(csi->imxmd);\n }\n \n static void imx7_csi_unregistered(struct v4l2_subdev *sd)\n@@ -1316,8 +1285,16 @@ static int imx7_csi_notify_bound(struct v4l2_async_notifier *notifier,\n \t\t\t\t\t MEDIA_LNK_FL_IMMUTABLE);\n }\n \n+static int imx7_csi_notify_complete(struct v4l2_async_notifier *notifier)\n+{\n+\tstruct imx7_csi *csi = imx7_csi_notifier_to_dev(notifier);\n+\n+\treturn v4l2_device_register_subdev_nodes(&csi->imxmd->v4l2_dev);\n+}\n+\n static const struct v4l2_async_notifier_operations imx7_csi_notify_ops = {\n \t.bound = imx7_csi_notify_bound,\n+\t.complete = imx7_csi_notify_complete,\n };\n \n static int imx7_csi_async_register(struct imx7_csi *csi)\n@@ -1346,11 +1323,11 @@ static int imx7_csi_async_register(struct imx7_csi *csi)\n \n \tcsi->notifier.ops = &imx7_csi_notify_ops;\n \n-\tret = v4l2_async_subdev_nf_register(&csi->sd, &csi->notifier);\n+\tret = v4l2_async_nf_register(&csi->imxmd->v4l2_dev, &csi->notifier);\n \tif (ret)\n \t\treturn ret;\n \n-\treturn v4l2_async_register_subdev(&csi->sd);\n+\treturn 0;\n }\n \n static void imx7_csi_media_cleanup(struct imx7_csi *csi)\n@@ -1378,12 +1355,6 @@ static int imx7_csi_media_init(struct imx7_csi *csi)\n \t\treturn ret;\n \t}\n \n-\tret = __imx_media_dev_notifier_register(imxmd, NULL);\n-\tif (ret < 0) {\n-\t\timx7_csi_media_cleanup(csi);\n-\t\treturn ret;\n-\t}\n-\n \tcsi->imxmd = imxmd;\n \n \treturn 0;\n@@ -1458,6 +1429,10 @@ static int imx7_csi_probe(struct platform_device *pdev)\n \tif (ret < 0)\n \t\tgoto cleanup;\n \n+\tret = v4l2_device_register_subdev(&csi->imxmd->v4l2_dev, &csi->sd);\n+\tif (ret)\n+\t\tgoto cleanup;\n+\n \tret = imx7_csi_async_register(csi);\n \tif (ret)\n \t\tgoto subdev_notifier_cleanup;\n", "prefixes": [ "libcamera-devel", "05/50" ] }