From patchwork Tue Dec 10 09:28:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901077 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72C4423875F for ; Tue, 10 Dec 2024 09:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822933; cv=none; b=Q3tOCCbIik5UyY99rOwiejmM8EzR1Ue4GD/Dtc8IWyS6REQCPoxNmt5kuGEu7fp/2C/YpgB6f7R7r1ph56mieBQNPeLmOHUtvKQfLSynaW+M8kzZWug3NOpIvc9vtE3Dc0L0ARbOT9Uf60KfZKfrxEFamJVt0/BsD6dshfjrno8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822933; c=relaxed/simple; bh=5tAoo54TU4GQ4hW7pLNn7ok6ge350p6usP0YhXYzePE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DVvaYWpZzYBc8TK41zfQG+antZP2kRNE2JFfgSUq8SWJcbU+hXahoe7Dw8wYm+sF+uxIN+BbL1OnTcxF1Umvpc90UjLLFQ5avSZntnbPEeUWIWSiUdc8CXc5+OktF5GpfLCmK/b5MjTVVmntrSg82kyNlSXIJurVlBKV/SuyQ4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=iGAU9YjD; arc=none smtp.client-ip=209.85.160.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="iGAU9YjD" Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-46774573043so11639701cf.2 for ; Tue, 10 Dec 2024 01:28:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822930; x=1734427730; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DjCxwHlk//pWYcvx6fmU+J931W36lgHNKb5tiH7Iy4s=; b=iGAU9YjDnIzXhrbyfzJLjzDnmsRh8lJ5huF7tkIVtqpjn0M7q7m98qPbyOHaHnT9M+ cXaIIgVffgqFTcxqwaSXwNkntAzMM+Alr8zMW4MZBlWWT8zeIyAMOeSEWkFWLI6uG4Cr oO70sgvAUcTTItRfEHqtAJQLWq59K+uPVxOeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822930; x=1734427730; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DjCxwHlk//pWYcvx6fmU+J931W36lgHNKb5tiH7Iy4s=; b=XWHTy3wUUrALhO/25k8dnv8y3s1LzoRV0hn05bKuSD1coOXEcVriSNl/szUyMBl1aC k1wskGzx9BkA/qzCxKBCKvtq3R5lLzYdm33UeCtL6MoiPhLY+G5W0xSzKJo3z3JsdAZP jcYhHkwrJBLkTO6/1E+bi145TpmKc3z7INcJhKHXbIUk7MD9JHKuaRZL0Tt8WBFtRr/D +5Cb7Q/BGbkZhyPrPxsUaNddjIny4dCH36qctW+iaHOEGiPoa6aks1KVLQI8M5FEA6ha UjfoSLLEh7ZVGf0eQN90W60uu4wuKuMe2T+QlM+JXzu9/2cfc/g+GXWKxN7fuKrOuRNi vNxA== X-Gm-Message-State: AOJu0YwwbVEONl9unQporFHQWBbT0tgKvDtYdB+mGoMb3s8Now2HrgR9 Oa8Toc/OV9pcyz1kWXS+wsxrjSGAAodMiTf3Gqoqfc3/CuTNlt66mMlft9kC8Q== X-Gm-Gg: ASbGncv0tv5YBqDAoADiKqbkNCGQTp4ZxfBdFVxzndOmkHlOYjQgTOwvjQ1kk/qzRmJ Tps0/rkliSfO9tG48JZcjNO97JF9b6+dJmyIbLJN0kl8aheK6b4160gXQtPUJlE0OqPNOY61MeQ n7Uxi+7wz9WILFYU6pNFHBBCvwsNsxhC7gjg1hE8wYYYVW1LBk0+Ho8gc5bgQ7tmigLOtODuUio d+NtfT7WR+/1N0chG2M390G9SKyQeiVoMRkTH+3l1Lm8yMBtfqs5zgfSw9Te7na1rWETRp3H3EJ Y12+sOlhV37Rtn2cMBrZZxkahCFP X-Google-Smtp-Source: AGHT+IHlEaOPjN93sA8cjSBRqg2/WMxOoAfLZHozJqTzhAKHeUhuWeLsI2/xEgcPjttaJynBP3QLKg== X-Received: by 2002:ac8:59c5:0:b0:466:a06f:ae0a with SMTP id d75a77b69052e-46771f5b0bamr69413111cf.32.1733822930286; Tue, 10 Dec 2024 01:28:50 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:28:49 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:45 +0000 Subject: [PATCH v2 01/11] media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-1-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 v4l2_queryctrl is a subset of v4l2_query_ext_ctrl. If the driver does not implement v4l2_queryctrl we can implement it with v4l2_query_ext_ctrl. Suggested-by: Hans de Goede Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-dev.c | 3 ++- drivers/media/v4l2-core/v4l2-ioctl.c | 37 +++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 5bcaeeba4d09..252308a67fa8 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -572,7 +572,8 @@ static void determine_valid_ioctls(struct video_device *vdev) and that can't be tested here. If the bit for these control ioctls is set, then the ioctl is valid. But if it is 0, then it can still be valid if the filehandle passed the control handler. */ - if (vdev->ctrl_handler || ops->vidioc_queryctrl) + if (vdev->ctrl_handler || ops->vidioc_queryctrl || + ops->vidioc_query_ext_ctrl) __set_bit(_IOC_NR(VIDIOC_QUERYCTRL), valid_ioctls); if (vdev->ctrl_handler || ops->vidioc_query_ext_ctrl) __set_bit(_IOC_NR(VIDIOC_QUERY_EXT_CTRL), valid_ioctls); diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 0304daa8471d..7d615ebc511e 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2284,9 +2284,11 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct video_device *vfd = video_devdata(file); + struct v4l2_query_ext_ctrl qec; struct v4l2_queryctrl *p = arg; struct v4l2_fh *vfh = test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + int ret; if (vfh && vfh->ctrl_handler) return v4l2_queryctrl(vfh->ctrl_handler, p); @@ -2294,7 +2296,40 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops, return v4l2_queryctrl(vfd->ctrl_handler, p); if (ops->vidioc_queryctrl) return ops->vidioc_queryctrl(file, fh, p); - return -ENOTTY; + if (!ops->vidioc_query_ext_ctrl) + return -ENOTTY; + + /* Simulate query_ext_ctr using query_ctrl. */ + qec.id = p->id; + ret = ops->vidioc_query_ext_ctrl(file, fh, &qec); + if (ret) + return ret; + + p->id = qec.id; + p->type = qec.type; + p->flags = qec.flags; + strscpy(p->name, qec.name, sizeof(p->name)); + switch (p->type) { + case V4L2_CTRL_TYPE_INTEGER: + case V4L2_CTRL_TYPE_BOOLEAN: + case V4L2_CTRL_TYPE_MENU: + case V4L2_CTRL_TYPE_INTEGER_MENU: + case V4L2_CTRL_TYPE_STRING: + case V4L2_CTRL_TYPE_BITMASK: + p->minimum = qec.minimum; + p->maximum = qec.maximum; + p->step = qec.step; + p->default_value = qec.default_value; + break; + default: + p->minimum = 0; + p->maximum = 0; + p->step = 0; + p->default_value = 0; + break; + } + + return 0; } static int v4l_query_ext_ctrl(const struct v4l2_ioctl_ops *ops, From patchwork Tue Dec 10 09:28:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901078 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FB443DABF9 for ; Tue, 10 Dec 2024 09:28:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822935; cv=none; b=Kd/0oA8S7w2VQVaVBrgGXGUBvHB3/KSat3X2D0BT8xJFDGU7T9mf1xNWZmQvn1X9p72JSVGgCbguuhLQsFXb82MDK/v18W0Rfxp+Xtgl38F13QSfOcZVkU/hnrGN9Cfdpx5ekcZDMA2JX6WMlvaG5MzfGdmsePtZ8ickRWbeq/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822935; c=relaxed/simple; bh=n8ESl2FNmzgV2J4Gu+GXBLuTnzpMfyubm8vIAlksLz0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P/mXmCE+l/hYoYrcNNIEoCNhBoRqJd3tJxWR7o25RuxMtsY0+nmBsyGQBWCI7zk6iPyYjcODYkvsI+xi++A/Ysg0v7Bj7I4Wv17xzEdGWufRh5pPUtK4HUU9AkLdqPc7N6BzdeN2GnyjqtkZd5VNDCeFpYZPU5ED8ALGinynh0k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=SxTnZMvX; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SxTnZMvX" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-4676aad83d3so15005691cf.3 for ; Tue, 10 Dec 2024 01:28:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822932; x=1734427732; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=42cU5HndT5BBlsrtO6ikMSsiagZ6GECUgrygXPNYYzM=; b=SxTnZMvX8xgruBlCJAHo3R2iSJR/rFt8/xdCpRfr+4ZkBk+0Kcnue6wVp2QgSuTZPt g0Oal51JT0Wp/sQdsqLjPsikgq1gTy/GrYx9/KnhGR6A21o5+cGUWlhKwYnGv1/PObbU DbKVgP77kLZ7d89iJjCSR79N7MgLET26Zqd6w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822932; x=1734427732; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=42cU5HndT5BBlsrtO6ikMSsiagZ6GECUgrygXPNYYzM=; b=XIOEjgDMPKUm6Pd0plEwsT7txVtBss6+DNzfF3u6YAydJ0YmJNxAG0ExDQkN0V8jOh Db870wyRcln5twHws90CJKZoxZIXYPjmj0y63/7n8dDppCpfr/eD6PQUqtm+59y59Q13 wPqLcKdl45IPJD9yw+8Y5YlhwLvuF8H3IwDlaUlnyGODqCjzf8WT4Wh3wP3lppTEwJDc ZDLShJnekCymhQalw/OhzmlosR7J+jLpcWjzBxdyvkcFjNYrHLv64ib0MGd/YsQi8SMi NF6qndK4bEQCZdzMnthl3o+ANwcLIEuKGwnrVTPf1fEom6yKHXQ5JtVuKvb4LvuHsAhi ee4w== X-Gm-Message-State: AOJu0YzqgwV+AgRlFS4y4CWiZXXtPHrrzAsQf6BimqI6ruRQaLDpboOn 1wdzw4rRUQRuVNc2MqCi391Ozupt8pU0b+M7gLEqloBG3pZVa3PwSME2/wbNug== X-Gm-Gg: ASbGnctRpGO1BbnVvsYY+t6LVcMhSqZmwPJCVW0i6u44ttz0ZOvJz+3sIEZav7sI1zl lb3JBMK4u6DYMyiU9vweuOUQmkqYitEO8gpmll31tx3b5YeFn/UKKUmcG4g2zO8hRrH9kPZe4zc 2V25MZBBqHdzhxG8Qjd+H6iOc27mSOpXzD1y4gbAEBBZDwH6d8qjZ1yiPTuunBllKHBH+rgng1Z lQtbg16T3abV8ym7ocy7u9DGocWIpOHQJ5wkUVJIOGB9PgMTFP5+DI/F2u0nYWq2YxjB5XbQtJG 9ysY7bf6u03TexQVHNs0WlEcizfu X-Google-Smtp-Source: AGHT+IEnoOn63V/B5cYU2djMibYmXdFhIdrVCbSMu3sxT5u6BPOOJNCg12HGpwhTcUzr8+E2oUFdNA== X-Received: by 2002:ac8:59c5:0:b0:467:5e71:73f5 with SMTP id d75a77b69052e-46771ff47cbmr61831041cf.34.1733822932248; Tue, 10 Dec 2024 01:28:52 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:28:51 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:46 +0000 Subject: [PATCH v2 02/11] media: pvrusb2: Convert queryctrl to query_ext_ctrl Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-2-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 The driver was missing support for query_ext_ctrl. Instead of adding a new callback for it, replace the current implementation of queryctrl and let the ioctl framework emulate the old function. Most of the fields are identical, so the change is pretty simple. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index d608b793fa84..7c8be6a0cf7c 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -497,8 +497,8 @@ static int pvr2_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) return pvr2_hdw_set_streaming(hdw, 0); } -static int pvr2_queryctrl(struct file *file, void *priv, - struct v4l2_queryctrl *vc) +static int pvr2_query_ext_ctrl(struct file *file, void *priv, + struct v4l2_query_ext_ctrl *vc) { struct pvr2_v4l2_fh *fh = file->private_data; struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; @@ -521,13 +521,16 @@ static int pvr2_queryctrl(struct file *file, void *priv, } pvr2_trace(PVR2_TRACE_V4LIOCTL, - "QUERYCTRL id=0x%x mapping name=%s (%s)", + "QUERYEXTCTRL id=0x%x mapping name=%s (%s)", vc->id, pvr2_ctrl_get_name(cptr), pvr2_ctrl_get_desc(cptr)); strscpy(vc->name, pvr2_ctrl_get_desc(cptr), sizeof(vc->name)); vc->flags = pvr2_ctrl_get_v4lflags(cptr); pvr2_ctrl_get_def(cptr, &val); vc->default_value = val; + vc->nr_of_dims = 0; + vc->elems = 1; + vc->elem_size = 4; switch (pvr2_ctrl_get_type(cptr)) { case pvr2_ctl_enum: vc->type = V4L2_CTRL_TYPE_MENU; @@ -549,7 +552,7 @@ static int pvr2_queryctrl(struct file *file, void *priv, break; default: pvr2_trace(PVR2_TRACE_V4LIOCTL, - "QUERYCTRL id=0x%x name=%s not mappable", + "QUERYEXTCTRL id=0x%x name=%s not mappable", vc->id, pvr2_ctrl_get_name(cptr)); return -EINVAL; } @@ -812,7 +815,7 @@ static const struct v4l2_ioctl_ops pvr2_ioctl_ops = { .vidioc_try_fmt_vid_cap = pvr2_try_fmt_vid_cap, .vidioc_streamon = pvr2_streamon, .vidioc_streamoff = pvr2_streamoff, - .vidioc_queryctrl = pvr2_queryctrl, + .vidioc_query_ext_ctrl = pvr2_query_ext_ctrl, .vidioc_querymenu = pvr2_querymenu, .vidioc_g_ctrl = pvr2_g_ctrl, .vidioc_s_ctrl = pvr2_s_ctrl, From patchwork Tue Dec 10 09:28:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901079 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A08D78F27 for ; Tue, 10 Dec 2024 09:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822937; cv=none; b=eJjiysrqc4mOpwpPEi/s8PUIQu1CkJRNkfcBTIqNTlXtdqYWscYZcruAlN/kHgoT8KG0v/YdLJAtANe16as3Njng+l2XuRP2Fg52zjAlwebtIouGt6Sps0Q5ebnBDu5uScJBxN3/V2LgZtfRIA6KChJEAJt5OGAts9iZz06pmAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822937; c=relaxed/simple; bh=QTPQ1DyM59FTFwoOCCInfTij+St4lWshfJMO2MNF9Jk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EpkaQkCqsxzhNUbqHQDnUYBRaRjn6Qgte9uCcO87DkrFWdDZWJVBXJF74wcnhF70VQX1Qt3qGWWEWeS9S9NmODgp8RhPathRZy5q9O/ktNozWzBA6z1X6aXxYE60Q96lj8oKQ8xeCOkiHTkXEGY+zx7gVSVGYpcuWhmuXFquRIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=oFjv7dbs; arc=none smtp.client-ip=209.85.160.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="oFjv7dbs" Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-4676859b911so13632131cf.2 for ; Tue, 10 Dec 2024 01:28:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822934; x=1734427734; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ldrzuJki4Bob493jggNorXy/00Sxo1CNpTeJmfaThng=; b=oFjv7dbs4fTghKaTgXmydmb0q2pp6SL3AQf5k0vgT4+t9iFQxKwg3BNZ1yZn/SPTsR Rhjj+aY69aiclQQEFg8pqNYc1L+yyPB65sq8b4ABJ9LDjjsMgxhxUudgaSUdJWpSSzRM wktubWoFYBaOMz5fMgo1+xtSLTMUS6WZaYKLY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822934; x=1734427734; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ldrzuJki4Bob493jggNorXy/00Sxo1CNpTeJmfaThng=; b=V4K9l1vtfPvzVy2PiwbrVOQlqzUK1/Kcw5Kweam7FkvXJzY2qU/x1nmaRjw6FV/jQY GrchkCknxvDikeq06ZApqJtK6oA5CkZ8F/aZ1D+Ve9YM2tWdmCkBYgxIZ+fbYpBE+myK kLXssafDyRGWGrmYxKkqyhaq5QK0JM7iNn100xkRhUWAJl1K7dneSbVXI9msk9480W6a TgcKwSwbTUsQUnDIYpsarCJ2CAz7LLrnU3Czdn2pFqtrISK4iFa0qFnlcJxgZTz32ONL 7X9lXBlNa2WRShABRkj2vsoePmSB2II+ghFWHFvdjcTtYdiJ6bLsAQteul936ICrEnG7 0kfw== X-Gm-Message-State: AOJu0YyX5D1ATnttU/cBXb0OpeaH/+RM5yspB01RkFTDi82XbYugoGgW WcanVPNciT8+YluwZi5HOBnOAef/0lV46su6N61C3TouumQtC3WVsQuUzRrv8Q== X-Gm-Gg: ASbGncvloCcWbZ66r5HaDmZ/vnrEB8pFkZizzzQAjLpCqOX/HsRFSMxQADkbGzPyJAX UYu75o1YBcOUMcTh9ME3WhaRUiK+npWUNGMl1Yjwyd7Ux2WXYY8SVXnQNJf0syiFd01eo4xwXBn PgwjOQKyFyNmOQ29lElVIweEu/N6QbHa8IoeAIu+HIhZGIsII0l56nK9/pk78GJd+adjrxIuB46 FrQCXmAzgLZrneYJBtr9zvj9mxIvRoR7AKIDKXNuZUuJrRX6k8QeSdM11Yjnh0CAAQBopTRoa5J YRiDLGVNk6XGCRwoVBNeGzYi/Jfw X-Google-Smtp-Source: AGHT+IGAAxP3Bb8dp8EUNxps8UjQFg2XrkM8eTt6qptwkb9cgt4CUX5Y2k7W1aHCNPf6K0Nheydqdg== X-Received: by 2002:a05:622a:118d:b0:467:6092:8414 with SMTP id d75a77b69052e-4676092879amr124695261cf.0.1733822934276; Tue, 10 Dec 2024 01:28:54 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:28:53 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:47 +0000 Subject: [PATCH v2 03/11] media: pvrusb2: Remove g/s_ctrl callbacks Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-3-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 The ioctl helpers can emulate g/s_ctrl with g/s_ext_ctrl. Simplify the code. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 7c8be6a0cf7c..ad38e1240541 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -574,31 +574,6 @@ static int pvr2_querymenu(struct file *file, void *priv, struct v4l2_querymenu * return ret; } -static int pvr2_g_ctrl(struct file *file, void *priv, struct v4l2_control *vc) -{ - struct pvr2_v4l2_fh *fh = file->private_data; - struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; - int val = 0; - int ret; - - ret = pvr2_ctrl_get_value(pvr2_hdw_get_ctrl_v4l(hdw, vc->id), - &val); - vc->value = val; - return ret; -} - -static int pvr2_s_ctrl(struct file *file, void *priv, struct v4l2_control *vc) -{ - struct pvr2_v4l2_fh *fh = file->private_data; - struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; - int ret; - - ret = pvr2_ctrl_set_value(pvr2_hdw_get_ctrl_v4l(hdw, vc->id), - vc->value); - pvr2_hdw_commit_ctl(hdw); - return ret; -} - static int pvr2_g_ext_ctrls(struct file *file, void *priv, struct v4l2_ext_controls *ctls) { @@ -817,8 +792,6 @@ static const struct v4l2_ioctl_ops pvr2_ioctl_ops = { .vidioc_streamoff = pvr2_streamoff, .vidioc_query_ext_ctrl = pvr2_query_ext_ctrl, .vidioc_querymenu = pvr2_querymenu, - .vidioc_g_ctrl = pvr2_g_ctrl, - .vidioc_s_ctrl = pvr2_s_ctrl, .vidioc_g_ext_ctrls = pvr2_g_ext_ctrls, .vidioc_s_ext_ctrls = pvr2_s_ext_ctrls, .vidioc_try_ext_ctrls = pvr2_try_ext_ctrls, From patchwork Tue Dec 10 09:28:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901080 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 743B478F54 for ; Tue, 10 Dec 2024 09:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822938; cv=none; b=oztWEShA/HpX6WWu01zgf7dsZHnf2mTyJfHvcxvb8Z3Pl41PwMiM4hSr63Us3GE8lDdBOhbrmJZ/r9VqedfeuwxuUzRfMCsyHeDa4OI2pgH7kPNA6uBUTApO8BMqjoDaz39kHkGGvxl9tMVWCqnxWVB85OjrWtFt9y9AFqWw2FM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822938; c=relaxed/simple; bh=64tvBdAJsYjij/MYhZgHmQi1NAwPb0Ws3Nyiuj2wFEA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lhB/L90ca0q4INmHdZNlWxuLLX5tgv/km2mqDDM+dZl6RdrwNAJvWmfgABQ5aQv6530AxDXelOmRphX2o8eu1U6jMtZflnk+9M+PWy624AxGwAeedWVg0yK2KJD3A40j9j3BmrxZpSavJ+zZc2pkZbcZqTMTrXo06PyZTfhb5U8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=FdEGy4tl; arc=none smtp.client-ip=209.85.160.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FdEGy4tl" Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-4675d91ea1fso19311821cf.0 for ; Tue, 10 Dec 2024 01:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822935; x=1734427735; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FjvmPnf8Z5eA5SFOWcK4xqjLhjw4Qhz4HdUq4wZg+ks=; b=FdEGy4tlxE1ABYGqzZpRsnZmsirrXrfPFw5SN5s0po1qLptNs1Wpe2BmMkcSQ4MNEt cVon5sgpRHRp49yd3SH+QvASBBvNWBoIkbt+x9uTVOYMkmMUt6MfhTzOgM+TtVEFATM1 8t61iCxynytH5XPsnVfu81+I51SwFTus4tVFY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822935; x=1734427735; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FjvmPnf8Z5eA5SFOWcK4xqjLhjw4Qhz4HdUq4wZg+ks=; b=lIF9QGKMujWG+NjHPEvbJqwspOtSZ6Iydodeqmb4wO7XMFY0s45wx08sdfVt3FKPJO XxDuwOBfG+p4M259n2ZLacA2LkhKpsSOOxJOD7jehwUp0l+14pvQNHO3A7CT5MaIlTZv 1hbEwfP+hif5tyE24H55GqNDc0V1BVAB/eXTPly3qXzEItJ8z8RfeS33aYmirqVtHD/d /yp2HuoIQm56Hyi+3UI+UCEyn3YclXRJdcyOqEF3bb2mcFsML4fTYQVFFeeOgt4oUuDC 3Dznc3iJLLkJjJqHGpJWZNdQBt2QDO6Rpos5pMKf4tuSASNr6wLJ1MALT1AI9jKZ4FPN S2XQ== X-Gm-Message-State: AOJu0YxdASGZT5fJ2IRxMQ2qnkFFFf7ClEhBCMkWRd8kUoy/HFUiWmB+ WfZi2MTtVYubm+pc4pbiF3Tux6rMGy66vTuhp5wGCMCeQ7wdRm4CxMqH4CignA== X-Gm-Gg: ASbGncvV0VKQ+lFOfB9b+o2hTbCqmW6cMjAZ2BQY1yll5+Nv3FIKwkMsuhsoCNILaSi 0sWPH/mJP40zgZfYMVbMMmJJ0I751YByX+VS169VLe3W7foPjHEsZaSYyuvD29brEUibc96x2HR SMTJm4s+5q3Gpj4Y81dgNqBRwFAM3CJNNixtoC2vtTrLEt8VAwjMNYMVdJj5Q3l1g0pWzHH1htJ npMOjpA1rvqSVlJOrs4NGiqg80OOPy5GZcygJjh5stv+A6bsUNytzlWgaVldzC3YKAl6rwmF0fm AU9uAOPFUi55d7NqFtvGLs1KuQUl X-Google-Smtp-Source: AGHT+IHGAkrg9JR1HBN/d9GzBVA8UPusHAYSvN2VMXg3nbckSt2H7xOL5ABV9A5DnG2qBp0kGbezeg== X-Received: by 2002:a05:622a:1210:b0:467:64c1:c4a0 with SMTP id d75a77b69052e-4677205c693mr65416141cf.56.1733822935529; Tue, 10 Dec 2024 01:28:55 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:28:55 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:48 +0000 Subject: [PATCH v2 04/11] media: uvcvideo: Remove vidioc_queryctrl Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-4-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 It can be implemented by the v4l2 ioctl framework using vidioc_query_ext_ctrl. Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_v4l2.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 97c5407f6603..39f0ddb6d01c 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1014,15 +1014,6 @@ static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input) return ret; } -static int uvc_ioctl_queryctrl(struct file *file, void *fh, - struct v4l2_queryctrl *qc) -{ - struct uvc_fh *handle = fh; - struct uvc_video_chain *chain = handle->chain; - - return uvc_query_v4l2_ctrl(chain, qc); -} - static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh, struct v4l2_query_ext_ctrl *qec) { @@ -1563,7 +1554,6 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = { .vidioc_enum_input = uvc_ioctl_enum_input, .vidioc_g_input = uvc_ioctl_g_input, .vidioc_s_input = uvc_ioctl_s_input, - .vidioc_queryctrl = uvc_ioctl_queryctrl, .vidioc_query_ext_ctrl = uvc_ioctl_query_ext_ctrl, .vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls, .vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls, From patchwork Tue Dec 10 09:28:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901081 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3B441DC995 for ; Tue, 10 Dec 2024 09:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822940; cv=none; b=JyaBPSokvP/NSlv7wKkE+TjZPVMIMtGjENOzi+7ciFQPE4o3S2UuYPPsbwxeCCmry2F2yj3pOQMgNFxpLmghXOpfqQ0vYjvpW69fbJpzRAn6LbPxpvjadu2NTtBIs2WhFSm+s6h6QG73t2DDfunf/wfatCNFc2RpA3YmnSt1GgM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822940; c=relaxed/simple; bh=ctL5AnJGV5DJC9CXkrWVL7zWfndzHWXxxUlRLsEsOfs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=go4X65v6GU04bqGtDBId351l8ewHIXNxXnEEkEnTQNHTo5ivL+/6UOPqZri0mBzAgoDvB7jXo1Ldu0AEb/bWp4jXpuc1lB2cLxxyS0785m/4FVpMpcsVxxAXLPcOn/7aPEsRcFOs5wd1/7j7ILi6kuvnRmsTIjxynKp2r0j2hno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Yx1G88Bl; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Yx1G88Bl" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-4676e708aeaso12162251cf.1 for ; Tue, 10 Dec 2024 01:28:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822937; x=1734427737; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=H6+2CPj9NTbpQOo8ueUbGM8wqslpqQFkOdhDSPG4NAo=; b=Yx1G88BlOsFZXeZaeSr4+qTi6TLPnSqodP55Tf/fizkfz2AeROlAMrfNFuEcsO/UDD eJ05o4/rQakXKP7jOeapYkr6fEgA7kt1gXE0541yeaMr5zqX8jmbu+2yxevTDShahfsC xGcXR72Qgv5mqq2W8kpx5zm6y+S+kB0uM2lyY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822937; x=1734427737; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H6+2CPj9NTbpQOo8ueUbGM8wqslpqQFkOdhDSPG4NAo=; b=opEicQhpvlpnbpIvTe+d1o1xyZkGj3E0//BSf6JRONoMDDbyUsSCpywkfWI8fpFEhc GaFTAX9GsLsIdrAjis/xdJTuo9FRt8uGsqA5s7N6NYTZtXUoRuvXk4jNA8sL2YjZB2PI UCDr4jE9+h5JiknWohPkt0PEf6gDVwpl2dYLwqYdcaM5AIU6VfKo4WKoGqm77ykh+klD suyrwP6ki1RXR/jichmmXtsS1uJMn5L6lV6gfcqy159qMQPM9F2reB1zwX+JbBZ1gndJ j9QeCvK+duPKQ4ZDWCxbJDUfBpS01g5y46ifDgShYnwtoOZaE5C1ygPX5EgsuPpwM7CI +9EQ== X-Gm-Message-State: AOJu0YyoD1sxdUhhI53YQVlrE/o3PyfmjVWgBlk9IHwm283N/7w5WUhg v/K47L1YMnVZum2xgPWiF786ITn/AUddu9yU0DYG9YU9icq6sWWTF1j7O6o3jA== X-Gm-Gg: ASbGncstXRU0YYwqOro/tEZVoRwklKbv6nL7UOUo+hyg/09muMBqG6dLrG1TwFxMKPI lmfNZbSKr28xdywvhtqAjDpjsvdgBOJzdJ8cegKODAgG0RBwbnwx3OLohqUGw5H/QPPseE/sxU+ KDWDcTYxaEZpOZ3QrY6t66uCWldEg0cJKdYujzLpXuIijf2qCHqCS41Fw20LjU5NithuD6tbQt4 40B66BmhJ0WwXC7ZeE+yCjeYXNw46n5+9A1M+UKs0YQOV7divD1ov9R/EOKd5+QhN2aXZ5IMPc9 wKi6QpXXmp4ssxYEyuMO3Zff3aQQ X-Google-Smtp-Source: AGHT+IE8b0PM7gKALz88Rd23P5sKAeyq0cPFEHzTFCgEulkAqAHRhkOVnMDbHAXt7ijPFaIS17Apgg== X-Received: by 2002:ac8:5fc6:0:b0:467:774b:f04b with SMTP id d75a77b69052e-467774bf44cmr28726901cf.22.1733822937679; Tue, 10 Dec 2024 01:28:57 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:28:56 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:49 +0000 Subject: [PATCH v2 05/11] media: atomisp: Replace queryctrl with query_ext_ctrl Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-5-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 The ioctl framework provides an emulator of queryctrl using query_ext_ctrl. Replace our implementation of queryctrl to support both. Now that we are at it: - Add comment about missing functionality. - Remove superfluous clear of reserved[0]. - Remove ret var. Signed-off-by: Ricardo Ribalda --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 33 ++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 1a960a01854f..6b84bd8e6cf3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -34,7 +34,7 @@ static const char *CARD = "ATOM ISP"; /* max size 31 */ * FIXME: ISP should not know beforehand all CIDs supported by sensor. * Instead, it needs to propagate to sensor unknown CIDs. */ -static struct v4l2_queryctrl ci_v4l2_controls[] = { +static struct v4l2_query_ext_ctrl ci_v4l2_controls[] = { { .id = V4L2_CID_AUTO_WHITE_BALANCE, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -1140,31 +1140,34 @@ static int atomisp_s_ctrl(struct file *file, void *fh, /* * To query the attributes of a control. - * applications set the id field of a struct v4l2_queryctrl and call the + * applications set the id field of a struct v4l2_query_ext_ctrl and call the * this ioctl with a pointer to this structure. The driver fills * the rest of the structure. */ -static int atomisp_queryctl(struct file *file, void *fh, - struct v4l2_queryctrl *qc) +static int atomisp_query_ext_ctrl(struct file *file, void *fh, + struct v4l2_query_ext_ctrl *qc) { - int i, ret = -EINVAL; + int i; + /* TODO: implement V4L2_CTRL_FLAG_NEXT_CTRL */ if (qc->id & V4L2_CTRL_FLAG_NEXT_CTRL) - return ret; + return -EINVAL; for (i = 0; i < ctrls_num; i++) { if (ci_v4l2_controls[i].id == qc->id) { - memcpy(qc, &ci_v4l2_controls[i], - sizeof(struct v4l2_queryctrl)); - qc->reserved[0] = 0; - ret = 0; - break; + *qc = ci_v4l2_controls[i]; + qc->elems = 1; + qc->elem_size = 4; + return 0; } } - if (ret != 0) - qc->flags = V4L2_CTRL_FLAG_DISABLED; - return ret; + /* + * This is probably not needed, but this flag has been set for + * many kernel versions. Leave it to avoid breaking any apps. + */ + qc->flags = V4L2_CTRL_FLAG_DISABLED; + return -EINVAL; } static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh, @@ -1561,7 +1564,7 @@ const struct v4l2_ioctl_ops atomisp_ioctl_ops = { .vidioc_enum_input = atomisp_enum_input, .vidioc_g_input = atomisp_g_input, .vidioc_s_input = atomisp_s_input, - .vidioc_queryctrl = atomisp_queryctl, + .vidioc_query_ext_ctrl = atomisp_query_ext_ctrl, .vidioc_s_ctrl = atomisp_s_ctrl, .vidioc_g_ctrl = atomisp_g_ctrl, .vidioc_s_ext_ctrls = atomisp_s_ext_ctrls, From patchwork Tue Dec 10 09:28:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901082 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1856F1DC9B7 for ; Tue, 10 Dec 2024 09:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822942; cv=none; b=SW+6tGiCrWa1WkL/DiBn9t/kHycuptPAzMwaXhvE/0oMmScsTn8UGlTWdJ6l0MTpUQN6wihrb05xxpV+TPwqdKMWC789RLC2ShakH37/IBUGg2bRhhE4kHQNZtJl1Za9796wimF8n5k14ZDvsmpVL1nQ8gWEjZt3XYs1ExN3tnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822942; c=relaxed/simple; bh=Kwv/wusL3b84HhR/u3oJDyjPqtdw53INZ92ugbbfA2w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F8M7Ol+5sDzrUqhg1sTjiep0hF/r0I9NU+dlj8x9qHZTMh8k6/RhlF0i9Wyo9IMJIFRehcO27XgeZIb95VcP663iaGmCW/GRqpqx1YgMv3pnSD0CYvc7CvQ4Hd2RW8leny4K9fSWb/jiC/OmZa4lh2gTCCIZ8YeSMnkX8ccsw3o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=HEFYh1Gz; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HEFYh1Gz" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-7b6e4d38185so15172185a.0 for ; Tue, 10 Dec 2024 01:28:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822939; x=1734427739; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Yvntl3jvEfc//x9pm27kdXuf3uRYNcagoSWI36TzXug=; b=HEFYh1GzD/2YzB5LKa6KQhG2Tx1VaQrh/REseLNiH9NRm77HoILhHfdib68K2080Fo FjfsxXVKIOaMeY24zgPQLGR+HOOruicZPlDGlVlwyt+nIfRNRI9ZE4AkPp3JI7vOZscz w8cCUNToL/wYaVHTqqxF3WG7TiFmvqzTYLjhY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822939; x=1734427739; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yvntl3jvEfc//x9pm27kdXuf3uRYNcagoSWI36TzXug=; b=bylzTdi8EKgGwSWDiuBdXTkY0l5aIU3OcoxIJo5bwF6xgbWg0iIFD4lA8H+UcLJOA1 lRo0qiq6s62FiZlnvuqdIRTNEvFQ2u2F4RduvBtWututH9kuApLi6AfFjSrybym+s8S7 kCgGZCxEC+hjhK+Yyp6uKhzw8pjXoUnAilGBbYIPJlrnUKsnHmEVUSLA9mdsxG0dyIm6 rAAg46cUsEQhZHLOBMYYoT1uR3Idol6E/GJ/0ZxswGC3s0tDKcmzK1ecNOh7bOCCkpmi EIA6+s2s1ezIBxedr3WV45t/4xz5Tk7MdMdivVoh/9GjFS/fqmmnGoPxfxdWmhWPy4WD h5PQ== X-Gm-Message-State: AOJu0YzRDYDYnx1t7rmr0XxnETOe6KNbnItIpK8cVcpqSsDq7FIBRE9H RlqP8lMmvOFUrW5C5iRxHbMjegid34DXg0uQCK8PlgZJvyjp6+D6AJt/KhssWA== X-Gm-Gg: ASbGncuwVe6Gs5qS4nT6JPnhHXpubG/yDUjEVvLfw3SDhhlVSGm7QqSaLbAezAtrUhK eRQaCw1ASViL+VqsiVktRYBkaSkPpZVhuHxRROfGW2/wQWRprCHFhwswGhZr/kdU5Bw7KD761hm VM4NDElMdznYR6u6HKh3KX199xtSghr8TUeUdnPOPttCO4H/Gk7F7xg+H2Zw/k1jhrRFaV9nfNT DhaxGB39YBtMrVQ2wpy8V8SgIV64DF+zR5PqPT0zk6Z2bD8CJe1CRlxlaxkt2jHkWy5voXTh47E 96wDHhqxy9owSem3fcl7aIAUXcZT X-Google-Smtp-Source: AGHT+IHfGjM3il73uzcVVahBJWJV4voLVQSpqP4azfgSBEzlCLsR7XuITVeqz6peN1GDRvj/X2uvew== X-Received: by 2002:a05:620a:262a:b0:7b6:e8d4:9b89 with SMTP id af79cd13be357-7b6e8d49fb7mr13352885a.34.1733822939131; Tue, 10 Dec 2024 01:28:59 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:28:58 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:50 +0000 Subject: [PATCH v2 06/11] media: atomisp: Remove vidioc_g/s callback Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-6-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 The v4l2 ioctl framework can implement vidioc_g/s_ctrl with vidioc_g/s_ext_ctrl() and we provide those. These are the last references of vidioc_s/g_ctrl in the codebase. We can attempt to remove them now. Signed-off-by: Ricardo Ribalda --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 6b84bd8e6cf3..1fb2ba819de3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1565,8 +1565,6 @@ const struct v4l2_ioctl_ops atomisp_ioctl_ops = { .vidioc_g_input = atomisp_g_input, .vidioc_s_input = atomisp_s_input, .vidioc_query_ext_ctrl = atomisp_query_ext_ctrl, - .vidioc_s_ctrl = atomisp_s_ctrl, - .vidioc_g_ctrl = atomisp_g_ctrl, .vidioc_s_ext_ctrls = atomisp_s_ext_ctrls, .vidioc_g_ext_ctrls = atomisp_g_ext_ctrls, .vidioc_enum_framesizes = atomisp_enum_framesizes, From patchwork Tue Dec 10 09:28:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901083 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EB2F2080C1 for ; Tue, 10 Dec 2024 09:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822943; cv=none; b=XF0UIrvvO4LUxk48piRWUeWY0/8N7QrR3JYsoTIpr0RDJoDtZckOiS72zz9hq6Ks3rS5rIaCDmylEqKCxulr2U67lXlTu+CVzD7qKr+yI4yrhtcW/xSMJezDxPSe0IqiGJkgwZQYRpeAQHVudnl5tWZTVUA3DtuHZ843iumpMNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822943; c=relaxed/simple; bh=UCSCdBd2wYaTg2mVCWPKK/8ZcXTPSRHtCpuikvCx6bI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TJSiKA1982jNiyR/l2l82h/+Wtp6bHq4+qPfVBBGE/mf2SJwV2EYXu4QrLBKhZVgEkIvJHa/38w+WhxZtUrdOAPWrG0v7F8VSSPdoEOMrqhONU6v41jDD85Af6iSNX0AFbuP+OGg9qpwMM4bPM8yJcIX4csXHLqqisaV+rZ9UWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Y+6h7vWe; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Y+6h7vWe" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-46772a0f85bso9245901cf.3 for ; Tue, 10 Dec 2024 01:29:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822940; x=1734427740; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=WiogjbYyyp3CBgcBMLahUXd4YrS+7xUetAO4W7bj77A=; b=Y+6h7vWe5HAwwUqdm1SiV73n5I0p+/eicUZJq4BZzI/h84HiUwA6ZaJWoqnhbOqMfa 56eh9lXWDEd4YsaXcEVAHSx5ZIxqZpROJBdcQK03trWPYLcJnVf1/JKogft+KSwBlxSY Kan4qOh8bzm6BXTkW2nMgOGuBxWZ5uG8efAik= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822940; x=1734427740; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WiogjbYyyp3CBgcBMLahUXd4YrS+7xUetAO4W7bj77A=; b=KCCBzqVNVi2M3t381XfxIihAAZPC7V7WS+YEO59Ct9+N0uYsEiSBe4pQMeRyw2If0v F95znQGP0OskrM65ea3QhQ/Nmy78QR7Zc90Lqh7psepLSbQCBGl1o0TB0jsg4OGfinh6 Yk7BMaPVD+1WjTUBSARk3tF09rRThk5pSGS84n1dSrvH9xQZN1RNe9fgLa14xrwzk6ON /3FHAS5C8Rix+WOubiiLih+gzb5ThoV7Z7W1HtHOCjoxW8zZfmDD6pVhBxVh96NKvldp pLBRtLIaNrXucGWWh12UgU/dbV5B/2bVXQJXSEWUVf+yl+jk8jqACX1rJmMng9Wc3slH SR2g== X-Gm-Message-State: AOJu0Yx61PZxyUyR+mGhZeoWkZOJiFFnnrfBxUfsKZzAudVf65RSggR0 yTPGSIBGpo5s0g390HlhaaAvBpaZky6GZ26mLldpn+iTM2tO79+qAFtLWsnqSg== X-Gm-Gg: ASbGnctrAV45ENY4nFpuiQnhqeFuIELAlsRT5Lge/eMBNBHtWrr0G48NhV/a2qTHYk+ a8TvmFCdz7a0uwt6jPlWYCt/qPB640h2cQ6YLE1nSXg4Y9WZsqM5eBs878Txeusp+VIGA8LOSOr iIE79MM6zA9QHbQXss5fkbkeGiZQMzw3txFlpnPfJ6OPpPI9U5ccKoDMhc3j9Ox0Yy5SP+R3i1l kcMddkeFWrL38xFVz0ha/xJf7RDxuE6ZC20iIIFghg9rngEMbNHU0lzllD/SDjIniwMJ/qRenYt aIti0XAtuFcOegtvSZXOZwhN+8Xp X-Google-Smtp-Source: AGHT+IF8s1VwNRHBCKTet1sDHMwDl1DPA/dKCCMhA10gvPO+iNrMX8TslNymChXUWbVD4blpu2r8gA== X-Received: by 2002:a05:622a:4a1a:b0:467:681c:425f with SMTP id d75a77b69052e-467681c44famr119359851cf.4.1733822939993; Tue, 10 Dec 2024 01:28:59 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:28:59 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:51 +0000 Subject: [PATCH v2 07/11] media: v4l2: Remove vidioc_queryctrl callback Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-7-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 All the drivers either use the control framework or provide a vidioc_query_ext_ctrl. We can remove this callback to reduce the temptation of new drivers to implement it. Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-dev.c | 3 +-- drivers/media/v4l2-core/v4l2-ioctl.c | 2 -- include/media/v4l2-ioctl.h | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 252308a67fa8..5267a0686400 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -572,8 +572,7 @@ static void determine_valid_ioctls(struct video_device *vdev) and that can't be tested here. If the bit for these control ioctls is set, then the ioctl is valid. But if it is 0, then it can still be valid if the filehandle passed the control handler. */ - if (vdev->ctrl_handler || ops->vidioc_queryctrl || - ops->vidioc_query_ext_ctrl) + if (vdev->ctrl_handler || ops->vidioc_query_ext_ctrl) __set_bit(_IOC_NR(VIDIOC_QUERYCTRL), valid_ioctls); if (vdev->ctrl_handler || ops->vidioc_query_ext_ctrl) __set_bit(_IOC_NR(VIDIOC_QUERY_EXT_CTRL), valid_ioctls); diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 7d615ebc511e..f512d62ab0c6 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2294,8 +2294,6 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops, return v4l2_queryctrl(vfh->ctrl_handler, p); if (vfd->ctrl_handler) return v4l2_queryctrl(vfd->ctrl_handler, p); - if (ops->vidioc_queryctrl) - return ops->vidioc_queryctrl(file, fh, p); if (!ops->vidioc_query_ext_ctrl) return -ENOTTY; diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index bdbb7e542321..013996c33a9e 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -193,8 +193,6 @@ struct v4l2_fh; * :ref:`VIDIOC_G_OUTPUT ` ioctl * @vidioc_s_output: pointer to the function that implements * :ref:`VIDIOC_S_OUTPUT ` ioctl - * @vidioc_queryctrl: pointer to the function that implements - * :ref:`VIDIOC_QUERYCTRL ` ioctl * @vidioc_query_ext_ctrl: pointer to the function that implements * :ref:`VIDIOC_QUERY_EXT_CTRL ` ioctl * @vidioc_g_ctrl: pointer to the function that implements @@ -461,8 +459,6 @@ struct v4l2_ioctl_ops { int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i); /* Control handling */ - int (*vidioc_queryctrl)(struct file *file, void *fh, - struct v4l2_queryctrl *a); int (*vidioc_query_ext_ctrl)(struct file *file, void *fh, struct v4l2_query_ext_ctrl *a); int (*vidioc_g_ctrl)(struct file *file, void *fh, From patchwork Tue Dec 10 09:28:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901084 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 283842080F9 for ; Tue, 10 Dec 2024 09:29:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822944; cv=none; b=PRGze4PNWrkB+6LSWsiAnOAWJ+49s/SPaiNn24gvmPRs5WNViFr3h95gettCDsfT22liOvT3LDfFBvSrh1vVVK12MFMlaz27Q7OVBuMIr5knnw9RLjIU1PCdWgMhI2d3z+Ck/L3AWG/PvYVl2crm8EVXN+hhQ9QTPADGUm6Zzr4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822944; c=relaxed/simple; bh=cG4VxhpXxhG3TuQZqSRn1AJUQpiLuYKfsrXFh17x05g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SVsHqRUVQw3PTZCZMLyqJKuFgV431dcsz9ptFlX5VgDyJW3O8S5XH7mNgOqMzEO5c6Oovm5fgJ6K+zLGyzOraumBJnL9v+RCBEE9eAJDwKbvkZGQEbHz6nOwhA1e5ap6GzjwKJo9LMtlwxEeBCvchnwWuLsIN/FGl/kLatQJGF4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Md16N89N; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Md16N89N" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-4677628c092so6452391cf.0 for ; Tue, 10 Dec 2024 01:29:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822942; x=1734427742; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XSXoybomn/ykxqyK2CoWexEZQMj81DftjVpdQUWPaP4=; b=Md16N89NGtmK0ZxXTjFBSgDYavnpTkjn9RmZhDR2QCINT8cVqM0eQXv078Saz6r66G Cx+tHWGvxsiGcxPaI1A/LE3p1ri6IgW3qr5APiPuHteU49uj8ug/NtbbJ0KpQuTHUnEh DPstyvfEfqQs5oj3wRBgHSjhf/Fm7h58kVjuQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822942; x=1734427742; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XSXoybomn/ykxqyK2CoWexEZQMj81DftjVpdQUWPaP4=; b=UnAwBBN9CDoAlR3QZfEqEA1HvZufoMaff5kyMiB5z79f4t++Xrt2gu3nI1ZXXUdHME L28fmiw0Jd6ELA9Bn/fgfq+hA3flGqFrs85LP2VFUjg18YxxbC1z9jih6LUlxZPb09f6 syZCJo7KkmzFfbtYljblbEOkJkZ7SS5VIRNPJYMRVYo8ztgD6ZOQ9UoDBUN90B/bM2hd wuC3kXVg4RHqnk5fbwEDxq61J/5oWcJ7EtUHi2mAp0Eu4tAZzuQ/n+oC63JDVtiOYpwk dN7D8Nv8wV4fHhF/M1dG0NuXVjz0b/CiryCywmyAnFu5//Rkwr2q8UU4uYdaAJi+rsXb CmdA== X-Gm-Message-State: AOJu0YxwyjYOSSjSSv/9SfcDozMAjSrCJ3oa9vo96YD5S2+DCT8U6XHX ZarFR6xfJbFAgsNxHuWTcwZbB9UCTVBjS3bXqp2eySm7KI3fOiHeo5fAQqI2IQ== X-Gm-Gg: ASbGncvlZTWqhV4Ed9sYO3cgiEhDpByMvym5lEprYU6tAvrH5WfK6h+X2QZ/F2zDF31 bC50R5xWVBwmaoXfU9WVEHtaMxo1b0tQkX4zeYvX5BWIFuKD4BT1j0+0Hnv9EJnZnQ0EQXgYd3M IDPxHsgi4TAPEWQAeAUzT0cYoo/Qv+xz7fyv0IelNfRiyOd22WezGWI51ufyi/JVJg1HsTuOgoR TOOPqpCQwaMNzqxLev+rZyPlMscZXH11ye3LBYEydj4BwIFCIML1jPYH5FAC0MomKZ1cXFpFm5s 6kEGdt2a24SdVMS7LTEFceW/uTpY X-Google-Smtp-Source: AGHT+IHyw4/Sttmns55BK2aFWcYhSEUrFm8lcYTEWfDHCAAYIHWB09gHSf50A3dGLtaNkvGDK7brMA== X-Received: by 2002:a05:622a:5588:b0:467:54f4:737b with SMTP id d75a77b69052e-46754f47fcfmr168332111cf.25.1733822942143; Tue, 10 Dec 2024 01:29:02 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:29:00 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:52 +0000 Subject: [PATCH v2 08/11] media: v4l2: Remove vidioc_g_ctrl callback Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-8-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 All the drivers either use the control framework or provide a vidioc_g_ext_ctrls callback. We can remove this callback. Thanks for your service! Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-dev.c | 2 +- drivers/media/v4l2-core/v4l2-ioctl.c | 2 -- include/media/v4l2-ioctl.h | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 5267a0686400..068ee67cd574 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -576,7 +576,7 @@ static void determine_valid_ioctls(struct video_device *vdev) __set_bit(_IOC_NR(VIDIOC_QUERYCTRL), valid_ioctls); if (vdev->ctrl_handler || ops->vidioc_query_ext_ctrl) __set_bit(_IOC_NR(VIDIOC_QUERY_EXT_CTRL), valid_ioctls); - if (vdev->ctrl_handler || ops->vidioc_g_ctrl || ops->vidioc_g_ext_ctrls) + if (vdev->ctrl_handler || ops->vidioc_g_ext_ctrls) __set_bit(_IOC_NR(VIDIOC_G_CTRL), valid_ioctls); if (vdev->ctrl_handler || ops->vidioc_s_ctrl || ops->vidioc_s_ext_ctrls) __set_bit(_IOC_NR(VIDIOC_S_CTRL), valid_ioctls); diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index f512d62ab0c6..03a62fa960b6 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2378,8 +2378,6 @@ static int v4l_g_ctrl(const struct v4l2_ioctl_ops *ops, return v4l2_g_ctrl(vfh->ctrl_handler, p); if (vfd->ctrl_handler) return v4l2_g_ctrl(vfd->ctrl_handler, p); - if (ops->vidioc_g_ctrl) - return ops->vidioc_g_ctrl(file, fh, p); if (ops->vidioc_g_ext_ctrls == NULL) return -ENOTTY; diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 013996c33a9e..4d69128023f8 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -195,8 +195,6 @@ struct v4l2_fh; * :ref:`VIDIOC_S_OUTPUT ` ioctl * @vidioc_query_ext_ctrl: pointer to the function that implements * :ref:`VIDIOC_QUERY_EXT_CTRL ` ioctl - * @vidioc_g_ctrl: pointer to the function that implements - * :ref:`VIDIOC_G_CTRL ` ioctl * @vidioc_s_ctrl: pointer to the function that implements * :ref:`VIDIOC_S_CTRL ` ioctl * @vidioc_g_ext_ctrls: pointer to the function that implements @@ -461,8 +459,6 @@ struct v4l2_ioctl_ops { /* Control handling */ int (*vidioc_query_ext_ctrl)(struct file *file, void *fh, struct v4l2_query_ext_ctrl *a); - int (*vidioc_g_ctrl)(struct file *file, void *fh, - struct v4l2_control *a); int (*vidioc_s_ctrl)(struct file *file, void *fh, struct v4l2_control *a); int (*vidioc_g_ext_ctrls)(struct file *file, void *fh, From patchwork Tue Dec 10 09:28:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901085 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A50AA210F4F for ; Tue, 10 Dec 2024 09:29:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822946; cv=none; b=eAevMBQB7j2HAp18A6CGcIY9qJQRdNcYfWZ0deAt6WbL+nnTYyxGqOGwF+/rzC1Ru8d0fbCHq5E4sqPqC+54Tsgy/VuHc23/sh38AT4DOAT9V7wfEEQL4CwfYoGc7wiDi0cBFZn3GqdtBBDQiQ2fPQ7fmOiy5Aupjkh8pCZVEp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822946; c=relaxed/simple; bh=YVfCDMG+ewVwUxyDDbbSOUAdz+veaEMx7LKaz5GBLvs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YQZRJTmCl7I8SdtfPxVxqg0BrdW8O1enk+RlV8ZD0mWx0Ncn2aNQ8HBkrZq2ZMelGpNHRv3MbVhF4NCNOv7MvnhoNE68cwawQZsB8tiEbB994NSK8W+/Q2o+D87InHyDfHab2B00KuODXHSqmvzQIxM22Qee8U1PPEYURN1qzII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=nI3V1Dp7; arc=none smtp.client-ip=209.85.160.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="nI3V1Dp7" Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-46772a0f85bso9246471cf.3 for ; Tue, 10 Dec 2024 01:29:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822944; x=1734427744; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=L2k1H7nZ6EFiaX0ZIjONbwuF9mUJ/0XMhcmQKMZ+rwA=; b=nI3V1Dp7T0hfEQYxkJOLGF3kHpJwE/kPQJq15igQrTvDIaJiCzc5dMhc6RKUrx/NNS jHr4dVxFO8rIn8MfxnRRNzWnzomQEK+kpzFdxFHGNH7pKUMDXazoNOfg1dfuOfOHP8mo DdrFgR+7bnebnWUPSupBGUfIh+5Xc0ueLdMwA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822944; x=1734427744; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L2k1H7nZ6EFiaX0ZIjONbwuF9mUJ/0XMhcmQKMZ+rwA=; b=Cr7rrPf0FXM0Lr1QrLS3NqIDuwdSd2/pslVXyEYl1KXKfl8W/Vd/7xfpRxoF8QdPPy UgLlx2GaMF1PMkqwr8m2XmJhiAsfN6xxw1nH14T/X9iTrK4G4OWCQtpM29vtnYV20MTO 7+6sC0YrMD9ScSnYkAnHsMlEH88zWcf5k3XMjJSKDVyRwOQv0Kg5vSgEn8MVFsJ284Fk sTJHkNzUzB3HcXH9YCiUXD1iSfTwmQSt5WYAJCPGftD3/xxaC5qQGEOIuBSLBgvz6Cl3 Y5qGiaOtvdmIC1LrqfLEfSHM798VEmzu5q2I6HdEkkyOlb7pRP7iEiO71BG0CvjlUAS6 iFmA== X-Gm-Message-State: AOJu0YwNwkXIF/bB/dMTy+MkmwUFUwoq++YD7/y2hsmtnljHAQ8dQPpz 24m2RhYnhtkHD9G6Uqlin+oQC1RK9zAg0yLWiIsR9NxPcQLkBtgHX0vo+v9Rmw== X-Gm-Gg: ASbGncuBVa8OpabFZRkuAmrxn0lCe7HAMLbdpF++Ll5jAI+pPKc7XaW82opvGmoumJT xvDRENF+oDCtam6qJsCuAC5EvgfT9ugoQjQLr1af4aBE6y329mJ6yrkkdw/DtjohX934b7Jts4H cnVHlUwdVo+cTYyf+77i1dPmALDxVYxS3Uhf9626waHIa4JjZaeyXHLRlhAmZ58AjHewZO733Zg 2NKTUE1yLCkH7h3Y1sb+FLcSQhZxJS9xHfw6srM04tAVlKiOnvhdDaPSqd7Sjb/x3YUCBaSp0u2 CUNgLGxmGpH1UHEH7oCeqBI8kpTh X-Google-Smtp-Source: AGHT+IEmJjvoC2m9o25B2ktE1e5ZVohikSh/O5M+IBIs1ll7GIWjhNrYVUCYVVrSS3n3G9mzLPzHbQ== X-Received: by 2002:a05:622a:8e16:b0:467:4efa:c45c with SMTP id d75a77b69052e-4674efac5e3mr148764831cf.29.1733822943719; Tue, 10 Dec 2024 01:29:03 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:29:02 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:53 +0000 Subject: [PATCH v2 09/11] media: cx231xx: Replace s_ctrl with s_ext_ctrls Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-9-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 The v4l2 ioctl framework can provide support for s_ctrl. This the last driver implementing s_ctrl. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/cx231xx/cx231xx-417.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c index a4a9781328c5..3c1941709ebf 100644 --- a/drivers/media/usb/cx231xx/cx231xx-417.c +++ b/drivers/media/usb/cx231xx/cx231xx-417.c @@ -1538,17 +1538,24 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id) return 0; } -static int vidioc_s_ctrl(struct file *file, void *priv, - struct v4l2_control *ctl) +static int cx231xx_s_ext_ctrls(struct file *file, void *priv, + struct v4l2_ext_controls *ctls) { struct cx231xx *dev = video_drvdata(file); + struct v4l2_control ctl; struct v4l2_subdev *sd; + unsigned int i; - dprintk(3, "enter vidioc_s_ctrl()\n"); + dprintk(3, "enter vidioc_s_ext_ctrl()\n"); /* Update the A/V core */ - v4l2_device_for_each_subdev(sd, &dev->v4l2_dev) - v4l2_s_ctrl(NULL, sd->ctrl_handler, ctl); - dprintk(3, "exit vidioc_s_ctrl()\n"); + for (i = 0; i < ctls->count; i++) { + ctl.id = ctls->controls[i].id; + ctl.value = ctls->controls[i].value; + v4l2_device_for_each_subdev(sd, &dev->v4l2_dev) + v4l2_s_ctrl(NULL, sd->ctrl_handler, &ctl); + ctls->controls[i].value = ctl.value; + } + dprintk(3, "exit vidioc_s_ext_ctrl()\n"); return 0; } @@ -1627,7 +1634,7 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { .vidioc_enum_input = cx231xx_enum_input, .vidioc_g_input = cx231xx_g_input, .vidioc_s_input = cx231xx_s_input, - .vidioc_s_ctrl = vidioc_s_ctrl, + .vidioc_s_ext_ctrls = cx231xx_s_ext_ctrls, .vidioc_g_pixelaspect = vidioc_g_pixelaspect, .vidioc_g_selection = vidioc_g_selection, .vidioc_querycap = cx231xx_querycap, From patchwork Tue Dec 10 09:28:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901086 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCCBF215761 for ; Tue, 10 Dec 2024 09:29:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822951; cv=none; b=VQTfjOmhKDbarm6cn9YqmMT44OxjaQIURK6ZGWSPVmr8V4mz/f0+pvZiMJzmKB3SblxP3e/rr+GCzAYX4QPCKRZ/7dV3LFMamB8SWKWEjIqgeopFiWISorzTDEK8ne10JzaQNH4m0ZTZ4ppWAk0H9Qx56QFqnEWD3MCCA6Wmkk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822951; c=relaxed/simple; bh=oBcqkfXM7E90s1taQvAsnIcQGP+0/edriRflHVpoMcM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PbDGXxfk9Z8nV14Bq2mGrAlkmaaIgxpw9cn0PexevQUcc5St4QE9yTtlcWTVTnTk+DbuK64RvshEa+RDp71tG5/QAFQ9Z5X78JNEXy1TJnfLH/zFNBdDoV5qW9MMBHE5PcIIdZmjehO87uQP2GtpXxE+2Ak1OBF1HVfx5kesGoE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=h+q564Bb; arc=none smtp.client-ip=209.85.222.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="h+q564Bb" Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7b6c593e8faso179440085a.2 for ; Tue, 10 Dec 2024 01:29:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822946; x=1734427746; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fauP20HSTE8MNs9sZtafcLYAmxh0dWmJO0jdKtoSo0I=; b=h+q564BbmKoNGPi+38Y8l45bw8AisgX31eE1zNL5+UxiVINz2okuh3tjZM1FwWvWuY XILhu0GHq3gKEW0eqU32ulUac03Q+EbhBTB+6RP6N8OZItddjZ87itOV8BMncpBP0C2o t+CHmzt/1/9iRwVftnnoSbzbi5bBg7BoRCrJM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822946; x=1734427746; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fauP20HSTE8MNs9sZtafcLYAmxh0dWmJO0jdKtoSo0I=; b=bvMcidYCXnu22U0nsB0ExnRTmtmICfBoT5vGNjk07HApNY+dXs7IVf6ic07FBrNhFv UVYr4YlJ3Y3HyI6EIlyU9+VTM4z8EEfvM2tBd5hZk5c+7lYajLeF7cu+5ex7E3BDoNnb lkTgyB7y2U1vmEpF9EHYdynfX+SqyTbGUSN4MqYGA1L+D3mIioguE9hIiUrcGHsU3DHG lN4AWkBFifq6CNOvM8yJMJDFrCMLRnaswFFBLGalIPw7O0YQX0smAoc8BbGC6Bmqc8Um esNig/xVQjQfrgN4pOKnqvyGh+1lwjGySkZzc3aMotHJ3UZTKfsuHObLa8XHRx9KNe6/ qzWA== X-Gm-Message-State: AOJu0YwkY9mQq8ghmjrgVGaszM5TGj9+J6+fJnxPQ6/h7DSTj+QbcSv3 C23Zz9VqLokHJq4rosHyjwzQIGNvXvO9vwtM31bl9/BKayhak77JrzNpOOO+ow== X-Gm-Gg: ASbGncvVdGB8TcQmtDUqU5g+20uam/RbHxcutpFI1M5OUiGHr0UxZLX0YBIEpz670c4 lKACC/ql1dTzxvAnMNKSSMEZs9aZqcCifgBxbmoS39JSFWOsT4K9AcUvOvSJoD+BDZCY6vzw+dx 13zcSGlDhTCCK8RUsxB4yrEe/6aKtzqsmT3AYf2Nu/bhrrhSjUq7zPKwy1bpjCy95nnBLktz1RP iONwGhdXM49mKYaK++c4k64wJGwSJqSbguooZvvLjmcIaPS1YTAYhXE7YYPlGftQu2wQ14lqqXT 8jOkL81BaMc0gWCmGXidlSzO5LON X-Google-Smtp-Source: AGHT+IEnAKwp90vPjCXMeqd1g8B6cI75StK2j/sdcO6TCrMFGNndcgYh+1KjE8474PP7wfMI8TymRw== X-Received: by 2002:a05:620a:2a06:b0:7b6:deaa:3191 with SMTP id af79cd13be357-7b6deaa33cfmr302944585a.55.1733822945932; Tue, 10 Dec 2024 01:29:05 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:29:04 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:54 +0000 Subject: [PATCH v2 10/11] media: v4l2: Remove vidioc_s_ctrl callback Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-10-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 All the drivers either use the control framework or provide a vidiod_ext_ctrl. We can remove this callback. Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-dev.c | 2 +- drivers/media/v4l2-core/v4l2-ioctl.c | 2 -- include/media/v4l2-ioctl.h | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 068ee67cd574..b40c08ce909d 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -578,7 +578,7 @@ static void determine_valid_ioctls(struct video_device *vdev) __set_bit(_IOC_NR(VIDIOC_QUERY_EXT_CTRL), valid_ioctls); if (vdev->ctrl_handler || ops->vidioc_g_ext_ctrls) __set_bit(_IOC_NR(VIDIOC_G_CTRL), valid_ioctls); - if (vdev->ctrl_handler || ops->vidioc_s_ctrl || ops->vidioc_s_ext_ctrls) + if (vdev->ctrl_handler || ops->vidioc_s_ext_ctrls) __set_bit(_IOC_NR(VIDIOC_S_CTRL), valid_ioctls); if (vdev->ctrl_handler || ops->vidioc_g_ext_ctrls) __set_bit(_IOC_NR(VIDIOC_G_EXT_CTRLS), valid_ioctls); diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 03a62fa960b6..aa31678fb91e 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2411,8 +2411,6 @@ static int v4l_s_ctrl(const struct v4l2_ioctl_ops *ops, return v4l2_s_ctrl(vfh, vfh->ctrl_handler, p); if (vfd->ctrl_handler) return v4l2_s_ctrl(NULL, vfd->ctrl_handler, p); - if (ops->vidioc_s_ctrl) - return ops->vidioc_s_ctrl(file, fh, p); if (ops->vidioc_s_ext_ctrls == NULL) return -ENOTTY; diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 4d69128023f8..c6ec87e88dfe 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -195,8 +195,6 @@ struct v4l2_fh; * :ref:`VIDIOC_S_OUTPUT ` ioctl * @vidioc_query_ext_ctrl: pointer to the function that implements * :ref:`VIDIOC_QUERY_EXT_CTRL ` ioctl - * @vidioc_s_ctrl: pointer to the function that implements - * :ref:`VIDIOC_S_CTRL ` ioctl * @vidioc_g_ext_ctrls: pointer to the function that implements * :ref:`VIDIOC_G_EXT_CTRLS ` ioctl * @vidioc_s_ext_ctrls: pointer to the function that implements @@ -459,8 +457,6 @@ struct v4l2_ioctl_ops { /* Control handling */ int (*vidioc_query_ext_ctrl)(struct file *file, void *fh, struct v4l2_query_ext_ctrl *a); - int (*vidioc_s_ctrl)(struct file *file, void *fh, - struct v4l2_control *a); int (*vidioc_g_ext_ctrls)(struct file *file, void *fh, struct v4l2_ext_controls *a); int (*vidioc_s_ext_ctrls)(struct file *file, void *fh, From patchwork Tue Dec 10 09:28:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13901087 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44D2C223300 for ; Tue, 10 Dec 2024 09:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822952; cv=none; b=RHoR5r2+7eiYTnWV8qipihrGz/Ng3nmVrL9EcpVittd4itoPjcPAv8StzDeMdAIqD3oQsNqol3cqy+yEMQCtf4bL83GtZtUfsaPZrRdFVsholuizLG1GUwE1bp8INtpx8zeyEvf/qMlF0AQpJ5WyXnG/MD6VxeIxqjtZuqTDPJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822952; c=relaxed/simple; bh=w7J6GH74FD94qUt1WS+yjzRqg4NaeMgHNEi8UiOgVn0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R1zC9slSQylE0ZXnIE5uYL9dx/ucqsVsVlG3YNMGgIo9c2gnqZh2YsVojA/WD4WSZv5YCpSNeklpmFqBpgMtJ2bCeo6f+zdaEHhfgQuLAI2GhTtRzLpI6lhbuY0wZXp1xASXosgzVx5m0Cf16fozKC5IvzK2sLD5OEuBc4wIuC8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Vg78lIx0; arc=none smtp.client-ip=209.85.160.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Vg78lIx0" Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-46677ef6910so47750281cf.2 for ; Tue, 10 Dec 2024 01:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733822948; x=1734427748; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Y//l0kib7ot3BmgnrtGvxoIcjefJ0s0WEOD2mlbXDKo=; b=Vg78lIx0/RD5K8tXoRwFSDourh3Q6ZGtVxChPDjsTW/MJbzr20L+GUKGYjFlv7J00a pkIDktVd3RYDAD+y4BF2FGJezB/LRE9iHi7ew+GbO/UyIGupNBARcyvk7kjY6z7xiPiK iKGcPBdfM4TtEf0W9UL3+gVx/ZaWrRCrdqi+E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822948; x=1734427748; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y//l0kib7ot3BmgnrtGvxoIcjefJ0s0WEOD2mlbXDKo=; b=p56ewRef0MnTvbTyzplgU3sa9dG8tTX66qowwcC6lb9SQ5lXnYaUSJx3YMfJT1wd9q xme+D16KXUm8RLTHYV4gQMTswLO8d2/WA+VCrGoUzzRoF1AiSTZuh+pTGAjHik7RcULm hdp4VyHd84Xrvtdy0rD7QKKiTBhTyRVHA6pfysR6SvtwJAz2Borj3UO8m9MJjRH6U32s lDqVwh2meWxxAmf1hydPWKcb2iNMxdy/b5Hos2l13UpzKyllDMcNLhRfKphfeS/Vdh5x XE/OmfelXcKRS1K51DfTJmEJZ3TgwVOtfHWJTutemgcCsurCqrIahOSfq+bfdejE84jj c/RA== X-Gm-Message-State: AOJu0YzxDm+bG3i6rTWvO2r8/rrQzdH7vgCsjW2M+dDfEi2c26v9FL/d 6a2kOjV9HV30/i2KyZNzvlCBc5x8ksdry9O9ssxkcRPuCGScLScFhrAxsUzSJA== X-Gm-Gg: ASbGncsbwEBdr+TlLJJ0DJLoX5wBSPql5TGQisf0AZEYByRpkNBaBEdHfGnaRzRSqb2 HQWjmZrEIhMOVJ8kaHyGqFtsP2eN1Ux1/sF8Z+LDUjMZ4ENMVYl0Fkgty5ae+dI564Hdv07aZ4E 5RRXhqu5IurOXSukYfHA7/Uqh61GIaN+/e09rJrxfcQQW5HzvUUnSwsjM6absF327i4kuu3TyAt YAiY58xi9F0OY7ZD67O1gUk35X1kCff4ucwFlsz+QHqsXTGaoENR6OIHbHvZVHp0+J/u1MFf3Q8 Y+LpYWTXYuk+cKOJsUw2qRzC8xAa X-Google-Smtp-Source: AGHT+IFf9kYaWa576VrO6wskX+9beQZ8FmZVkS93oM2U3Ri0fbfJz0ugCHR5677iLTfU/+g8oDAzSg== X-Received: by 2002:a05:622a:110:b0:461:2150:d59c with SMTP id d75a77b69052e-46771eac17fmr59619831cf.9.1733822948169; Tue, 10 Dec 2024 01:29:08 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4675dd86ce4sm24343241cf.30.2024.12.10.01.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 01:29:06 -0800 (PST) From: Ricardo Ribalda Date: Tue, 10 Dec 2024 09:28:55 +0000 Subject: [PATCH v2 11/11] media: v4l2-core: Introduce v4l2_query_ext_ctrl_to_v4l2_queryctrl Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241210-queryctrl-v2-11-c0a33d69f416@chromium.org> References: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> In-Reply-To: <20241210-queryctrl-v2-0-c0a33d69f416@chromium.org> To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans de Goede , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 We use this logic in a couple of places. Refactor into a function. No functional change expected from this patch. Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-ctrls-api.c | 51 +++++++++++++++++++------------- drivers/media/v4l2-core/v4l2-ioctl.c | 28 ++---------------- include/media/v4l2-ctrls.h | 12 ++++++++ 3 files changed, 44 insertions(+), 47 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c index 95a2202879d8..9dd2bc5893dd 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c @@ -1123,39 +1123,48 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr } EXPORT_SYMBOL(v4l2_query_ext_ctrl); -/* Implement VIDIOC_QUERYCTRL */ -int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc) +void v4l2_query_ext_ctrl_to_v4l2_queryctrl(struct v4l2_queryctrl *to, + const struct v4l2_query_ext_ctrl *from) { - struct v4l2_query_ext_ctrl qec = { qc->id }; - int rc; + to->id = from->id; + to->type = from->type; + to->flags = from->flags; + strscpy(to->name, from->name, sizeof(to->name)); - rc = v4l2_query_ext_ctrl(hdl, &qec); - if (rc) - return rc; - - qc->id = qec.id; - qc->type = qec.type; - qc->flags = qec.flags; - strscpy(qc->name, qec.name, sizeof(qc->name)); - switch (qc->type) { + switch (from->type) { case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_BOOLEAN: case V4L2_CTRL_TYPE_MENU: case V4L2_CTRL_TYPE_INTEGER_MENU: case V4L2_CTRL_TYPE_STRING: case V4L2_CTRL_TYPE_BITMASK: - qc->minimum = qec.minimum; - qc->maximum = qec.maximum; - qc->step = qec.step; - qc->default_value = qec.default_value; + to->minimum = from->minimum; + to->maximum = from->maximum; + to->step = from->step; + to->default_value = from->default_value; break; default: - qc->minimum = 0; - qc->maximum = 0; - qc->step = 0; - qc->default_value = 0; + to->minimum = 0; + to->maximum = 0; + to->step = 0; + to->default_value = 0; break; } +} +EXPORT_SYMBOL(v4l2_query_ext_ctrl_to_v4l2_queryctrl); + +/* Implement VIDIOC_QUERYCTRL */ +int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc) +{ + struct v4l2_query_ext_ctrl qec = { qc->id }; + int rc; + + rc = v4l2_query_ext_ctrl(hdl, &qec); + if (rc) + return rc; + + v4l2_query_ext_ctrl_to_v4l2_queryctrl(qc, &qec); + return 0; } EXPORT_SYMBOL(v4l2_queryctrl); diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index aa31678fb91e..ca89880b1359 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2302,32 +2302,8 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops, ret = ops->vidioc_query_ext_ctrl(file, fh, &qec); if (ret) return ret; - - p->id = qec.id; - p->type = qec.type; - p->flags = qec.flags; - strscpy(p->name, qec.name, sizeof(p->name)); - switch (p->type) { - case V4L2_CTRL_TYPE_INTEGER: - case V4L2_CTRL_TYPE_BOOLEAN: - case V4L2_CTRL_TYPE_MENU: - case V4L2_CTRL_TYPE_INTEGER_MENU: - case V4L2_CTRL_TYPE_STRING: - case V4L2_CTRL_TYPE_BITMASK: - p->minimum = qec.minimum; - p->maximum = qec.maximum; - p->step = qec.step; - p->default_value = qec.default_value; - break; - default: - p->minimum = 0; - p->maximum = 0; - p->step = 0; - p->default_value = 0; - break; - } - - return 0; + v4l2_query_ext_ctrl_to_v4l2_queryctrl(p, &qec); + return ret; } static int v4l_query_ext_ctrl(const struct v4l2_ioctl_ops *ops, diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 59679a42b3e7..83b84cb5cf06 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -1404,6 +1404,18 @@ v4l2_ctrl_request_hdl_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id); */ int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); +/** + * v4l2_query_ext_ctrl_to_v4l2_queryctrl - Convert a qec to qe. + * + * @to: The v4l2_queryctrl to write to. + * @from: The v4l2_query_ext_ctrl to read from. + * + * This function is a helper to convert a v4l2_query_ext_ctrl into a + * v4l2_queryctrl. + */ +void v4l2_query_ext_ctrl_to_v4l2_queryctrl(struct v4l2_queryctrl *to, + const struct v4l2_query_ext_ctrl *from); + /** * v4l2_query_ext_ctrl - Helper function to implement * :ref:`VIDIOC_QUERY_EXT_CTRL ` ioctl