[{"id":21785,"web_url":"https://patchwork.libcamera.org/comment/21785/","msgid":"<YbkSkjEKagLDeIm7@pendragon.ideasonboard.com>","date":"2021-12-14T21:54:26","subject":"Re: [libcamera-devel] [PATCH 2/5] media: entity: Add link_type()\n\thelper","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Daniel,\n\nThank you for the patch.\n\nOn Mon, Dec 13, 2021 at 11:28:46PM +0000, Daniel Scally wrote:\n> Now we have three types of media link, printing the right name during\n> debug output is slightly more complicated. Add a helper function to\n> make it easier.\n> \n> Signed-off-by: Daniel Scally <djrscally@gmail.com>\n> ---\n> Changes since the rfc:\n> \n> \t- new patch\n> \n>  drivers/media/mc/mc-entity.c | 18 +++++++++++++++---\n>  1 file changed, 15 insertions(+), 3 deletions(-)\n> \n> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c\n> index f40f41977142..d79eb88bc167 100644\n> --- a/drivers/media/mc/mc-entity.c\n> +++ b/drivers/media/mc/mc-entity.c\n> @@ -60,6 +60,20 @@ static inline const char *intf_type(struct media_interface *intf)\n>  \t}\n>  };\n>  \n> +static inline const char *link_type(struct media_link *link)\n\nThis could be named link_type_name() to avoid confusion with a function\nthat would return the link type.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +{\n> +\tswitch (link->flags & MEDIA_LNK_FL_LINK_TYPE) {\n> +\tcase MEDIA_LNK_FL_DATA_LINK:\n> +\t\treturn \"data\";\n> +\tcase MEDIA_LNK_FL_INTERFACE_LINK:\n> +\t\treturn \"interface\";\n> +\tcase MEDIA_LNK_FL_ANCILLARY_LINK:\n> +\t\treturn \"ancillary\";\n> +\tdefault:\n> +\t\treturn \"unknown\";\n> +\t}\n> +}\n> +\n>  __must_check int __media_entity_enum_init(struct media_entity_enum *ent_enum,\n>  \t\t\t\t\t  int idx_max)\n>  {\n> @@ -107,9 +121,7 @@ static void dev_dbg_obj(const char *event_name,  struct media_gobj *gobj)\n>  \n>  \t\tdev_dbg(gobj->mdev->dev,\n>  \t\t\t\"%s id %u: %s link id %u ==> id %u\\n\",\n> -\t\t\tevent_name, media_id(gobj),\n> -\t\t\tmedia_type(link->gobj0) == MEDIA_GRAPH_PAD ?\n> -\t\t\t\t\"data\" : \"interface\",\n> +\t\t\tevent_name, media_id(gobj), link_type(link),\n>  \t\t\tmedia_id(link->gobj0),\n>  \t\t\tmedia_id(link->gobj1));\n>  \t\tbreak;","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 98B56BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Dec 2021 21:54:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4A607608A4;\n\tTue, 14 Dec 2021 22:54:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B8CD360117\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Dec 2021 22:54:28 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2736A8C4;\n\tTue, 14 Dec 2021 22:54:28 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"V9qg3m16\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1639518868;\n\tbh=yNLGVFmTg/8cjJ/r3T2+9yXwI7SLhzjYf/wX6Q2FxoY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=V9qg3m160xfANEt5QYPch1gTrOElAZMCFB1Ocn8YA9FpiAkKrKbjOSP8G8rfgrVxQ\n\taejAABH5BiG2/K14dNWOQaY2Vw0q5PbxAluRPQDlfQYNgsDnjONh8xsRRdRfF60Heh\n\tNYruTLv4ya+Hy93Wgyay90zbs4e1cRWn6/e4AF2s=","Date":"Tue, 14 Dec 2021 23:54:26 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Daniel Scally <djrscally@gmail.com>","Message-ID":"<YbkSkjEKagLDeIm7@pendragon.ideasonboard.com>","References":"<20211213232849.40071-1-djrscally@gmail.com>\n\t<20211213232849.40071-3-djrscally@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211213232849.40071-3-djrscally@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH 2/5] media: entity: Add link_type()\n\thelper","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>","Cc":"libcamera-devel@lists.libcamera.org, sakari.ailus@linux.intel.com,\n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21787,"web_url":"https://patchwork.libcamera.org/comment/21787/","msgid":"<5dbd888e-7a7c-bd16-9208-cf26ddeeb950@gmail.com>","date":"2021-12-14T21:57:31","subject":"Re: [libcamera-devel] [PATCH 2/5] media: entity: Add link_type()\n\thelper","submitter":{"id":90,"url":"https://patchwork.libcamera.org/api/people/90/","name":"Daniel Scally","email":"djrscally@gmail.com"},"content":"Hi Laurent\n\nOn 14/12/2021 21:54, Laurent Pinchart wrote:\n> Hi Daniel,\n>\n> Thank you for the patch.\n>\n> On Mon, Dec 13, 2021 at 11:28:46PM +0000, Daniel Scally wrote:\n>> Now we have three types of media link, printing the right name during\n>> debug output is slightly more complicated. Add a helper function to\n>> make it easier.\n>>\n>> Signed-off-by: Daniel Scally <djrscally@gmail.com>\n>> ---\n>> Changes since the rfc:\n>>\n>> \t- new patch\n>>\n>>  drivers/media/mc/mc-entity.c | 18 +++++++++++++++---\n>>  1 file changed, 15 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c\n>> index f40f41977142..d79eb88bc167 100644\n>> --- a/drivers/media/mc/mc-entity.c\n>> +++ b/drivers/media/mc/mc-entity.c\n>> @@ -60,6 +60,20 @@ static inline const char *intf_type(struct media_interface *intf)\n>>  \t}\n>>  };\n>>  \n>> +static inline const char *link_type(struct media_link *link)\n> This could be named link_type_name() to avoid confusion with a function\n> that would return the link type.\n\n\nProbably yeah - I'll do that in v2\n\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n\nThank you\n\n>\n>> +{\n>> +\tswitch (link->flags & MEDIA_LNK_FL_LINK_TYPE) {\n>> +\tcase MEDIA_LNK_FL_DATA_LINK:\n>> +\t\treturn \"data\";\n>> +\tcase MEDIA_LNK_FL_INTERFACE_LINK:\n>> +\t\treturn \"interface\";\n>> +\tcase MEDIA_LNK_FL_ANCILLARY_LINK:\n>> +\t\treturn \"ancillary\";\n>> +\tdefault:\n>> +\t\treturn \"unknown\";\n>> +\t}\n>> +}\n>> +\n>>  __must_check int __media_entity_enum_init(struct media_entity_enum *ent_enum,\n>>  \t\t\t\t\t  int idx_max)\n>>  {\n>> @@ -107,9 +121,7 @@ static void dev_dbg_obj(const char *event_name,  struct media_gobj *gobj)\n>>  \n>>  \t\tdev_dbg(gobj->mdev->dev,\n>>  \t\t\t\"%s id %u: %s link id %u ==> id %u\\n\",\n>> -\t\t\tevent_name, media_id(gobj),\n>> -\t\t\tmedia_type(link->gobj0) == MEDIA_GRAPH_PAD ?\n>> -\t\t\t\t\"data\" : \"interface\",\n>> +\t\t\tevent_name, media_id(gobj), link_type(link),\n>>  \t\t\tmedia_id(link->gobj0),\n>>  \t\t\tmedia_id(link->gobj1));\n>>  \t\tbreak;","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 23E90BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Dec 2021 21:57:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6A16E608A4;\n\tTue, 14 Dec 2021 22:57:34 +0100 (CET)","from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2BB6F60117\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Dec 2021 22:57:33 +0100 (CET)","by mail-wm1-x330.google.com with SMTP id i12so15288996wmq.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Dec 2021 13:57:33 -0800 (PST)","from [192.168.0.14]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161])\n\tby smtp.gmail.com with ESMTPSA id\n\tn1sm136774wrc.54.2021.12.14.13.57.32\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tTue, 14 Dec 2021 13:57:32 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"jEj68GIU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-transfer-encoding:content-language; \n\tbh=7YJ+ljj1RaWfI86h1NNp1sy5kcUAz6TRY4lpXHIm590=;\n\tb=jEj68GIUWk6SAxvn8GBqi3+IEv/7DcVqiX78UpBqIVP1ujexjJAiLzXgAXQIQzmh5j\n\tijTUTqKvd0tRwPc+txvyzcqtEVRvHA1SFsFVcbWy4MefTXaddvrMPTq4QetpOn197l8i\n\t77045qNnxDQ7dyLKEMPGS0yFLjdX23R7nM00iSHNCWp2xyUY2Ns6Uour2dW/6ZsbEzZ2\n\tcvHx8QjDE3Ev5OU+Q61Esf3JKF2BvxomAJUTpa9TjPFS7xfrBxHKDQAszD5xytb2DkTK\n\t7JfOCio8ucrxv49lQpBAlktzbfiS3lIgwxMFbcAfo8o1BcI0Oyb77vXcGCO9A27mQ2Od\n\tZ0gQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-transfer-encoding\n\t:content-language;\n\tbh=7YJ+ljj1RaWfI86h1NNp1sy5kcUAz6TRY4lpXHIm590=;\n\tb=0FL4Zos4o599mqrLCqW1hb7MlNL9/H8u27tDUE137yCVqRGF79VPB06r/oeMwQDsPc\n\tsxtnKwaWzAT5hhRouYfSSijqiibDCbtJgkC9RxMIniIxvCPKP0otj4dlhZu9PTVia8/9\n\tY3aoFDJnuu4lQNqGE3t9T7IfSTiOAUv6zsF8to9llqvkLWnwRkBZcYk52bTyBsS8M/nL\n\t7UVJ5a5sY6T0JRVLRhbemTG7tdibD0h05r5AVMWx3s5txqpMieTOWpXnyl2GqlclRJEi\n\tPQPhlt848B8z7NQGWqBuaygv3ADZgiECrTqNZGLqZWCmEKPjc713sFOl+2x4ukosfYfr\n\t9jcg==","X-Gm-Message-State":"AOAM531FGIYdzwCQ3ysnhSbuSpAho9GwVxKIbKSDNjlGne7G6axMMscB\n\tXVfR/zyMuQOH9Sj0gq6+QbQ=","X-Google-Smtp-Source":"ABdhPJyaSPsIQZhh6L34VjD2TkAj8QlbYf4PtdfjFgjjfBh6QLjO1zAaAAeCHFn/VsaukUcoa5nJ0Q==","X-Received":"by 2002:a05:600c:2dc8:: with SMTP id\n\te8mr1737087wmh.189.1639519052880; \n\tTue, 14 Dec 2021 13:57:32 -0800 (PST)","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20211213232849.40071-1-djrscally@gmail.com>\n\t<20211213232849.40071-3-djrscally@gmail.com>\n\t<YbkSkjEKagLDeIm7@pendragon.ideasonboard.com>","From":"Daniel Scally <djrscally@gmail.com>","Message-ID":"<5dbd888e-7a7c-bd16-9208-cf26ddeeb950@gmail.com>","Date":"Tue, 14 Dec 2021 21:57:31 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.14.0","MIME-Version":"1.0","In-Reply-To":"<YbkSkjEKagLDeIm7@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH 2/5] media: entity: Add link_type()\n\thelper","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>","Cc":"libcamera-devel@lists.libcamera.org, sakari.ailus@linux.intel.com,\n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]