Patch Detail
Show a patch.
GET /api/1.1/patches/2594/?format=api
{ "id": 2594, "url": "https://patchwork.libcamera.org/api/1.1/patches/2594/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2594/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200112010212.2609025-13-niklas.soderlund@ragnatech.se>", "date": "2020-01-12T01:01:52", "name": "[libcamera-devel,v4,12/32] libcamera: buffer: Drop private function setRequest()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b5a8f279ef4daf8db78fb0dd1c2c5b7e305d291c", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2594/mbox/", "series": [ { "id": 617, "url": "https://patchwork.libcamera.org/api/1.1/series/617/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=617", "date": "2020-01-12T01:01:40", "name": "libcamera: Rework buffer API", "version": 4, "mbox": "https://patchwork.libcamera.org/series/617/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2594/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2594/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7CB38606D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Jan 2020 02:03:08 +0100 (CET)", "from bismarck.berto.se (p54ac5d7b.dip0.t-ipconnect.de\n\t[84.172.93.123]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 498fef40-34d7-11ea-b6d8-005056917f90;\n\tSun, 12 Jan 2020 02:03:04 +0100 (CET)" ], "X-Halon-ID": "498fef40-34d7-11ea-b6d8-005056917f90", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 12 Jan 2020 02:01:52 +0100", "Message-Id": "<20200112010212.2609025-13-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200112010212.2609025-1-niklas.soderlund@ragnatech.se>", "References": "<20200112010212.2609025-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 12/32] 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": "Sun, 12 Jan 2020 01:03:08 -0000" }, "content": "There is no need to have a private helper function to access a private\ndata member when a friend statement is needed anyhow. Remove the helper\nfunction to simplify the code and make it clear that a private member of\nBuffer is accessed.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/buffer.h | 2 --\n src/libcamera/buffer.cpp | 8 ++++----\n src/libcamera/request.cpp | 4 ++--\n 3 files changed, 6 insertions(+), 8 deletions(-)", "diff": "diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\nindex d3dc9a420aaaa385..55d08e278a7d0236 100644\n--- a/include/libcamera/buffer.h\n+++ b/include/libcamera/buffer.h\n@@ -129,8 +129,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_;\ndiff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\nindex d53e5150b40a3b09..8c8be4ac802735b1 100644\n--- a/src/libcamera/buffer.cpp\n+++ b/src/libcamera/buffer.cpp\n@@ -290,7 +290,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@@ -318,10 +317,11 @@ void Buffer::cancel()\n }\n \n /**\n- * \\fn Buffer::setRequest()\n- * \\brief Set the request this buffer belongs to\n+ * \\var Buffer::request_\n+ * \\brief The request this buffer belongs to\n *\n- * The intended callers are Request::addBuffer() and Request::completeBuffer().\n+ * This member is intended to be set by Request::addBuffer() and\n+ * Request::completeBuffer().\n */\n \n /**\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex 84a5f55879ccf5b5..92330c1a37290fc2 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -139,7 +139,7 @@ int Request::addBuffer(std::unique_ptr<Buffer> buffer)\n \t\treturn -EEXIST;\n \t}\n \n-\tbuffer->setRequest(this);\n+\tbuffer->request_ = this;\n \tpending_.insert(buffer.get());\n \tbufferMap_[stream] = buffer.release();\n \n@@ -236,7 +236,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", "prefixes": [ "libcamera-devel", "v4", "12/32" ] }