[{"id":3147,"web_url":"https://patchwork.libcamera.org/comment/3147/","msgid":"<20191127144531.r3pvlszzaac3cwhz@uno.localdomain>","date":"2019-11-27T14:45:31","subject":"Re: [libcamera-devel] [PATCH 10/30] libcamera: buffer: Drop private\n\tfunction setRequest()","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Wed, Nov 27, 2019 at 12:36:00AM +0100, Niklas Söderlund wrote:\n> There is no need to have a private helper function to access a private\n> data member when a friend statement is needed anyhow. Remove the helper\n> function to simplify the code and make it clear that a private member of\n> Buffer is accessed.\n>\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> ---\n>  include/libcamera/buffer.h | 2 --\n>  src/libcamera/buffer.cpp   | 8 --------\n>  src/libcamera/request.cpp  | 4 ++--\n>  3 files changed, 2 insertions(+), 12 deletions(-)\n>\n> diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\n> index afcef805801a43b5..d6db6138ca11d5fe 100644\n> --- a/include/libcamera/buffer.h\n> +++ b/include/libcamera/buffer.h\n> @@ -135,8 +135,6 @@ private:\n>\n>  \tvoid cancel();\n>\n> -\tvoid setRequest(Request *request) { request_ = request; }\n> -\n>  \tunsigned int index_;\n>  \tstd::array<int, 3> dmabuf_;\n>  \tBufferMemory *mem_;\n> diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\n> index 82b4799a2510d02f..7043345c3f3207cd 100644\n> --- a/src/libcamera/buffer.cpp\n> +++ b/src/libcamera/buffer.cpp\n> @@ -462,7 +462,6 @@ Buffer::Buffer(unsigned int index, const Buffer *metadata)\n>   *\n>   * \\return The Request the Buffer belongs to, or nullptr if the buffer is\n>   * either completed or not associated with a request\n> - * \\sa Buffer::setRequest()\n>   */\n>\n>  /**\n> @@ -489,13 +488,6 @@ void Buffer::cancel()\n>  \tstatus_ = BufferCancelled;\n>  }\n>\n> -/**\n> - * \\fn Buffer::setRequest()\n> - * \\brief Set the request this buffer belongs to\n> - *\n> - * The intended callers are Request::prepare() and Request::completeBuffer().\n> - */\n> -\n>  /**\n>   * \\class FrameBuffer\n>   * \\brief A buffer handle and dynamic metadata\n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index c14ed1a4d3ce55d0..c2854dc2e8caab2e 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -220,7 +220,7 @@ int Request::prepare()\n>\n>  \tfor (auto const &pair : bufferMap_) {\n>  \t\tBuffer *buffer = pair.second;\n> -\t\tbuffer->setRequest(this);\n> +\t\tbuffer->request_ = this;\n>  \t\tpending_.insert(buffer);\n>  \t}\n>\n> @@ -258,7 +258,7 @@ bool Request::completeBuffer(Buffer *buffer)\n>  \tint ret = pending_.erase(buffer);\n>  \tASSERT(ret == 1);\n>\n> -\tbuffer->setRequest(nullptr);\n> +\tbuffer->request_ = nullptr;\n>\n>  \tif (buffer->status() == Buffer::BufferCancelled)\n>  \t\tcancelled_ = true;\n> --\n> 2.24.0\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B8F1160C33\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Nov 2019 15:43:24 +0100 (CET)","from uno.localdomain (93-34-114-233.ip49.fastwebnet.it\n\t[93.34.114.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 473F540008;\n\tWed, 27 Nov 2019 14:43:24 +0000 (UTC)"],"X-Originating-IP":"93.34.114.233","Date":"Wed, 27 Nov 2019 15:45:31 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191127144531.r3pvlszzaac3cwhz@uno.localdomain>","References":"<20191126233620.1695316-1-niklas.soderlund@ragnatech.se>\n\t<20191126233620.1695316-11-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"d23ad2vieyjclapm\"","Content-Disposition":"inline","In-Reply-To":"<20191126233620.1695316-11-niklas.soderlund@ragnatech.se>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 10/30] libcamera: buffer: Drop private\n\tfunction setRequest()","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>","X-List-Received-Date":"Wed, 27 Nov 2019 14:43:24 -0000"}},{"id":3231,"web_url":"https://patchwork.libcamera.org/comment/3231/","msgid":"<20191209182139.GA18060@pendragon.ideasonboard.com>","date":"2019-12-09T18:21:39","subject":"Re: [libcamera-devel] [PATCH 10/30] libcamera: buffer: Drop private\n\tfunction setRequest()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Wed, Nov 27, 2019 at 12:36:00AM +0100, Niklas Söderlund wrote:\n> There is no need to have a private helper function to access a private\n> data member when a friend statement is needed anyhow. Remove the helper\n> function to simplify the code and make it clear that a private member of\n> Buffer is accessed.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  include/libcamera/buffer.h | 2 --\n>  src/libcamera/buffer.cpp   | 8 --------\n>  src/libcamera/request.cpp  | 4 ++--\n>  3 files changed, 2 insertions(+), 12 deletions(-)\n> \n> diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\n> index afcef805801a43b5..d6db6138ca11d5fe 100644\n> --- a/include/libcamera/buffer.h\n> +++ b/include/libcamera/buffer.h\n> @@ -135,8 +135,6 @@ private:\n>  \n>  \tvoid cancel();\n>  \n> -\tvoid setRequest(Request *request) { request_ = request; }\n> -\n>  \tunsigned int index_;\n>  \tstd::array<int, 3> dmabuf_;\n>  \tBufferMemory *mem_;\n> diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\n> index 82b4799a2510d02f..7043345c3f3207cd 100644\n> --- a/src/libcamera/buffer.cpp\n> +++ b/src/libcamera/buffer.cpp\n> @@ -462,7 +462,6 @@ Buffer::Buffer(unsigned int index, const Buffer *metadata)\n>   *\n>   * \\return The Request the Buffer belongs to, or nullptr if the buffer is\n>   * either completed or not associated with a request\n> - * \\sa Buffer::setRequest()\n>   */\n>  \n>  /**\n> @@ -489,13 +488,6 @@ void Buffer::cancel()\n>  \tstatus_ = BufferCancelled;\n>  }\n>  \n> -/**\n> - * \\fn Buffer::setRequest()\n> - * \\brief Set the request this buffer belongs to\n> - *\n> - * The intended callers are Request::prepare() and Request::completeBuffer().\n> - */\n\nI'm fine with the change overall, but I'm concerned about losing this\npart of the documentation. Could you document the private request_\nmember to keep track of this ?\n\n/**\n * \\var Buffer::request_\n * \\brief The request this buffer belongs to\n *\n * This member is intended to be set by Request::prepare() and\n * Request::completeBuffer().\n */\n\nApart from that,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> -\n>  /**\n>   * \\class FrameBuffer\n>   * \\brief A buffer handle and dynamic metadata\n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index c14ed1a4d3ce55d0..c2854dc2e8caab2e 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -220,7 +220,7 @@ int Request::prepare()\n>  \n>  \tfor (auto const &pair : bufferMap_) {\n>  \t\tBuffer *buffer = pair.second;\n> -\t\tbuffer->setRequest(this);\n> +\t\tbuffer->request_ = this;\n>  \t\tpending_.insert(buffer);\n>  \t}\n>  \n> @@ -258,7 +258,7 @@ bool Request::completeBuffer(Buffer *buffer)\n>  \tint ret = pending_.erase(buffer);\n>  \tASSERT(ret == 1);\n>  \n> -\tbuffer->setRequest(nullptr);\n> +\tbuffer->request_ = nullptr;\n>  \n>  \tif (buffer->status() == Buffer::BufferCancelled)\n>  \t\tcancelled_ = true;","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8B1EA60BDB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Dec 2019 19:21:47 +0100 (CET)","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 EE60F11B7;\n\tMon,  9 Dec 2019 19:21:46 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1575915707;\n\tbh=SfuWyUfSa59izSaFRtU3+XhCjfX3XqeiiZ8pMB52n3I=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=sEa/JwTmJPar2JV85yHIgFkaYlGB6pV2mJ5SUATK9UEB5NK6iOVk47n/f9LUxi5AD\n\t7wz8RAh7W87ov4iu69PNlLnZaa+JlKngY6BOZQmAOWAqB5YJ4lfTrnEz0RFexkvHsY\n\tG9KT8L5SGmn1bE0GWcsMtohdrESQzRlX17q4uEcQ=","Date":"Mon, 9 Dec 2019 20:21:39 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191209182139.GA18060@pendragon.ideasonboard.com>","References":"<20191126233620.1695316-1-niklas.soderlund@ragnatech.se>\n\t<20191126233620.1695316-11-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20191126233620.1695316-11-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 10/30] libcamera: buffer: Drop private\n\tfunction setRequest()","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>","X-List-Received-Date":"Mon, 09 Dec 2019 18:21:47 -0000"}}]