From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751343AbeBTEoz (ORCPT ); Mon, 19 Feb 2018 23:44:55 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35951 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751131AbeBTEou (ORCPT ); Mon, 19 Feb 2018 23:44:50 -0500 X-Google-Smtp-Source: AH8x226n7qnPliMK6SxZ957HHsM5E6EN3VR6diPYiEEMI0o6VN6uScLDBx0WG6YdjB+jlOihl3kcoA== From: Alexandre Courbot To: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Pawel Osciak , Marek Szyprowski , Tomasz Figa , Sakari Ailus Cc: Gustavo Padovan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Alexandre Courbot Subject: [RFCv4 03/21] v4l2-ctrls: prepare internal structs for request API Date: Tue, 20 Feb 2018 13:44:07 +0900 Message-Id: <20180220044425.169493-4-acourbot@chromium.org> X-Mailer: git-send-email 2.16.1.291.g4437f3f132-goog In-Reply-To: <20180220044425.169493-1-acourbot@chromium.org> References: <20180220044425.169493-1-acourbot@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil Add a refcount and is_request bool to struct v4l2_ctrl_handler: this is used to refcount a handler that represents a request. Add a p_req field to struct v4l2_ctrl_ref that will store the request value. Signed-off-by: Hans Verkuil Signed-off-by: Alexandre Courbot --- drivers/media/v4l2-core/v4l2-ctrls.c | 1 + include/media/v4l2-ctrls.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 5c705f5dde9b..eac70598635d 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1761,6 +1761,7 @@ int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, sizeof(hdl->buckets[0]), GFP_KERNEL | __GFP_ZERO); hdl->error = hdl->buckets ? 0 : -ENOMEM; + hdl->is_request = false; return hdl->error; } EXPORT_SYMBOL(v4l2_ctrl_handler_init_class); diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 96f5c63c12d0..bcabbf8a44b5 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -18,6 +18,7 @@ #define _V4L2_CTRLS_H #include +#include #include #include @@ -257,6 +258,7 @@ struct v4l2_ctrl_ref { struct v4l2_ctrl_ref *next; struct v4l2_ctrl *ctrl; struct v4l2_ctrl_helper *helper; + union v4l2_ctrl_ptr p_req; bool from_other_dev; }; @@ -292,7 +294,9 @@ struct v4l2_ctrl_handler { v4l2_ctrl_notify_fnc notify; void *notify_priv; u16 nr_of_buckets; + bool is_request; int error; + struct kref ref; }; /** -- 2.16.1.291.g4437f3f132-goog