[{"id":1161,"web_url":"https://patchwork.libcamera.org/comment/1161/","msgid":"<20190401215537.GK4787@pendragon.ideasonboard.com>","date":"2019-04-01T21:55:37","subject":"Re: [libcamera-devel] [PATCH v5 05/19] libcamera: v4l2_subdevice:\n\tRename deviceName() method","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Mar 26, 2019 at 09:38:48AM +0100, Jacopo Mondi wrote:\n> Rename the 'deviceName()' method to 'entityName()' as it actually\n> returns the name of the entity backing the v4l2 subdevice.\n> \n> While at it, make the names getter methods return a const reference\n> instead of returning by copy.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/include/v4l2_subdevice.h | 4 ++--\n>  src/libcamera/v4l2_subdevice.cpp       | 4 ++--\n>  test/v4l2_subdevice/list_formats.cpp   | 6 +++---\n>  3 files changed, 7 insertions(+), 7 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> index 3ecf08514898..f42cccabda94 100644\n> --- a/src/libcamera/include/v4l2_subdevice.h\n> +++ b/src/libcamera/include/v4l2_subdevice.h\n> @@ -37,8 +37,8 @@ public:\n>  \tbool isOpen() const;\n>  \tvoid close();\n>  \n> -\tstd::string deviceNode() const { return entity_->deviceNode(); }\n> -\tstd::string deviceName() const { return entity_->name(); }\n> +\tconst std::string &deviceNode() const { return entity_->deviceNode(); }\n> +\tconst std::string &entityName() const { return entity_->name(); }\n>  \n>  \tint setCrop(unsigned int pad, Rectangle *rect);\n>  \tint setCompose(unsigned int pad, Rectangle *rect);\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 8260e6ebce0e..10925f9fe497 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -166,7 +166,7 @@ void V4L2Subdevice::close()\n>   */\n>  \n>  /**\n> - * \\fn V4L2Subdevice::deviceName()\n> + * \\fn V4L2Subdevice::entityName()\n>   * \\brief Retrieve the name of the media entity associated with the subdevice\n>   *\n>   * \\return The name of the media entity the subdevice is associated to\n> @@ -315,7 +315,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n>  \n>  std::string V4L2Subdevice::logPrefix() const\n>  {\n> -\treturn \"'\" + deviceName() + \"'\";\n> +\treturn \"'\" + entityName() + \"'\";\n>  }\n>  \n>  int V4L2Subdevice::enumPadSizes(unsigned int pad,unsigned int code,\n> diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp\n> index bf8597797d4b..db486554b7b5 100644\n> --- a/test/v4l2_subdevice/list_formats.cpp\n> +++ b/test/v4l2_subdevice/list_formats.cpp\n> @@ -51,7 +51,7 @@ int ListFormatsTest::run()\n>  \tformats = scaler_->formats(0);\n>  \tif (formats.empty()) {\n>  \t\tcerr << \"Failed to list formats on pad 0 of subdevice \"\n> -\t\t     << scaler_->deviceName() << endl;\n> +\t\t     << scaler_->entityName() << endl;\n>  \t\treturn TestFail;\n>  \t}\n>  \tfor (auto it = formats.begin(); it != formats.end(); ++it)\n> @@ -60,7 +60,7 @@ int ListFormatsTest::run()\n>  \tformats = scaler_->formats(1);\n>  \tif (formats.empty()) {\n>  \t\tcerr << \"Failed to list formats on pad 1 of subdevice \"\n> -\t\t     << scaler_->deviceName() << endl;\n> +\t\t     << scaler_->entityName() << endl;\n>  \t\treturn TestFail;\n>  \t}\n>  \tfor (auto it = formats.begin(); it != formats.end(); ++it)\n> @@ -70,7 +70,7 @@ int ListFormatsTest::run()\n>  \tformats = scaler_->formats(2);\n>  \tif (!formats.empty()) {\n>  \t\tcerr << \"Listing formats on non-existing pad 2 of subdevice \"\n> -\t\t     << scaler_->deviceName()\n> +\t\t     << scaler_->entityName()\n>  \t\t     << \" should return an empty format list\" << endl;\n>  \t\treturn TestFail;\n>  \t}","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4F31D610B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Apr 2019 23:55:48 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AF886542;\n\tMon,  1 Apr 2019 23:55:47 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554155747;\n\tbh=7aKIbNoBDJ5s/nQOgKmXJqlaCKohAVX3IyPFRgkieC4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=rq1Uz3svL0Y2Dpe5fNsgsPv6E159V0nlt++4lor04JcBpXbwJUjOAPQuzbxWhDP3K\n\tBM1Xhx0dx95k3OzML29RzV0Q2bSeum7ou3R364sxLLv1WLj6XSIPQpnwwHGhLBqrNn\n\tnYHqG4bVNXJJSdSNKkIoWkbFyhQkrrR7R8RdJJVU=","Date":"Tue, 2 Apr 2019 00:55:37 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190401215537.GK4787@pendragon.ideasonboard.com>","References":"<20190326083902.26121-1-jacopo@jmondi.org>\n\t<20190326083902.26121-6-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190326083902.26121-6-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 05/19] libcamera: v4l2_subdevice:\n\tRename deviceName() method","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Mon, 01 Apr 2019 21:55:48 -0000"}}]