Patch Detail
Show a patch.
GET /api/1.1/patches/20993/?format=api
{ "id": 20993, "url": "https://patchwork.libcamera.org/api/1.1/patches/20993/?format=api", "web_url": "https://patchwork.libcamera.org/patch/20993/", "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": "<20240822153527.25320-5-laurent.pinchart+renesas@ideasonboard.com>", "date": "2024-08-22T15:35:24", "name": "[v2,4/7] media: v4l2-subdev: Refactor warnings in v4l2_subdev_link_validate()", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "68982c452864bbd0a2d1d5dd7d8110a56b3a679f", "submitter": { "id": 204, "url": "https://patchwork.libcamera.org/api/1.1/people/204/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart+renesas@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/20993/mbox/", "series": [ { "id": 4533, "url": "https://patchwork.libcamera.org/api/1.1/series/4533/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4533", "date": "2024-08-22T15:35:20", "name": "media: v4l2: Improve media link validation", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4533/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/20993/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/20993/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 B1B44C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Aug 2024 15:35:43 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0CEC3633D1;\n\tThu, 22 Aug 2024 17:35:43 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 83412633CF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Aug 2024 17:35:36 +0200 (CEST)", "from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD3B51083;\n\tThu, 22 Aug 2024 17:34:32 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZO+znxHn\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724340872;\n\tbh=L6PW/jnfXa4+nyLEP2SbfgQft2F4O8LsNw4OqltCe/g=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZO+znxHn3QUDNjcqbTqpq5ynt1/dPTE2hJtRe/CxAqN3qTvmEwQOdWsZBUcucydF2\n\tzwQ90wAJuGORKewyOgycAP7hT2SqYnLS6qLd08JcWiMHip3QwfkO30trLNUHD7FUgC\n\tKOC5ntjV3Uq7n6yQcih78sejBZ7AzISFoIdO0lEA=", "From": "Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Chen-Yu Tsai <wens@csie.org>, Eugen Hristev <eugen.hristev@collabora.com>,\n\tHans Verkuil <hverkuil-cisco@xs4all.nl>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tMaxime Ripard <mripard@kernel.org>, Sakari Ailus <sakari.ailus@iki.fi>,\n\tTomi Valkeinen <tomi.valkeinen@ideasonboard.com>,\n\tlinux-renesas-soc@vger.kernel.org, linux-sunxi@lists.linux.dev", "Subject": "[PATCH v2 4/7] media: v4l2-subdev: Refactor warnings in\n\tv4l2_subdev_link_validate()", "Date": "Thu, 22 Aug 2024 18:35:24 +0300", "Message-ID": "<20240822153527.25320-5-laurent.pinchart+renesas@ideasonboard.com>", "X-Mailer": "git-send-email 2.44.2", "In-Reply-To": "<20240822153527.25320-1-laurent.pinchart+renesas@ideasonboard.com>", "References": "<20240822153527.25320-1-laurent.pinchart+renesas@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The v4l2_subdev_link_validate() function prints a one-time warning if it\ngets called on a link whose source or sink is not a subdev. As links get\nvalidated in the context of their sink, a call to the helper when the\nlink's sink is not a subdev indicates that the driver has set its\n.link_validate() handler to v4l2_subdev_link_validate() on a non-subdev\nentity, which is a clear driver bug. On the other hand, the link's\nsource not being a subdev indicates that the helper is used for a subdev\nconnected to a video output device, which is a lesser issue, if only\nbecause this is currently common practice.\n\nThere are no drivers left in the kernel that use\nv4l2_subdev_link_validate() in a context where it may get called on a\nnon-subdev sink. Replace the pr_warn_once() with a WARN_ON_ONCE() in\nthis case to make sure that new offenders won't be introduced.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>\n---\nChanges since v1:\n\n- Switch from WARN_ON() to WARN_ON_ONCE()\n---\n drivers/media/v4l2-core/v4l2-subdev.c | 14 +++++++++-----\n 1 file changed, 9 insertions(+), 5 deletions(-)", "diff": "diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c\nindex 7c5812d55315..d3196042d5c5 100644\n--- a/drivers/media/v4l2-core/v4l2-subdev.c\n+++ b/drivers/media/v4l2-core/v4l2-subdev.c\n@@ -1443,11 +1443,15 @@ int v4l2_subdev_link_validate(struct media_link *link)\n \tbool states_locked;\n \tint ret;\n \n-\tif (!is_media_entity_v4l2_subdev(link->sink->entity) ||\n-\t !is_media_entity_v4l2_subdev(link->source->entity)) {\n-\t\tpr_warn_once(\"%s of link '%s':%u->'%s':%u is not a V4L2 sub-device, driver bug!\\n\",\n-\t\t\t !is_media_entity_v4l2_subdev(link->sink->entity) ?\n-\t\t\t \"sink\" : \"source\",\n+\t/*\n+\t * Links are validated in the context of the sink entity. Usage of this\n+\t * helper on a sink that is not a subdev is a clear driver bug.\n+\t */\n+\tif (WARN_ON_ONCE(!is_media_entity_v4l2_subdev(link->sink->entity)))\n+\t\treturn -EINVAL;\n+\n+\tif (!is_media_entity_v4l2_subdev(link->source->entity)) {\n+\t\tpr_warn_once(\"source of link '%s':%u->'%s':%u is not a V4L2 sub-device, driver bug!\\n\",\n \t\t\t link->source->entity->name, link->source->index,\n \t\t\t link->sink->entity->name, link->sink->index);\n \t\treturn 0;\n", "prefixes": [ "v2", "4/7" ] }