[{"id":22248,"web_url":"https://patchwork.libcamera.org/comment/22248/","msgid":"<d22add5e-8c39-e5b9-453d-4a4ff809d098@gmail.com>","date":"2022-03-09T15:45:37","subject":"Re: [libcamera-devel] [PATCH v3 4/5] media: entity: Add support for\n\tancillary links","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi !\n\nThanks for the patch !\n\nOn 02/03/2022 23:03, Daniel Scally wrote:\n> Add functions to create ancillary links, so that they don't need to\n> be manually created by users.\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Daniel Scally <djrscally@gmail.com>\n\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\n> ---\n> \n> Changes since v2:\n> \n> \t- Fixed some typos and comment phrasing (Laurent)\n> \t- Changed the position of the new function to go after media_entity_call()\n> \t(Laurent)\n> \n> Changes since v1:\n> \n> \t- Hardcoded MEDIA_LINK_FL_IMMUTABLE and MEDIA_LINK_FL_ENABLED (Laurent)\n> \n> Changes since the rfc:\n> \n> \t- (Laurent) Set gobj0 and gobj1 directly instead of the other union\n> \tmembers\n> \t- (Laurent) Added MEDIA_LNK_FL_IMMUTABLE to the kerneldoc for the new\n> \tcreate function\n> \n>   drivers/media/mc/mc-entity.c | 22 ++++++++++++++++++++++\n>   include/media/media-entity.h | 19 +++++++++++++++++++\n>   2 files changed, 41 insertions(+)\n> \n> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c\n> index 1a7d0a4fb9e8..d7e2f78a83cc 100644\n> --- a/drivers/media/mc/mc-entity.c\n> +++ b/drivers/media/mc/mc-entity.c\n> @@ -1032,3 +1032,25 @@ void media_remove_intf_links(struct media_interface *intf)\n>   \tmutex_unlock(&mdev->graph_mutex);\n>   }\n>   EXPORT_SYMBOL_GPL(media_remove_intf_links);\n> +\n> +struct media_link *media_create_ancillary_link(struct media_entity *primary,\n> +\t\t\t\t\t       struct media_entity *ancillary)\n> +{\n> +\tstruct media_link *link;\n> +\n> +\tlink = media_add_link(&primary->links);\n> +\tif (!link)\n> +\t\treturn ERR_PTR(-ENOMEM);\n> +\n> +\tlink->gobj0 = &primary->graph_obj;\n> +\tlink->gobj1 = &ancillary->graph_obj;\n> +\tlink->flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED |\n> +\t\t      MEDIA_LNK_FL_ANCILLARY_LINK;\n> +\n> +\t/* Initialize graph object embedded in the new link */\n> +\tmedia_gobj_create(primary->graph_obj.mdev, MEDIA_GRAPH_LINK,\n> +\t\t\t  &link->graph_obj);\n> +\n> +\treturn link;\n> +}\n> +EXPORT_SYMBOL_GPL(media_create_ancillary_link);\n> diff --git a/include/media/media-entity.h b/include/media/media-entity.h\n> index fea489f03d57..2a58defc4886 100644\n> --- a/include/media/media-entity.h\n> +++ b/include/media/media-entity.h\n> @@ -1108,4 +1108,23 @@ void media_remove_intf_links(struct media_interface *intf);\n>   \t(((entity)->ops && (entity)->ops->operation) ?\t\t\t\\\n>   \t (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD)\n>   \n> +/**\n> + * media_create_ancillary_link() - create an ancillary link between two\n> + *\t\t\t\t   instances of &media_entity\n> + *\n> + * @primary:\tpointer to the primary &media_entity\n> + * @ancillary:\tpointer to the ancillary &media_entity\n> + *\n> + * Create an ancillary link between two entities, indicating that they\n> + * represent two connected pieces of hardware that form a single logical unit.\n> + * A typical example is a camera lens controller being linked to the sensor that\n> + * it is supporting.\n> + *\n> + * The function sets both MEDIA_LNK_FL_ENABLED and MEDIA_LNK_FL_IMMUTABLE for\n> + * the new link.\n> + */\n> +struct media_link *\n> +media_create_ancillary_link(struct media_entity *primary,\n> +\t\t\t    struct media_entity *ancillary);\n> +\n>   #endif","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 30FB5BE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Mar 2022 15:45:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DEB5F6118B;\n\tWed,  9 Mar 2022 16:45:41 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E1FC60475\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Mar 2022 16:45:40 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:3734:287e:1a7f:9772] (unknown\n\t[IPv6:2a01:e0a:169:7140:3734:287e:1a7f:9772])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4AFD2A50;\n\tWed,  9 Mar 2022 16:45:40 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1646840741;\n\tbh=K/rtU6rxT03auNCPxbcPxWf6OPu9oIcbJcJrlm2MB0k=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=QC9IYtkm7S87zGnm6+3sAYw43LeMKdp493twkZt5BpZsVyp05CBnp0tJf8R3+fGYu\n\tPdvfAY9zGCigam1nNFsCZikypB2lstD5C4e+TnqWc4OCOQPb7/a0w2Tbh+J8fVSrBR\n\tUtA42yqvTSEE+eF7XnYytzw8idbyVZ0+zKKXvBBrM8jtocrv7sAyGqyyJADECOhxmg\n\t6ZkJDZr9K92mBaNICO7k7w5xMQwEVrF/JhOf/X3VNpB4zpenCwjXo9Ky7ih9mhmmvl\n\tC5GtFVXPKPZBFVb0FyFybr51ITTx8ncU1HCWjkwU4DSv9iHMoBdRrazuGCCWGR/ZwH\n\t/kldVwA6MY49w==","Message-ID":"<d22add5e-8c39-e5b9-453d-4a4ff809d098@gmail.com>","Date":"Wed, 9 Mar 2022 16:45:37 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.5.0","Content-Language":"en-US","To":"Daniel Scally <djrscally@gmail.com>, linux-media@vger.kernel.org,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220302220304.1327896-1-djrscally@gmail.com>\n\t<20220302220304.1327896-5-djrscally@gmail.com>","In-Reply-To":"<20220302220304.1327896-5-djrscally@gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 4/5] media: entity: Add support for\n\tancillary links","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":"Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Jean-Michel Hautbois <jeanmichel.hautbois@gmail.com>","Cc":"sakari.ailus@linux.intel.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]