{"id":12097,"url":"https://patchwork.libcamera.org/api/1.1/patches/12097/?format=json","web_url":"https://patchwork.libcamera.org/patch/12097/","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":"<20210423093653.1726488-4-hiroh@chromium.org>","date":"2021-04-23T09:36:53","name":"[libcamera-devel,v5,4/4] libcamera: V4L2Device: Use Span in updateControls()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"44af1433667c647f80dea2d2b8e3154c219b21c3","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/12097/mbox/","series":[{"id":1970,"url":"https://patchwork.libcamera.org/api/1.1/series/1970/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1970","date":"2021-04-23T09:36:50","name":"[libcamera-devel,v5,1/4] libcamera: V4L2Device: Remove the controls order assumption in updateControls()","version":5,"mbox":"https://patchwork.libcamera.org/series/1970/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12097/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12097/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 3A408BDB15\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Apr 2021 09:38:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B1B246887B;\n\tFri, 23 Apr 2021 11:38:01 +0200 (CEST)","from mail-pg1-x533.google.com (mail-pg1-x533.google.com\n\t[IPv6:2607:f8b0:4864:20::533])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B5A6068877\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Apr 2021 11:37:59 +0200 (CEST)","by mail-pg1-x533.google.com with SMTP id b17so34824854pgh.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Apr 2021 02:37:59 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:8537:2d4f:8d35:5777])\n\tby smtp.gmail.com with ESMTPSA id\n\tz5sm4273660pff.191.2021.04.23.02.37.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 23 Apr 2021 02:37:57 -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=\"IFuCvSzl\"; 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=o3KaVkmOW7yQ2PRBDDrr/MSJU0RRor10z7001foGA3U=;\n\tb=IFuCvSzlSuzLcs6YD/wJBmO+WDKcMpyGxubv7rWat5YrTb/eqdpVIzylU0fSTxJoYU\n\tmfIawNaX7NlvnCZDSkArTusE6qcogixNpFNYUkgc0yMUX6AfLjs80o63hjYokh4js8QI\n\tUBA85Jd7tLHtK4igxjwVjTdfUFsNVv63RXtCI=","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=o3KaVkmOW7yQ2PRBDDrr/MSJU0RRor10z7001foGA3U=;\n\tb=T3xI+iwfWgG7noheOlJSScqis2G4C+759y3x4DBhHgCVQ7SnYmpK8/tgnZn+zeEx+a\n\tnrp9kEgpDUb8Svlm8srlqCCSha/9S1jj/AUXVW6OpGu6EZIChuotpFiuIXI4jLi4lJU7\n\tKozl3UugD2ADKHclfA+s6/GJuKYEFErnia/VYkcWlzhACsXQXDlnMm13Qp7rMp/abND2\n\tg6Y9q+UArZ2Kzy1j9w/jAA0D7Ku/EQIyJItZ6WwgliSquLTPeriAa6Alc7InW8txA6B1\n\ttNMxXcY2qzIxljRkwWphEzgy+aag77lezF8u1V2z2iT9nfFDJpD6RYsnstADNgBeeeHS\n\tF8bw==","X-Gm-Message-State":"AOAM530Dqf5f7h1D1GWxJ3Mi5mZOWXN8GODS5A/jdLOMGtYALbbr7HEY\n\tVtTLp7Vz6/5+0ikCtDsIQqToyNqotnGqeg==","X-Google-Smtp-Source":"ABdhPJwn4QFpBQQGCsblpYKZ7NPwve/iehWsWcTAv6E5kaEqBRzl0ZMTKaaa+IOWcGjcIHVZ0xGlTA==","X-Received":"by 2002:a62:8485:0:b029:1fc:d912:67d6 with SMTP id\n\tk127-20020a6284850000b02901fcd91267d6mr2961376pfd.80.1619170678186; \n\tFri, 23 Apr 2021 02:37:58 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 23 Apr 2021 18:36:53 +0900","Message-Id":"<20210423093653.1726488-4-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.1.498.g6c1eba8ee3d-goog","In-Reply-To":"<20210423093653.1726488-1-hiroh@chromium.org>","References":"<20210423093653.1726488-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v5 4/4] 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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/internal/v4l2_device.h |  4 ++--\n src/libcamera/v4l2_device.cpp            | 11 ++++-------\n 2 files changed, 6 insertions(+), 9 deletions(-)","diff":"diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex d006bf68..087f07e7 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    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 4522268d..954060f4 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -246,7 +246,7 @@ 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, v4l2Ctrls);\n \n \treturn ctrls;\n }\n@@ -345,7 +345,7 @@ int V4L2Device::setControls(ControlList *ctrls)\n \t\tret = errorIdx;\n \t}\n \n-\tupdateControls(ctrls, v4l2Ctrls.data(), v4l2Ctrls.size());\n+\tupdateControls(ctrls, v4l2Ctrls);\n \n \treturn ret;\n }\n@@ -509,14 +509,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\tSpan<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 \n \t\tControlValue value = ctrls->get(id);\n","prefixes":["libcamera-devel","v5","4/4"]}