Show a patch.

GET /api/patches/1192/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1192,
    "url": "https://patchwork.libcamera.org/api/patches/1192/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1192/",
    "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": "<20190511091907.10050-8-niklas.soderlund@ragnatech.se>",
    "date": "2019-05-11T09:19:03",
    "name": "[libcamera-devel,v3,07/11] libcamera: media_device: Make open() and close() private",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "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/1192/mbox/",
    "series": [
        {
            "id": 303,
            "url": "https://patchwork.libcamera.org/api/series/303/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=303",
            "date": "2019-05-11T09:18:56",
            "name": "libcamerea: Add support for exclusive access to cameras between processes",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/303/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1192/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1192/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 986D360E79\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 11 May 2019 11:19:56 +0200 (CEST)",
            "from localhost.localdomain (unknown [185.224.57.161])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid ef6d435b-73cd-11e9-8e2f-005056917f90;\n\tSat, 11 May 2019 11:19:54 +0200 (CEST)"
        ],
        "X-Halon-ID": "ef6d435b-73cd-11e9-8e2f-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": "Sat, 11 May 2019 11:19:03 +0200",
        "Message-Id": "<20190511091907.10050-8-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190511091907.10050-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190511091907.10050-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 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": "Sat, 11 May 2019 09:19:56 -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>\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",
        "v3",
        "07/11"
    ]
}