Patch Detail
Show a patch.
GET /api/1.1/patches/1962/?format=api
{ "id": 1962, "url": "https://patchwork.libcamera.org/api/1.1/patches/1962/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1962/", "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": "<20190912200330.19004-4-laurent.pinchart@ideasonboard.com>", "date": "2019-09-12T20:03:29", "name": "[libcamera-devel,3/4] libcamera: device_enumerator_udev: Avoid double list lookup", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "645532a28d0cb7ac965bb54b1af6a42db831faab", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1962/mbox/", "series": [ { "id": 487, "url": "https://patchwork.libcamera.org/api/1.1/series/487/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=487", "date": "2019-09-12T20:03:26", "name": "Fix udev device enumerator with V4L2 M2M devices", "version": 1, "mbox": "https://patchwork.libcamera.org/series/487/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1962/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1962/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7BCDB60BCF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Sep 2019 22:03:46 +0200 (CEST)", "from pendragon.lan (bl10-204-24.dsl.telepac.pt [85.243.204.24])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B0BED33A;\n\tThu, 12 Sep 2019 22:03:45 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1568318626;\n\tbh=8WZ0j3NkepX1Vnf4dCcBzOIHMU6JJmZJLIqiZDXgw0U=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=CI68Kh1bloZuP1w1NxgREOUb8SXeHgiHG4Duze/hd+MS09NuJ+qnw40l83Q7H9+Jx\n\tQw/Gqsl1Dhwe5GdLwPGxVnv5ZeMX5gBVv2EkOVzGZvSJ7LL4M77yAg+vICKOse02BI\n\tvEzpejq4IDJI47AP2XmeQZq71r4CAitsFnRSa4HE=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 12 Sep 2019 23:03:29 +0300", "Message-Id": "<20190912200330.19004-4-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190912200330.19004-1-laurent.pinchart@ideasonboard.com>", "References": "<20190912200330.19004-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 3/4] libcamera: device_enumerator_udev:\n\tAvoid double list lookup", "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": "Thu, 12 Sep 2019 20:03:46 -0000" }, "content": "DeviceEnumeratorUdev::populateMediaDevice() searches for orphan devices\nin an std::list, and if found removes them using std::list::remove().\nThis ends up looking up the entry twice. Replace the remove() call with\nerase() to fix it.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/device_enumerator_udev.cpp | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\nindex 210f5c1f2870..c40770911d3d 100644\n--- a/src/libcamera/device_enumerator_udev.cpp\n+++ b/src/libcamera/device_enumerator_udev.cpp\n@@ -182,7 +182,8 @@ int DeviceEnumeratorUdev::populateMediaDevice(const std::shared_ptr<MediaDevice>\n \t\t\t\t entity->deviceMinor());\n \n \t\t/* Take device from orphan list first, if it is in the list. */\n-\t\tif (std::find(orphans_.begin(), orphans_.end(), devnum) != orphans_.end()) {\n+\t\tauto orphan = std::find(orphans_.begin(), orphans_.end(), devnum);\n+\t\tif (orphan != orphans_.end()) {\n \t\t\tstd::string deviceNode = lookupDeviceNode(devnum);\n \t\t\tif (deviceNode.empty())\n \t\t\t\treturn -EINVAL;\n@@ -191,7 +192,7 @@ int DeviceEnumeratorUdev::populateMediaDevice(const std::shared_ptr<MediaDevice>\n \t\t\tif (ret)\n \t\t\t\treturn ret;\n \n-\t\t\torphans_.remove(devnum);\n+\t\t\torphans_.erase(orphan);\n \t\t\tcontinue;\n \t\t}\n \n", "prefixes": [ "libcamera-devel", "3/4" ] }