[{"id":30842,"web_url":"https://patchwork.libcamera.org/comment/30842/","msgid":"<20240815211828.GB21937@pendragon.ideasonboard.com>","date":"2024-08-15T21:18:28","subject":"Re: [PATCH 2/3] libcamera: media_device: Use MediaLink string helper","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Aug 15, 2024 at 10:09:24PM +0100, Kieran Bingham wrote:\n> Replace the two open-coded implementations of a link representation\n> with the operator<< overload string representation to simplify\n> the code and unify appearance of reporting MediaLinks.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/libcamera/media_device.cpp | 14 ++++----------\n>  1 file changed, 4 insertions(+), 10 deletions(-)\n> \n> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n> index bd054552a093..c1ea58996fa8 100644\n> --- a/src/libcamera/media_device.cpp\n> +++ b/src/libcamera/media_device.cpp\n> @@ -817,21 +817,15 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)\n>  \tint ret = ioctl(fd_.get(), MEDIA_IOC_SETUP_LINK, &linkDesc);\n>  \tif (ret) {\n>  \t\tret = -errno;\n> +\n>  \t\tLOG(MediaDevice, Error)\n> -\t\t\t<< \"Failed to setup link \"\n> -\t\t\t<< source->entity()->name() << \"[\"\n> -\t\t\t<< source->index() << \"] -> \"\n> -\t\t\t<< sink->entity()->name() << \"[\"\n> -\t\t\t<< sink->index() << \"]: \"\n> +\t\t\t<< \"Failed to setup link \" << *link << \": \"\n>  \t\t\t<< strerror(-ret);\n> +\n\nI'm not sure I would have added the blank lines, but that's fine too.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \t\treturn ret;\n>  \t}\n>  \n> -\tLOG(MediaDevice, Debug)\n> -\t\t<< source->entity()->name() << \"[\"\n> -\t\t<< source->index() << \"] -> \"\n> -\t\t<< sink->entity()->name() << \"[\"\n> -\t\t<< sink->index() << \"]: \" << flags;\n> +\tLOG(MediaDevice, Debug) << *link << \": \" << flags;\n>  \n>  \treturn 0;\n>  }","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 AB361BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Aug 2024 21:18:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5C97E633B3;\n\tThu, 15 Aug 2024 23:18:56 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DAE7261955\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Aug 2024 23:18:54 +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 129E1827;\n\tThu, 15 Aug 2024 23:17:56 +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=\"hhqkjvtG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723756676;\n\tbh=0RzGHyLEtcK18+68wD7vKu445lr98oM7GGpO9WcQYj0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hhqkjvtGzaSZcYU7JX7SidgRK//7HIczrUKZajf/9zUNdGfjnM4OeZ8s/YkF8z6Pz\n\tuqNXXmERb9isFdT+s9rnXD/ukqU8IBFj6VUrt1O5JTwtQl4UF33WxKfRAsHyE9Oxzr\n\tdIQn1tA6Aae7f38qHdwEti2gWZewA/bMz8TIC6wo=","Date":"Fri, 16 Aug 2024 00:18:28 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH 2/3] libcamera: media_device: Use MediaLink string helper","Message-ID":"<20240815211828.GB21937@pendragon.ideasonboard.com>","References":"<20240815210925.4172287-1-kieran.bingham@ideasonboard.com>\n\t<20240815210925.4172287-3-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240815210925.4172287-3-kieran.bingham@ideasonboard.com>","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>"}},{"id":31186,"web_url":"https://patchwork.libcamera.org/comment/31186/","msgid":"<qo7hhdevxax37upcr4zbsmuex3s2oiuspyb5eqbjf3gp2alwpx@32zoxswxtf5r>","date":"2024-09-12T08:55:12","subject":"Re: [PATCH 2/3] libcamera: media_device: Use MediaLink string helper","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch. \n\nOn Thu, Aug 15, 2024 at 10:09:24PM +0100, Kieran Bingham wrote:\n> Replace the two open-coded implementations of a link representation\n> with the operator<< overload string representation to simplify\n> the code and unify appearance of reporting MediaLinks.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/libcamera/media_device.cpp | 14 ++++----------\n>  1 file changed, 4 insertions(+), 10 deletions(-)\n> \n> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n> index bd054552a093..c1ea58996fa8 100644\n> --- a/src/libcamera/media_device.cpp\n> +++ b/src/libcamera/media_device.cpp\n> @@ -817,21 +817,15 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)\n>  \tint ret = ioctl(fd_.get(), MEDIA_IOC_SETUP_LINK, &linkDesc);\n>  \tif (ret) {\n>  \t\tret = -errno;\n> +\n>  \t\tLOG(MediaDevice, Error)\n> -\t\t\t<< \"Failed to setup link \"\n> -\t\t\t<< source->entity()->name() << \"[\"\n> -\t\t\t<< source->index() << \"] -> \"\n> -\t\t\t<< sink->entity()->name() << \"[\"\n> -\t\t\t<< sink->index() << \"]: \"\n> +\t\t\t<< \"Failed to setup link \" << *link << \": \"\n>  \t\t\t<< strerror(-ret);\n> +\n\nOhh, so much easier to read.\n\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> \n\nRegards,\nStefan\n\n>  \t\treturn ret;\n>  \t}\n>  \n> -\tLOG(MediaDevice, Debug)\n> -\t\t<< source->entity()->name() << \"[\"\n> -\t\t<< source->index() << \"] -> \"\n> -\t\t<< sink->entity()->name() << \"[\"\n> -\t\t<< sink->index() << \"]: \" << flags;\n> +\tLOG(MediaDevice, Debug) << *link << \": \" << flags;\n>  \n>  \treturn 0;\n>  }\n> -- \n> 2.34.1\n>","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 2D52ABF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 12 Sep 2024 08:55:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D63AD634FE;\n\tThu, 12 Sep 2024 10:55:16 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 28D6B634F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Sep 2024 10:55:15 +0200 (CEST)","from ideasonboard.com (213-229-8-243.static.upcbusiness.at\n\t[213.229.8.243])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 02E802C6;\n\tThu, 12 Sep 2024 10:53:56 +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=\"jwhv1fXr\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726131237;\n\tbh=VAURu/wKAs4dU2ISXm8w3BDvvkju5oq/SPuujowl3aE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jwhv1fXr1rphiU7h5fxrGUue2ZukcCSJ24dWIN+e62LJQ4TFv58GmlVrjRADuh7wE\n\tvqDgUAEPuWAHMbMFzTupTJcN6QGZXsOCDyI3yqtQSc16xVYy5Zwxx8yLn6191u5ct5\n\thz8HGfegxaL5Lsqy79fe6xWM8jBTxxEnztNNf1R4=","Date":"Thu, 12 Sep 2024 10:55:12 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH 2/3] libcamera: media_device: Use MediaLink string helper","Message-ID":"<qo7hhdevxax37upcr4zbsmuex3s2oiuspyb5eqbjf3gp2alwpx@32zoxswxtf5r>","References":"<20240815210925.4172287-1-kieran.bingham@ideasonboard.com>\n\t<20240815210925.4172287-3-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240815210925.4172287-3-kieran.bingham@ideasonboard.com>","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>"}}]