From patchwork Mon Dec 30 12:04:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2456 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 65810605E8 for ; Mon, 30 Dec 2019 13:05:54 +0100 (CET) X-Halon-ID: ba3349c3-2afc-11ea-a00b-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2fd0.dip0.t-ipconnect.de [79.202.47.208]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id ba3349c3-2afc-11ea-a00b-005056917a89; Mon, 30 Dec 2019 13:05:53 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 30 Dec 2019 13:04:51 +0100 Message-Id: <20191230120510.938333-7-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191230120510.938333-1-niklas.soderlund@ragnatech.se> References: <20191230120510.938333-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 06/25] libcamera: buffer: Drop private function setRequest() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 12:05:55 -0000 There is no need to have a private helper function to access a private data member when a friend statement is needed anyhow. Remove the helper function to simplify the code and make it clear that a private member of Buffer is accessed. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/buffer.h | 2 -- src/libcamera/buffer.cpp | 8 ++++---- src/libcamera/request.cpp | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 2d8885e9f3a1234f..8dd9f91272291648 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -123,8 +123,6 @@ private: void cancel(); - void setRequest(Request *request) { request_ = request; } - unsigned int index_; std::array dmabuf_; BufferMemory *mem_; diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp index 3ea982306843b116..4a77f20751408b7c 100644 --- a/src/libcamera/buffer.cpp +++ b/src/libcamera/buffer.cpp @@ -279,7 +279,6 @@ Buffer::Buffer(unsigned int index, const Buffer *metadata) * * \return The Request the Buffer belongs to, or nullptr if the buffer is * either completed or not associated with a request - * \sa Buffer::setRequest() */ /** @@ -307,10 +306,11 @@ void Buffer::cancel() } /** - * \fn Buffer::setRequest() - * \brief Set the request this buffer belongs to + * \var Buffer::request_ + * \brief The request this buffer belongs to * - * The intended callers are Request::prepare() and Request::completeBuffer(). + * This member is intended to be set by Request::prepare() and + * Request::completeBuffer(). */ /** diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index c14ed1a4d3ce55d0..c2854dc2e8caab2e 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -220,7 +220,7 @@ int Request::prepare() for (auto const &pair : bufferMap_) { Buffer *buffer = pair.second; - buffer->setRequest(this); + buffer->request_ = this; pending_.insert(buffer); } @@ -258,7 +258,7 @@ bool Request::completeBuffer(Buffer *buffer) int ret = pending_.erase(buffer); ASSERT(ret == 1); - buffer->setRequest(nullptr); + buffer->request_ = nullptr; if (buffer->status() == Buffer::BufferCancelled) cancelled_ = true;