Patch Detail
Show a patch.
GET /api/patches/1212/?format=api
{ "id": 1212, "url": "https://patchwork.libcamera.org/api/patches/1212/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1212/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20190517005447.27171-8-niklas.soderlund@ragnatech.se>", "date": "2019-05-17T00:54:43", "name": "[libcamera-devel,v4,07/11] libcamera: media_device: Make open() and close() private", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e1a2eac365a9f4497314464a5c5cc70791c876e6", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1212/mbox/", "series": [ { "id": 306, "url": "https://patchwork.libcamera.org/api/series/306/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=306", "date": "2019-05-17T00:54:36", "name": "libcamerea: Add support for exclusive access to cameras between processes", "version": 4, "mbox": "https://patchwork.libcamera.org/series/306/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1212/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1212/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DA45661865\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 May 2019 02:55:13 +0200 (CEST)", "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 6cc7ba6e-783e-11e9-8d05-005056917f90;\n\tFri, 17 May 2019 02:55:12 +0200 (CEST)" ], "X-Halon-ID": "6cc7ba6e-783e-11e9-8d05-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": "Fri, 17 May 2019 02:54:43 +0200", "Message-Id": "<20190517005447.27171-8-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190517005447.27171-1-niklas.soderlund@ragnatech.se>", "References": "<20190517005447.27171-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 07/11] libcamera: media_device: Make\n\topen() and close() private", "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": "Fri, 17 May 2019 00:55:14 -0000" }, "content": "All external callers to open() and close() have been refactored and\nthere is no need to expose these functions anymore, make them private.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/media_device.h | 6 +-\n src/libcamera/media_device.cpp | 98 ++++++++++++++--------------\n 2 files changed, 52 insertions(+), 52 deletions(-)", "diff": "diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h\nindex 883985055eb419dd..e513a2fee1b91a1b 100644\n--- a/src/libcamera/include/media_device.h\n+++ b/src/libcamera/include/media_device.h\n@@ -30,9 +30,6 @@ public:\n \tvoid release();\n \tbool busy() const { return acquired_; }\n \n-\tint open();\n-\tvoid close();\n-\n \tint populate();\n \tbool valid() const { return valid_; }\n \n@@ -62,6 +59,9 @@ private:\n \tbool valid_;\n \tbool acquired_;\n \n+\tint open();\n+\tvoid close();\n+\n \tstd::map<unsigned int, MediaObject *> objects_;\n \tMediaObject *object(unsigned int id);\n \tbool addObject(MediaObject *object);\ndiff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex b1cc37e840a9fa9d..62c59e7e8fc0299f 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -126,55 +126,6 @@ void MediaDevice::release()\n * \\sa acquire(), release()\n */\n \n-/**\n- * \\brief Open the media device\n- *\n- * \\return 0 on success or a negative error code otherwise\n- * \\retval -EBUSY Media device already open\n- * \\sa close()\n- */\n-int MediaDevice::open()\n-{\n-\tif (fd_ != -1) {\n-\t\tLOG(MediaDevice, Error) << \"MediaDevice already open\";\n-\t\treturn -EBUSY;\n-\t}\n-\n-\tint ret = ::open(deviceNode_.c_str(), O_RDWR);\n-\tif (ret < 0) {\n-\t\tret = -errno;\n-\t\tLOG(MediaDevice, Error)\n-\t\t\t<< \"Failed to open media device at \"\n-\t\t\t<< deviceNode_ << \": \" << strerror(-ret);\n-\t\treturn ret;\n-\t}\n-\tfd_ = ret;\n-\n-\treturn 0;\n-}\n-\n-/**\n- * \\brief Close the media device\n- *\n- * This function closes the media device node. It does not invalidate the media\n- * graph and all cached media objects remain valid and can be accessed normally.\n- * Once closed no operation interacting with the media device node can be\n- * performed until the device is opened again.\n- *\n- * Closing an already closed device is allowed and will not perform any\n- * operation.\n- *\n- * \\sa open()\n- */\n-void MediaDevice::close()\n-{\n-\tif (fd_ == -1)\n-\t\treturn;\n-\n-\t::close(fd_);\n-\tfd_ = -1;\n-}\n-\n /**\n * \\brief Populate the MediaDevice with device information and media objects\n *\n@@ -440,6 +391,55 @@ int MediaDevice::disableLinks()\n * driver unloading for most devices. The media device is passed as a parameter.\n */\n \n+/**\n+ * \\brief Open the media device\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ * \\retval -EBUSY Media device already open\n+ * \\sa close()\n+ */\n+int MediaDevice::open()\n+{\n+\tif (fd_ != -1) {\n+\t\tLOG(MediaDevice, Error) << \"MediaDevice already open\";\n+\t\treturn -EBUSY;\n+\t}\n+\n+\tint ret = ::open(deviceNode_.c_str(), O_RDWR);\n+\tif (ret < 0) {\n+\t\tret = -errno;\n+\t\tLOG(MediaDevice, Error)\n+\t\t\t<< \"Failed to open media device at \"\n+\t\t\t<< deviceNode_ << \": \" << strerror(-ret);\n+\t\treturn ret;\n+\t}\n+\tfd_ = ret;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * \\brief Close the media device\n+ *\n+ * This function closes the media device node. It does not invalidate the media\n+ * graph and all cached media objects remain valid and can be accessed normally.\n+ * Once closed no operation interacting with the media device node can be\n+ * performed until the device is opened again.\n+ *\n+ * Closing an already closed device is allowed and will not perform any\n+ * operation.\n+ *\n+ * \\sa open()\n+ */\n+void MediaDevice::close()\n+{\n+\tif (fd_ == -1)\n+\t\treturn;\n+\n+\t::close(fd_);\n+\tfd_ = -1;\n+}\n+\n /**\n * \\var MediaDevice::objects_\n * \\brief Global map of media objects (entities, pads, links) keyed by their\n", "prefixes": [ "libcamera-devel", "v4", "07/11" ] }