From patchwork Thu Apr 15 04:48:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11937 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 87144BD1F6 for ; Thu, 15 Apr 2021 04:49:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 088A26881D; Thu, 15 Apr 2021 06:49:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="j/cHkXR7"; dkim-atps=neutral Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8ECBF602C7 for ; Thu, 15 Apr 2021 06:49:04 +0200 (CEST) Received: by mail-pf1-x42b.google.com with SMTP id m11so15242484pfc.11 for ; Wed, 14 Apr 2021 21:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gWtprvFvs554lUgEhHva3qqaLvBV08DOn0Hn5nAhrtQ=; b=j/cHkXR7Kr4syRej+OwNICulx2RKVACiH4Sh8FSP+U1KrnGKR5pY/8kQ7kDeZ3F3Uw T0TCzLrdMCGDtrGz9j6PIWtPBawAz7EJ6RvRsqSXvJKsmGOHeplwAVoNeAbaOnJ/wHhq 5w5+WEK8XFmuLBMXv03IG0cO7oIFTcUBO6zNQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gWtprvFvs554lUgEhHva3qqaLvBV08DOn0Hn5nAhrtQ=; b=VgbJ+e3YUcBBFmscsBFtr6IFKJ6Ec6X7xcgeK8KngD/fHgF1RFX4Scq7ApCV3p0rCf lmSVl5/7aurga6bMP3yjNqHkSbNbR67MGXs4xDO4//vHu/tg8Jm2grY+zI2Y6POeDdxg nbZVkfiVEpg66H9/pEL3d9dgpQOrwBaunuhbusvYtbdTPoJo17769NfSZvL1OWPtGBnI ErOOixsaZo9CBW/e+LsHJAqM4mcrD9Jyw2bWMnL/4reaieuec7oemSUUWci6gsYgqJIZ ebRP4/GRhV1DbktjDLH3ZWtXhNxB84onGaAH2orsR28ERi5cJoKtQvjqNoVsveE9Luk7 7NHA== X-Gm-Message-State: AOAM532kJEUuzHvQy9nbeBZz1Cn320w6rDX0fWRO0jJJJai9BXP99vwX Rk/Icq32qF8IYezjQJcDW5jk1YyPkrSdoQ== X-Google-Smtp-Source: ABdhPJxGzXZ7LJAQgIC1/4US3Uz0pPVOjqdomQmOvT/ndNVenGd9UmxU17lnm6XJiD9ZLlkY/TlrAg== X-Received: by 2002:a63:1b5e:: with SMTP id b30mr1770458pgm.254.1618462143098; Wed, 14 Apr 2021 21:49:03 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:84f5:7981:dfbe:8f02]) by smtp.gmail.com with ESMTPSA id kk6sm833885pjb.51.2021.04.14.21.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Apr 2021 21:49:02 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 15 Apr 2021 13:48:54 +0900 Message-Id: <20210415044854.3348529-3-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.368.gbe11c130af-goog In-Reply-To: <20210415044854.3348529-1-hiroh@chromium.org> References: <20210415044854.3348529-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/3] libcamera: V4L2Device: Use std::vector in updateControls() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" V4L2Device::updateControls() takes two arguments, raw array and its size, for the v4l2_ext_control values. This replaces it with std::vector. Signed-off-by: Hirokazu Honda --- include/libcamera/internal/v4l2_device.h | 3 +-- src/libcamera/v4l2_device.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h index d006bf68..4cce3840 100644 --- a/include/libcamera/internal/v4l2_device.h +++ b/include/libcamera/internal/v4l2_device.h @@ -55,8 +55,7 @@ protected: private: void listControls(); void updateControls(ControlList *ctrls, - const struct v4l2_ext_control *v4l2Ctrls, - unsigned int count); + const std::vector &v4l2Ctrls); void eventAvailable(EventNotifier *notifier); diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 5ec1b10e..217a39e3 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -250,7 +250,7 @@ ControlList V4L2Device::getControls(const std::vector &ids) v4l2Ctrls.resize(errorIdx); } - updateControls(&ctrls, v4l2Ctrls.data(), v4l2Ctrls.size()); + updateControls(&ctrls, v4l2Ctrls); return ctrls; } @@ -350,7 +350,7 @@ int V4L2Device::setControls(ControlList *ctrls) ret = errorIdx; } - updateControls(ctrls, v4l2Ctrls.data(), v4l2Ctrls.size()); + updateControls(ctrls, v4l2Ctrls); return ret; } @@ -514,14 +514,11 @@ void V4L2Device::listControls() * values in \a v4l2Ctrls * \param[inout] ctrls List of V4L2 controls to update * \param[in] v4l2Ctrls List of V4L2 extended controls as returned by the driver - * \param[in] count The number of controls to update */ void V4L2Device::updateControls(ControlList *ctrls, - const struct v4l2_ext_control *v4l2Ctrls, - unsigned int count) + const std::vector &v4l2Ctrls) { - for (unsigned int i = 0; i < count; i++) { - const struct v4l2_ext_control &v4l2Ctrl = v4l2Ctrls[i]; + for (const v4l2_ext_control &v4l2Ctrl : v4l2Ctrls) { const unsigned int id = v4l2Ctrl.id; if (!ctrls->contains(id)) { LOG(V4L2, Error) << "ControlList doesn't contain id: "