From patchwork Mon Oct 7 22:46:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2136 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 929826197A for ; Tue, 8 Oct 2019 00:46:58 +0200 (CEST) Received: from pendragon.ideasonboard.com (modemcable118.64-20-96.mc.videotron.ca [96.20.64.118]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B1FB7B2D for ; Tue, 8 Oct 2019 00:46:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1570488418; bh=qp6YVjF2+RZfNWa91P1S76as2yhZ8jHLX2J/NfMV4uY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CkQ59IklX74ECkJGqYA3msc8qSewm3p6bfggbkELUJjO52nX6+6+otTpr+/rvk8dH 4woeYXgRr31SV89k0hzYHSv78GSYLZ01+mT4cCzTgMGp09OobKyJ/ZuuEaKh3SMmW5 5XZiDRpwj4sPYFdg+YUU/TeSJyUy5Wg3IIPp9EQ4= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 8 Oct 2019 01:46:41 +0300 Message-Id: <20191007224642.6597-9-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191007224642.6597-1-laurent.pinchart@ideasonboard.com> References: <20191007224642.6597-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 8/9] libcamera: v4l2_controls: Remove V4L2ControlInfo type field 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: , X-List-Received-Date: Mon, 07 Oct 2019 22:46:58 -0000 The V4L2ControlInfo type field stores the V4L2 control type. It partly duplicates the V4L2ControlInfo id().type() that stores the corresponding libcamera control type. The two fields are not strictly identical, but having two types doesn't provide us with any extra value. As this is confusing, remove the V4L2ControlInfo type field. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/libcamera/include/v4l2_controls.h | 2 -- src/libcamera/v4l2_controls.cpp | 7 ------- src/libcamera/v4l2_device.cpp | 10 +++++----- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h index 1d85ecf9864a..133ab9ec208b 100644 --- a/src/libcamera/include/v4l2_controls.h +++ b/src/libcamera/include/v4l2_controls.h @@ -31,14 +31,12 @@ public: V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl); const ControlId &id() const { return id_; } - unsigned int type() const { return type_; } size_t size() const { return size_; } const ControlRange &range() const { return range_; } private: V4L2ControlId id_; - unsigned int type_; size_t size_; ControlRange range_; diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp index 98b2b3fe9d0a..d3f94709e821 100644 --- a/src/libcamera/v4l2_controls.cpp +++ b/src/libcamera/v4l2_controls.cpp @@ -127,7 +127,6 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl) V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl) : id_(ctrl) { - type_ = ctrl.type; size_ = ctrl.elem_size * ctrl.elems; if (ctrl.type == V4L2_CTRL_TYPE_INTEGER64) @@ -144,12 +143,6 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl) * \return The V4L2 control ID */ -/** - * \fn V4L2ControlInfo::type() - * \brief Retrieve the control type as defined by V4L2_CTRL_TYPE_* - * \return The V4L2 control type - */ - /** * \fn V4L2ControlInfo::size() * \brief Retrieve the control value data size (in bytes) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 50616571dcef..b64e5068a671 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -269,8 +269,8 @@ int V4L2Device::setControls(ControlList *ctrls) /* Set the v4l2_ext_control value for the write operation. */ const ControlValue &value = ctrl.second; - switch (info->type()) { - case V4L2_CTRL_TYPE_INTEGER64: + switch (info->id().type()) { + case ControlTypeInteger64: v4l2Ctrls[i].value64 = value.get(); break; default: @@ -278,7 +278,7 @@ int V4L2Device::setControls(ControlList *ctrls) * \todo To be changed when support for string and * compound controls will be added. */ - v4l2Ctrls[i].value64 = value.get(); + v4l2Ctrls[i].value = value.get(); break; } @@ -402,8 +402,8 @@ void V4L2Device::updateControls(ControlList *ctrls, const V4L2ControlInfo *info = controlInfo[i]; ControlValue &value = ctrl.second; - switch (info->type()) { - case V4L2_CTRL_TYPE_INTEGER64: + switch (info->id().type()) { + case ControlTypeInteger64: value.set(v4l2Ctrl->value64); break; default: