[libcamera-devel] [PATCH v3 12/33] libcamera: buffer: Drop private function setRequest()
Niklas Söderlund
niklas.soderlund at ragnatech.se
Fri Jan 10 20:37:47 CET 2020
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 <niklas.soderlund at ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
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 a77c346cee69b81d..25f729a27d5881bb 100644
--- a/include/libcamera/buffer.h
+++ b/include/libcamera/buffer.h
@@ -127,8 +127,6 @@ private:
void cancel();
- void setRequest(Request *request) { request_ = request; }
-
unsigned int index_;
std::array<int, 3> dmabuf_;
BufferMemory *mem_;
diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
index 1f2f6ae268f07415..cdfd4c10ab7c9e62 100644
--- a/src/libcamera/buffer.cpp
+++ b/src/libcamera/buffer.cpp
@@ -290,7 +290,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()
*/
/**
@@ -318,10 +317,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;
--
2.24.1
More information about the libcamera-devel
mailing list