{"id":12030,"url":"https://patchwork.libcamera.org/api/1.1/patches/12030/?format=json","web_url":"https://patchwork.libcamera.org/patch/12030/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210421093857.391409-3-hiroh@chromium.org>","date":"2021-04-21T09:38:57","name":"[libcamera-devel,v3,3/3] libcamera: V4L2Device: Use Span in updateControls()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"609b0bdbe0f6f873be25f2e24269f1007e102d1b","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12030/mbox/","series":[{"id":1955,"url":"https://patchwork.libcamera.org/api/1.1/series/1955/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1955","date":"2021-04-21T09:38:55","name":"[libcamera-devel,v3,1/3] libcamera: V4L2Device: Use std::vector for v4l2_ext_control in getControls()","version":3,"mbox":"https://patchwork.libcamera.org/series/1955/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12030/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12030/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 870CFBDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Apr 2021 09:39:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F09DF68846;\n\tWed, 21 Apr 2021 11:39:08 +0200 (CEST)","from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com\n\t[IPv6:2607:f8b0:4864:20::62e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 76D9768806\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Apr 2021 11:39:07 +0200 (CEST)","by mail-pl1-x62e.google.com with SMTP id p16so17363841plf.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Apr 2021 02:39:07 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:7aaa:cbeb:5d87:4ab6])\n\tby smtp.gmail.com with ESMTPSA id\n\to11sm1305939pfu.188.2021.04.21.02.39.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 21 Apr 2021 02:39:05 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"aLVPepei\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=zEObZbu+HrhFhwsmTm3EBsVtUrFydFsdsysjLhiBwUI=;\n\tb=aLVPepei9yiILVSgiySjynZF8iGBH3gd5pzKL/l655RYxSxyrKxSDYwuvDH2sQ8GYx\n\t776UpbwoS1C+DoipfWId1RL9nbELF9JlFigKtjl+hJhwVIaMotip9vk91y8dvfSI+urF\n\tCiJ6HM+3/8NXhxUduZvIVqZGOIhnuLcI1wlGc=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=zEObZbu+HrhFhwsmTm3EBsVtUrFydFsdsysjLhiBwUI=;\n\tb=AT6lH5PSfcwfx+VWhgd1G51CilHAUdXTgd1t6e5jXlqsxIZcUIXL44ONk7i7GXEB9J\n\t/EiSssKM9s/2DXoS185HVtOcjvx+vWgY7ZPoIYuaP+omN6BzuS70NLcVxoXVPg5+hzWN\n\tdoYuebfVRfQprhCBlNlzBpTC3jStpX+tO2yoSJqKc9VscJ7hVXmVIy1HZrRpO3VTNnkx\n\tIO6DXVv7ZthTJwpRK3X3XrG9jluV+qwd7GIcpooyVEqHm0qiWMdj+/R3yZ4vcBlmtAFz\n\tpl6jMqrSqphxDrHmkyegR44zPPQgKEdjVc7XqpvdH8rcrmmbEVpKp+fGGL+iu2IXkAoi\n\tHSeA==","X-Gm-Message-State":"AOAM530+TmkuaKEa0FDa5y23OZlFjMpjeT8JIDdFpUPEdobctFHjqnMw\n\thefrZSr6qZaxpLDN7bPYKvSS7qzKocn4Hg==","X-Google-Smtp-Source":"ABdhPJza5yLbc2V8t2l3+R3z46GzqV725iybafzi3wt+7vqiY2RYQ5+XZLiutqE1xnRPQmL3UHggOA==","X-Received":"by 2002:a17:902:e788:b029:eb:2c5b:bce8 with SMTP id\n\tcp8-20020a170902e788b02900eb2c5bbce8mr33768228plb.41.1618997945781; \n\tWed, 21 Apr 2021 02:39:05 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 21 Apr 2021 18:38:57 +0900","Message-Id":"<20210421093857.391409-3-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.1.368.gbe11c130af-goog","In-Reply-To":"<20210421093857.391409-1-hiroh@chromium.org>","References":"<20210421093857.391409-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 3/3] libcamera: V4L2Device: Use Span in\n\tupdateControls()","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"V4L2Device::updateControls() takes two arguments, raw array and\nits size, for the v4l2_ext_control values. This replaces it with\nlibcamera::Span.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/v4l2_device.h |  4 ++--\n src/libcamera/v4l2_device.cpp            | 13 ++++++-------\n 2 files changed, 8 insertions(+), 9 deletions(-)","diff":"diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex d006bf68..7c79ee97 100644\n--- a/include/libcamera/internal/v4l2_device.h\n+++ b/include/libcamera/internal/v4l2_device.h\n@@ -14,6 +14,7 @@\n #include <linux/videodev2.h>\n \n #include <libcamera/signal.h>\n+#include <libcamera/span.h>\n \n #include \"libcamera/internal/log.h\"\n #include \"libcamera/internal/v4l2_controls.h\"\n@@ -55,8 +56,7 @@ protected:\n private:\n \tvoid listControls();\n \tvoid updateControls(ControlList *ctrls,\n-\t\t\t    const struct v4l2_ext_control *v4l2Ctrls,\n-\t\t\t    unsigned int count);\n+\t\t\t    libcamera::Span<const v4l2_ext_control> v4l2Ctrls);\n \n \tvoid eventAvailable(EventNotifier *notifier);\n \ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 109269b2..a59e8378 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -250,7 +250,8 @@ ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)\n \t\tv4l2Ctrls.resize(errorIdx);\n \t}\n \n-\tupdateControls(&ctrls, v4l2Ctrls.data(), v4l2Ctrls.size());\n+\tupdateControls(&ctrls,\n+\t\t       libcamera::Span<const v4l2_ext_control>(v4l2Ctrls));\n \n \treturn ctrls;\n }\n@@ -349,7 +350,8 @@ int V4L2Device::setControls(ControlList *ctrls)\n \t\tret = errorIdx;\n \t}\n \n-\tupdateControls(ctrls, v4l2Ctrls.data(), v4l2Ctrls.size());\n+\tupdateControls(ctrls,\n+\t\t       libcamera::Span<const v4l2_ext_control>(v4l2Ctrls));\n \n \treturn ret;\n }\n@@ -513,14 +515,11 @@ void V4L2Device::listControls()\n  * values in \\a v4l2Ctrls\n  * \\param[inout] ctrls List of V4L2 controls to update\n  * \\param[in] v4l2Ctrls List of V4L2 extended controls as returned by the driver\n- * \\param[in] count The number of controls to update\n  */\n void V4L2Device::updateControls(ControlList *ctrls,\n-\t\t\t\tconst struct v4l2_ext_control *v4l2Ctrls,\n-\t\t\t\tunsigned int count)\n+\t\t\t\tlibcamera::Span<const v4l2_ext_control> v4l2Ctrls)\n {\n-\tfor (unsigned int i = 0; i < count; i++) {\n-\t\tconst struct v4l2_ext_control &v4l2Ctrl = v4l2Ctrls[i];\n+\tfor (const v4l2_ext_control &v4l2Ctrl : v4l2Ctrls) {\n \t\tconst unsigned int id = v4l2Ctrl.id;\n \t\tif (!ctrls->contains(id)) {\n \t\t\tLOG(V4L2, Error) << \"ControlList doesn't contain id: \"\n","prefixes":["libcamera-devel","v3","3/3"]}