From nobody Fri Dec 27 15:03:44 2024 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (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 7B9402500A9 for ; Tue, 10 Dec 2024 09:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822933; cv=none; b=ojgZRNKawyBkcOMVE638AEnQ1SNQ0K3pVL0q/E0p3yn+FOsLc6TwFRqEhSshqHax8Tt/fGXtFOWo7wpAPVo6p9zvJGVjK8RFnNQI1bWWDIjtTVaaGnZwSThCMVBR+JkWKVbTf8lu10N89f1x8F3d5U7mNOya+JAtqfweEBllUz0= 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.174 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-f174.google.com with SMTP id d75a77b69052e-46769b34cbfso23528501cf.0 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=lfrfCTm9OCRuJXzonb1D/LXqPkvJDmwC1AZVvALTqp/PRECdiNWV1SLZUeaBLxMRmr T4DmSdw3lEBBl2KiGgSJeu2KLlLI2+hcOu0JM0E85RG9fW6c4WUtdkFHMbmgKdvDQukn zMdnWhLMFJFm2sQiuHng23QWaiIZxFW8Uh2DB+4BwaY8VWXK7q6GFdS+Zl8EFX6Paafc uJw54C1zjmJk/rBiVSdxlXbyQ6aiBbi2Ptov0t8v4MBHrQ8CZ9MZtu+8Usl1C7zF2gHe fLQcMSrJ2xk7TElXsXQNhxDKW0UPqja22Xi/btNfex8wDnLsUhl5OqxQWdjF13WCCp81 Tuxg== X-Forwarded-Encrypted: i=1; AJvYcCWrrOtm7gG65X2rikkr7dbKBO/lFlTw2iVfWRUew7sYc7Ima16W3CW5ayrNawmJi1i2I7zg6NPfYeL2YMM=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg+qBTQsNHd9BbmukYfvbJ04mh6Gp5wh3XqBPUDnT55cfdcJuU wWRfwUU7VGg9/l9GV2JiUK1RGnbaw1UOvi8RH6fIMG6ryolbLhfzz2JWQ31UiA== X-Gm-Gg: ASbGncu4XgpBwsKncJk5C4ZqD2EKr9pIMNvps7/m4iU886WPXPZIV0sSjVQd2BsuxhN vd5slacsu8wl9GijXgASwTKp7S4tanv/IS+LUdaV/ztWvbl9/qCvvjFWzX+w4j8yoOFp/GGpAew KFj3vJgUozVdateUkYQ/uz4iqtKryA9AtF6Z0PlM0xLHnj2EN2zgMOGwe+K8LbT52abXTS3oz2k e9nzFqhCYLGZTFha3jV2ZediXfUItbGkQC88diN2OYHAJHinJsJQIuLEGZdnf6MNLwyJdHoLSKt lZJXUmTLxqJcPlPFSpQRs1/n6L24 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/v= 4l2-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 =3D video_devdata(file); + struct v4l2_query_ext_ctrl qec; struct v4l2_queryctrl *p =3D arg; struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + int ret; =20 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 =3D p->id; + ret =3D ops->vidioc_query_ext_ctrl(file, fh, &qec); + if (ret) + return ret; + + p->id =3D qec.id; + p->type =3D qec.type; + p->flags =3D 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 =3D qec.minimum; + p->maximum =3D qec.maximum; + p->step =3D qec.step; + p->default_value =3D qec.default_value; + break; + default: + p->minimum =3D 0; + p->maximum =3D 0; + p->step =3D 0; + p->default_value =3D 0; + break; + } + + return 0; } =20 static int v4l_query_ext_ctrl(const struct v4l2_ioctl_ops *ops, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 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 5FAE03DABF7 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-4674a649083so22371521cf.0 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=LzKL8U8u6AQP8D7gyKEpDdrZKdsKSWwJybZuo0v3fP8rLIa0pPW78RJnRhDkCjcQf7 9Vxn2Nv0jRk6ow6wuZy5Kp6lfYIyF2FSt7kcKU9qD2qUG3s5rfy/B+FcPn2IbFQnTZcg YkvnnISfte4iqhfu3ZkIVnSD4VhwcDEbKVnSa7YMBQiFzvT/TW1sE9JEP3EhE+rGCeAs QjkDV/2ShvEmN63zq+cOoBbrUkr3s2wtoEAfvZVVll744hlKDrob1fJzDnGTTmlyLQKX QNN7Xz6hHav6/20+Zy+mJOGubc/U7SBo21TDMG4XLgJvpr+uMAbf/ViO2TuiWIBaPcAI Go9Q== X-Forwarded-Encrypted: i=1; AJvYcCXF/+Yjoc82RQSQwcljNWXhHlqhJ3CbSRHTu5orA3VNC9nNweAIVnuqReYdUMoa/i3OpqGm7JkHE9ZKkXE=@vger.kernel.org X-Gm-Message-State: AOJu0YzOmXfO0NUcvLPAgNscqi+z0F3Xo3lWHqdpwdloEfB6E9n6fAyw /3YyMWl0XbbeGNsbPvvQI1V0plzkSjyIzdQW1Jn/cgruMUXvbmV2o3NLKBnFMg== X-Gm-Gg: ASbGncsjPzKHT7pB6sghVCWLFiO5TPUN6rUdPXFsEnbXZdYrrDu7X86GFfkxfMsB6MI Za5b8PymnZGSfIMmL1F3MRDk7v+xtWBLco1FZylvW4ckozBgwWxpf6bhrN+r9ktb9ETEQ6vGlvr Uz6Bu8HENlAdiKOCFM04wfQn0nXEv+oHSWRfPqxD3+NROOwiknphPYCAUW0XtjD5zSybkCYszpk eNB7uVnCc1dW7p813bbkRI0fwGC4PhMN0zmOZlMCLdk4eufbnp22GzwtALxurSjgrBc5/QE0e28 rjRWimuxM6Izig7spo4pP8NzRTLp 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/p= vrusb2/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); } =20 -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 =3D file->private_data; struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; @@ -521,13 +521,16 @@ static int pvr2_queryctrl(struct file *file, void *pr= iv, } =20 pvr2_trace(PVR2_TRACE_V4LIOCTL, - "QUERYCTRL id=3D0x%x mapping name=3D%s (%s)", + "QUERYEXTCTRL id=3D0x%x mapping name=3D%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 =3D pvr2_ctrl_get_v4lflags(cptr); pvr2_ctrl_get_def(cptr, &val); vc->default_value =3D val; + vc->nr_of_dims =3D 0; + vc->elems =3D 1; + vc->elem_size =3D 4; switch (pvr2_ctrl_get_type(cptr)) { case pvr2_ctl_enum: vc->type =3D 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=3D0x%x name=3D%s not mappable", + "QUERYEXTCTRL id=3D0x%x name=3D%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 =3D { .vidioc_try_fmt_vid_cap =3D pvr2_try_fmt_vid_cap, .vidioc_streamon =3D pvr2_streamon, .vidioc_streamoff =3D pvr2_streamoff, - .vidioc_queryctrl =3D pvr2_queryctrl, + .vidioc_query_ext_ctrl =3D pvr2_query_ext_ctrl, .vidioc_querymenu =3D pvr2_querymenu, .vidioc_g_ctrl =3D pvr2_g_ctrl, .vidioc_s_ctrl =3D pvr2_s_ctrl, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 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 1F85F3DAC1E for ; Tue, 10 Dec 2024 09:28:55 +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=1733822936; cv=none; b=RoIaSG2GnFmQtIY0fpTwEy1Ewk93F2KzdwkwwttMXYGa4AbKXSaS3bUTI/zWkVstuhpbc6iw5KuLXR6VNZdtG1KkvjLsWuH0s+UdSvOckKKJ8a3uvVMeFJqBtnv5leJkrf2m3ICu4u7Y4pbgsMTVEc2uitFcCUyoRbJ/trLJ7cU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822936; c=relaxed/simple; bh=QTPQ1DyM59FTFwoOCCInfTij+St4lWshfJMO2MNF9Jk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IWEis0O7JgPLJh18j8VYteeHjTZOAmRbx4sAfCgvV+fLMkyiDpdQwOJWQjG463CuczwukM8iWc2ti4mLlSDOQm6Cf+FHbdSNSmZwf46N49IcBhVwOdWhutnRAWWAueb+jsGd2g7FtZ8AWcBvG4MThd7knpppBA+W2uES2MQNkoE= 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.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="oFjv7dbs" Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-467777d7c83so4322711cf.3 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=UlbgKRnEOYUssVo40VhRnrkZKWrstV+Fuxlo6FtObc5CvummEbV/7Z1aIFmiwBfPCx dbRkfhD+1Hg1iUfC/mi7EDx4ETYV0uUxepAy5nVq4CcgBlhuzg5c95t1v/sEO0jIphHJ o/At6gcA51iGBO+g/zIkURbO4F64TmHlWK7g3kjFQ37UbUTANFXWs2XYz/MfNcRMrEgZ HkqjhC+/NLlX/LKJPa6nVGxj++FgIjEW9mPixqGyWKChWZqj3Y4L7gsUn2iRvsv90iir ZA5iptdipH0kPF1/Af3xSbtbQ8cRLAjC+t2WB0iE+rlQe5Wy9aeYJKoob0jhN2Ysjgka 5BsQ== X-Forwarded-Encrypted: i=1; AJvYcCVxl7y/1GnO44zQCt3Cf7unUauQOT/1MYhOE12+ncxj70uPY2lu8qQXOAyydT3aLtjgEEBYIC1GyL9Ho3M=@vger.kernel.org X-Gm-Message-State: AOJu0YzYoC+7OBOupPH7xCIoiPx7QcP2679/MnKAz3rqJUoGwxHLY0cb yuPq5NrUywKD0DkrUKoHhAEkt1z6kaGBdKvuuJXv1fltoR+ZNglF2QP3aGpcBA== X-Gm-Gg: ASbGncvJ3D1xcSLbVrJEGNTfwzRRueVJF8c+8TCoYe+jYwtaE0HTWhqxp+wsm3TCdt3 /bJmsDAz+7dfDKHfnzveBge7m6gL5Y16gmJuxesWQX6jgxSgH9AL7Y56+z/hhIExltBJqcqZbw0 CPl70Ltm1fzN2+TpR8sJyjPYK0632QXyVdSUGBJkMPteA4R1fo3ZSgnQHyxyJSbUSCMae75vH9n C+/U3cp+TFSzeZmrfFT10ExtTPFODPBcVopHTD3qO+V5Hw2xx7tYEHcSdskfIvv5XdxViIhAQAq ahjUBFqC3BVjqfMcA0wkPG50sM5T 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/p= vrusb2/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 *pri= v, struct v4l2_querymenu * return ret; } =20 -static int pvr2_g_ctrl(struct file *file, void *priv, struct v4l2_control = *vc) -{ - struct pvr2_v4l2_fh *fh =3D file->private_data; - struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; - int val =3D 0; - int ret; - - ret =3D pvr2_ctrl_get_value(pvr2_hdw_get_ctrl_v4l(hdw, vc->id), - &val); - vc->value =3D val; - return ret; -} - -static int pvr2_s_ctrl(struct file *file, void *priv, struct v4l2_control = *vc) -{ - struct pvr2_v4l2_fh *fh =3D file->private_data; - struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; - int ret; - - ret =3D 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 =3D { .vidioc_streamoff =3D pvr2_streamoff, .vidioc_query_ext_ctrl =3D pvr2_query_ext_ctrl, .vidioc_querymenu =3D pvr2_querymenu, - .vidioc_g_ctrl =3D pvr2_g_ctrl, - .vidioc_s_ctrl =3D pvr2_s_ctrl, .vidioc_g_ext_ctrls =3D pvr2_g_ext_ctrls, .vidioc_s_ext_ctrls =3D pvr2_s_ext_ctrls, .vidioc_try_ext_ctrls =3D pvr2_try_ext_ctrls, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 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 8B01E78F58 for ; Tue, 10 Dec 2024 09:28:56 +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=1733822938; cv=none; b=FWoUQNum277KZeV4cAW9DrtvqIJZDYbYSRzqnefZ3Vd+M0dprO689VfUqePQq8xpdyQ6SyWDP/udI4w7pnZpb4iwu+qeYbaq3lB+CSlahZPfn8lr8tcgNSjd0JIvVNMXKlKKMvmypkuOLoEiSs8OpodvFVEVOI5Ft2OClApZlWk= 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.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="FdEGy4tl" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-4675ae3dcf9so19540611cf.1 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=ueHiZ76H+bf7smnKsf4mb0Jb9UR/netCKN8slaJaedvgjcCBvdoQWV5R7vJG6uBvV/ w2FRxPCQ5C1l9Baf9CnyUAZCefY0uOmsh13AtrMYGNvVTHPY0GU52SCXmdavN1F1t6oY l2e+kSIDQCmehq+NkKgquhC8DVzKcY7Ze9so5GbOS2k2HouUKnfz7VVQE1v/Z3DvfNyL adMuMSzDqHg7UR5EQMtdzwoQ1gPHqQJi5e+bn7DkK5F4fhGdKNLcB8JT72Y3zQ8enYZx 5HFqurvG++7QQVDAjr/aZGB5A65Nl0K85DP4a3D9txrNA08un2H32XZbJyZMAvt1B6zF oT6Q== X-Forwarded-Encrypted: i=1; AJvYcCWJUlvkhPADyvazWCnpdNUlIMdpGIzh0npn0DXq6fLxm7r30Y5Oyu5JD0KiHc31UyoKxSOuaMOpKwpT4/o=@vger.kernel.org X-Gm-Message-State: AOJu0YxtuUMH53gAffzfhKr8pMVXqyU8nvPkVS5C/8INieKbI1OhCV09 zqcAVpJj1UmSN9FID3FejmzDmUGlk5On4butG8Hila1kVpk7Aq6C6sgn2taD6Q== X-Gm-Gg: ASbGncvHHHrnEAtDP+vTLZf4q/1JdSLiMQlOM2EqKocTtRrhD95/ZBSist56rf+Z+Tn wFgt90Y0CHm3BMtTyK6IyA07h/l6ZbZUlmiJlnK1TF1eonWE9wscyNTZHs6bgkb/FjtJn1ClPTz K/IikFDHqKAOAs1++JO8AAhI9W0PUdGuu3VCZGLWKWHznB/bc+53uyAabyIlbQqu7U3Ov12cJh0 jgMWew5h6lmvuJLMBnVwXJr4u8CsMx8zMrZN4CTRGlk31JUvMm4uZL/NUwG3PII/Ho+Y2fhxjZM ZET6YKIJdsyuamT+PbSqChCk4hAv 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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_v= 4l2.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; } =20 -static int uvc_ioctl_queryctrl(struct file *file, void *fh, - struct v4l2_queryctrl *qc) -{ - struct uvc_fh *handle =3D fh; - struct uvc_video_chain *chain =3D 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 =3D { .vidioc_enum_input =3D uvc_ioctl_enum_input, .vidioc_g_input =3D uvc_ioctl_g_input, .vidioc_s_input =3D uvc_ioctl_s_input, - .vidioc_queryctrl =3D uvc_ioctl_queryctrl, .vidioc_query_ext_ctrl =3D uvc_ioctl_query_ext_ctrl, .vidioc_g_ext_ctrls =3D uvc_ioctl_g_ext_ctrls, .vidioc_s_ext_ctrls =3D uvc_ioctl_s_ext_ctrls, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 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 AAFC81DC998 for ; Tue, 10 Dec 2024 09:28:58 +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=1733822940; cv=none; b=WQbkZWusQtBon9lUXHGORUQ2sOFiRTFlg36W18l2nKAGCFHao6YA4SSqR00jCrkww4SsQljleDeJVzlipn+fFnZ7vV+620ohfylboCU50xXg0shDh1NEIb7WqBiawwGfgt9RzEvN6onpIYBl172xtszNJo1oaxxRXLQtgXkIF7s= 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.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="Yx1G88Bl" Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-467540980c9so31312011cf.2 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=wsjyTUy9f2zKKUEUtLnWAWZGB2IGoY8aiBAZ/p6SP48Yofgrz2FoR6zeY5Z49UOACC eTtcXJ4QkoPyCrpx6WLN365WF6xQO686G+xODVZ5zfq/aqU1TFAk/n6kT2dp4hUlJVWW ESp7dmp1yPtuPoR/aq35bm4prKlpY23N2J5Stz4zSWvbOmql2aCia4gqsWSV4TV9wB2j hJx6CY79/vRVlB1Lp5RUSnWQsKMwBmzEyh+du6w6FCvSrtxo9aP8h/hXdWH+MO50w6Rd /a11XTQvysg415KpBeNOzA5aJLD8QGt3hxjNaA/dmAj90Sf/xtrBnQ5AAinnhAQdcAJn ndKQ== X-Forwarded-Encrypted: i=1; AJvYcCWpwjL0nBaIDcTAofSE7COY54Gi8Pl0zQ0ZoSN51/tiJSP8cHxKnlBkxA6Y7YYwIGlGgI/p6t18/55lYqc=@vger.kernel.org X-Gm-Message-State: AOJu0YwTrquOeNa5T0k5Z/x/BiPZH6LodLoABXJBgsu0AeOXXjHMHCQG aUQ2Pz4tOZI2K3cEST4lxm0wRnXPKC/ktUIgyJH/ecToVQ8GpVIP2ZYBdc8sQw== X-Gm-Gg: ASbGncv3d0SaSQgB0lKTfqCDeNjud9rvOt0sycYO1yIG9c+h/vxZ/oBK6ST8fH0ekv6 9vbtTOSistoJsCiQ3MbqlwU8AQOSTMBwThJRTtUjpeEyxgF4dfv4FkwlH4HVZ/BzZ5ZPVaWablT gxv3+66bYKXOzCxgi8Fty+qRNP0pKm1p4kxbVrD6ex6c1x0sP/L3bO8CGdaEEzd5z/bEMwO0BNN 7celLdXW4u/2cT272J4Un/PTz/vNYcLOkktJcS0xM4vLbAgcuPqkER26EcwkgzmamZGgt3/I1ai 4/oTfI6Zky1Gpqwc3CaPqa9IOeo5 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/st= aging/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 =3D "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[] =3D { +static struct v4l2_query_ext_ctrl ci_v4l2_controls[] =3D { { .id =3D V4L2_CID_AUTO_WHITE_BALANCE, .type =3D V4L2_CTRL_TYPE_BOOLEAN, @@ -1140,31 +1140,34 @@ static int atomisp_s_ctrl(struct file *file, void *= fh, =20 /* * 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 =3D -EINVAL; + int i; =20 + /* TODO: implement V4L2_CTRL_FLAG_NEXT_CTRL */ if (qc->id & V4L2_CTRL_FLAG_NEXT_CTRL) - return ret; + return -EINVAL; =20 for (i =3D 0; i < ctrls_num; i++) { if (ci_v4l2_controls[i].id =3D=3D qc->id) { - memcpy(qc, &ci_v4l2_controls[i], - sizeof(struct v4l2_queryctrl)); - qc->reserved[0] =3D 0; - ret =3D 0; - break; + *qc =3D ci_v4l2_controls[i]; + qc->elems =3D 1; + qc->elem_size =3D 4; + return 0; } } - if (ret !=3D 0) - qc->flags =3D V4L2_CTRL_FLAG_DISABLED; =20 - 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 =3D V4L2_CTRL_FLAG_DISABLED; + return -EINVAL; } =20 static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh, @@ -1561,7 +1564,7 @@ const struct v4l2_ioctl_ops atomisp_ioctl_ops =3D { .vidioc_enum_input =3D atomisp_enum_input, .vidioc_g_input =3D atomisp_g_input, .vidioc_s_input =3D atomisp_s_input, - .vidioc_queryctrl =3D atomisp_queryctl, + .vidioc_query_ext_ctrl =3D atomisp_query_ext_ctrl, .vidioc_s_ctrl =3D atomisp_s_ctrl, .vidioc_g_ctrl =3D atomisp_g_ctrl, .vidioc_s_ext_ctrls =3D atomisp_s_ext_ctrls, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.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 359E71DC9B4 for ; Tue, 10 Dec 2024 09:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822942; cv=none; b=ClUkHxzP+TZGRHrD/gm9HiwS3847jbN7BujTLY4Wb8Xz0xEtbKmR0k5KYeMuLftioFxQVXVTjLKJCWHcZ95FIwG0DLzfuma8LZoGK4feK0Df/L9rEj6btcFjMTNSbTMcnuDGkkYD+L8Kyf2wj+rKdT0gcJS9LgNpRSMk/NWbzWY= 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.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="HEFYh1Gz" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-7b6da2d7884so110512685a.1 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=Q9/i+EtCpumuCyuGpeQTyiLKE+Hzbq9VqB8wcwBrY69h/sOUGX8gJew9v1ZCp7/+sA HlVOpgE+lT8hk2IZpWdNfUthdrEKn4rIB6mfop9MM/E/zCK823FjEqGq28YwBUPz3Ik7 EHOWLEy1XIGmIjjuoE4H7A5ol0GTLJI3Ctvawo+HEcQs6ogRduA+4lDwJzhK3OurkoIc kXqH8N2aN26K/1PyPcdM1DrBnB75SgR/eQZPAhDDxZy/UspCdPFEamGVDyaf6+TRnVmd 5C5G04Yk89c6AqYpaAo9ATSuq/r/hol+aJjVKxU5sc0QmBuWdZPPmcdOvak6zwBchj+b cSXw== X-Forwarded-Encrypted: i=1; AJvYcCVbcOBZUdkw25YOy4tMtJd7PiuCyE4cqPrHVXgfclchCBfKOMsVk0Crk7kbxQA2SGp9QQMQIY2/mINL7xw=@vger.kernel.org X-Gm-Message-State: AOJu0YwVnxbILRzrq/pWCOmCpu6YxXpdT0yJjK/g6E5lVYAjFNI1rQgR p/fQfhCAX7by254pvgY4UjqTlLhiuke8r4L2rlMG2T9g9+StPe7xmMa+raiSSw== X-Gm-Gg: ASbGnctEvBkmm/mCXH7YQXXeQXahR+o15UY910u7YOx3kDKXhkKBe+1Wt3XVXxi+J94 sN4Cq+IWChkLW5tmvg8WwXvDfKpkaXToSSfEZfm9E36tTboN/07huGvF9NdQhiNSTPKZf7XL60P 46UtDcWMzOvkjIInsnbafCGWT4cfpphFbIjeOez9TpMuG16QKflXjCGjpuLPqvoqNE9nPtSiS4x /m6l8XgnrVHODuH6rRqLJrc+eiyHD8jvTocPcnakI5TJSJhgc4VXpEOa97cmKJ+VNx+WP9XgNDQ XZinIE02WvVg93kidXFra2HtsIu+ 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/st= aging/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 =3D { .vidioc_g_input =3D atomisp_g_input, .vidioc_s_input =3D atomisp_s_input, .vidioc_query_ext_ctrl =3D atomisp_query_ext_ctrl, - .vidioc_s_ctrl =3D atomisp_s_ctrl, - .vidioc_g_ctrl =3D atomisp_g_ctrl, .vidioc_s_ext_ctrls =3D atomisp_s_ext_ctrls, .vidioc_g_ext_ctrls =3D atomisp_g_ext_ctrls, .vidioc_enum_framesizes =3D atomisp_enum_framesizes, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 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 1D41C2080C0 for ; Tue, 10 Dec 2024 09:29:00 +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=1733822943; cv=none; b=sI3xcr0XS2P6g9Zojdm3qCLW6weAv4J9LqIlS8pH1GGNihn8JYQcVhYhqzetcUs0kUrAJpCWB6daQHT1IVbJi+ju3wZkc5XRCPhojm9ojt+fadLtktpB+Y7lIxgAdipym8BwaMNFIX2Q1B60m8bSDV83wqf9acAwGfdzLZM91Zs= 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.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="Y+6h7vWe" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-46772a0f85bso9245891cf.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=PQy0DveK4qMd619YEf+2L5TGXGf5Rx053OVpzAFAltQ4uWKpqsLSMz12skmRDIBoJy 6Jql3GVkP1yIDklBcx7mnb3RLU7Gn+Cz3g11XkaTyz9eO2IE/AfI6cpCxoLV3IrfVxpu 7D8hgj7zQdcAyx6/8jHdnzW4PkC4DkZo5329sL7bK5Qpv2HMbaSul2RccYRnw3nHwEVX AiAGF1t73CHR5XHNpM2eRnzZcL8I3RkjibuPW1NgGEn5odQ0vPTwbavpCDcWN+84KKLF oRguDQiZXhBXiRav2dxozmHp2dLpgrJ5AJoi6IDbJ+G1Zd8hDsCTT4DKmeb6ltnjrsH+ PMBw== X-Forwarded-Encrypted: i=1; AJvYcCW+hStvIboH7+ZYudSJ+GAUIF+nFdAt6ZsEanVm3BOIXlf4qLmopZOw5O9oXNLMLA2BMqs70i8q6er2tfA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx01UrwoMRonoRrUYZMentei1muhcboR8vEHlr2iUHd4KiGgiN9 v1/+hFe2516h0t71a01GEj5ShElyCRt5v4TQrWrrmXcZ3wvQdN3O/ewE8EY8Lg== X-Gm-Gg: ASbGncvmR7bCAW77IKkTxXlsIFpPaG2MjssC05dxAT8gK8J457DyreC+60rhgSGFvnH p/nDdqCO1z7Ot1fzlrvKmb5468k5qt5URVVyg7efulWvMEjQQiHk6p0B6zWknj+B9kglch/h1vs QnwToz6xY/4rakqnUiQUIjsSDwMDr/gGzBNnC+nIfPdnyrtWqMITv6aY9hNZnBqzsykkBQ0tXcm Kuwf7GzMFObrFlsi4n/ELOLAo7Y+cK24x70QDWtkfa5dzAU1kMYOBfuGEBMMuaZr9Vy7zFkzZ1J JpDJSOZEfeDpwO6Vn/qe3xJgnyBr 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/v= 4l2-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; =20 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); =20 /* 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, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (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 31B0C2080FB for ; Tue, 10 Dec 2024 09:29:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822944; cv=none; b=XtS1miRhXnJj3FAytdQjoeACdzGmMbSEXECwes/4gdcPfVZXuGafwZjAFTRbv2OYjEQFYorsS68ar/hFefpFtjK0DeCZ4od3yugdfBUH/TYnuDdjcQd6umrqNZ4cxC342IRhGXNC4PNrC+hC+/QSymjmRiAjhWBlNMaHJJW1+Y0= 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.172 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-f172.google.com with SMTP id d75a77b69052e-4677230a9ccso12372051cf.1 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=wt4gnq7xzJ8Ws7bjwBRN/+n4HHHvnFTQqpux7qla0KAII6qczojmfAdaPHDrQLAhlf iFjyaliqodRDPEfRTcZzbxjh2nGgBDYj5lNfDxJAtknTpHVDmusH8XGyY1zvdbEYmjtG 3lqt+5VcXTSQHYzb2yuuJSvQaxIYjUhJIZYhuHXxPUvqoxZTl1p12x+IUIStaqJZBJpM DNDn7kRPcg1B8NLr98Xe0ZROlhtAvOyxuqCjdO30I9S3nV6vMn+iVlOk8guU/RWfqay3 kPSp1jPcakgDD+1DJlYRCMER33YAiLWkS4aIUNOzKOh/hxxiM2OpChf3zi5xoM+MOF5g B18Q== X-Forwarded-Encrypted: i=1; AJvYcCXUuwvkDnGRQJLW5KcVLI7d4YxB+BdCFuv37h3XCGTvWUBQ0PzvFI2qTW23Aj1q7oWfzWtU2BMG34nIxQE=@vger.kernel.org X-Gm-Message-State: AOJu0YyfZdCzNqeU7BUjA70t9Sow1aYgzXT4wdbzuVHjX/h6jwaEorok BmBrBrGLhRDis+gKcAi5mDlGmOOAOu7IH/ZVSiYzuQvM8CjHmO+UqH0Dt7YMnQ== X-Gm-Gg: ASbGncvshIvEhj1SZukyfgjNIQFGl/jfkdba1Z/H00LBx88yHy2dJ9O7KZfVGl6prnu 5k8tGHqc5z+qVC1kLEYF4QDsNbICblxdptRgTrR96Ga3K6GqcGzZXK/8H/Rm/bNYW9jCkRors15 GQU0FCOkBfixTPsVHWyyNik+OtPGOGuuiv4FyIjuUG+lKYqb4nXK1ZkyeZMH77amNOObmeVtPV5 uUchwzqngrdCvyOcaCbDOOMBUbiuvABw+7z/T5RXXR/RajZyhLgY0LjU8zKzEfKsIu9BsW23Dmf 7qr70VifoEQaqdeITsC5637tsxYu 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/v= 4l2-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 *op= s, 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 =3D=3D NULL) return -ENOTTY; =20 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, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (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 C3A63210F56 for ; Tue, 10 Dec 2024 09:29:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822946; cv=none; b=lOpTNnjJiWC+i9A82aHlkGZi1wASjhpnstbtwPpX6k7uyxx8mDaaapzNQtefhr0WbN/bBJJiGxTeQBuDcuzgLl2FrsXmscZtmamzmjG61Pb4lz+Wgq4Hh4Zx8h1AiQ+C5WyXKcrj/D3/Xgo3r9W9L9gC1t+3Eq3sJGckv1Vgpz0= 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.174 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-f174.google.com with SMTP id d75a77b69052e-46772a0f85bso9246481cf.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=rZMqwZ1NpxLxIwE4PHPyE6p+V/p8qOlmPruDT3xjU+WDkJPc+bwPUqqbHpbp1X6usx fp+7dgSoyIgaZECjrxRzWlY2TLE5LLSg1VmbnvsTSJEPRHuISlFa8+Gpk/18XKDY66YV zDXwTIpkFsSSkzvCi7jDZWH7HPWskNoya8m8zmisuc3YEBXpTvV8Gnrw7I7lcte1LZuF L9mQc1kC6/u1ZO1G96neORIQ8hn9v4mKLGTcfwtW/k6S9W2NZIEsC7wEWhfLjFvt3Awb KBKbBqODENWhY3GCdEvO31M9AERHUkrRvJVnu67M/UlWz0zCgV1oe3cLRwF2BDdtLN9O UL+Q== X-Forwarded-Encrypted: i=1; AJvYcCXMLO0rHriIiJpi8/Pl7qRRj8Q4P8ls9xmO7pKbn8EAUSoirEpDeo0TCZDEOebabydCTSypi5a6mewICWQ=@vger.kernel.org X-Gm-Message-State: AOJu0YydL7/bMXPa5ybuF3d0tLx1hjcFJLInRUAvKSjqc8ZUPmvu3sf0 TIwcifBoa4r/7ueU/j6Z49EXpSHmwqJoPfTAqnH7pi01i6HUAxVQZYFRt7VrmQ== X-Gm-Gg: ASbGncsRZCocPQLkiuDMvN2MhPXqjyDlaMHfacfvHLVHi5mJx+oMDTY3dh7RwTlSg5f feJhMuiY5LIfKqMgBb0A5Z7kInjc1HfQ/1OxTjDP9gG+ZPkiVF7mKkXmuxF7PG+CxSRcvHuJqn8 3SxmAZ8aaJ2IKHgLOlsfr17JLDAoQaTjgX/hdJY32p6r62BuOkUSL3WPMgxHNYLlFX3VMXqUs4q 144uek/dDHqfPtwv8XcGztAovwcUEfNnTwIpLulwfw3NWWJq4B24BLVDw4xR5lDcnOPAPInKK/T mOkkt+plfk3f+jOjtyf3kze+hjlv 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/cx= 231xx/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 *pr= iv, v4l2_std_id id) return 0; } =20 -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 =3D video_drvdata(file); + struct v4l2_control ctl; struct v4l2_subdev *sd; + unsigned int i; =20 - 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 =3D 0; i < ctls->count; i++) { + ctl.id =3D ctls->controls[i].id; + ctl.value =3D 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 =3D ctl.value; + } + dprintk(3, "exit vidioc_s_ext_ctrl()\n"); return 0; } =20 @@ -1627,7 +1634,7 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops =3D= { .vidioc_enum_input =3D cx231xx_enum_input, .vidioc_g_input =3D cx231xx_g_input, .vidioc_s_input =3D cx231xx_s_input, - .vidioc_s_ctrl =3D vidioc_s_ctrl, + .vidioc_s_ext_ctrls =3D cx231xx_s_ext_ctrls, .vidioc_g_pixelaspect =3D vidioc_g_pixelaspect, .vidioc_g_selection =3D vidioc_g_selection, .vidioc_querycap =3D cx231xx_querycap, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.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 29C5921576B for ; Tue, 10 Dec 2024 09:29:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822949; cv=none; b=af9xninE1fUyQO2Wrh+1XSa55FhppXzaeQaoGpCTIgyoAm/euwq5FUZmq3p1Yys3kBEIuqSmQgKuZXaIckYD9p5UWpeHjEEBSwo38/7dyFJ/xcNrDsXMj5JgOrHHe8i552r1m2ZM4Zr4M82pJ+vEDCyrH4Q8HEleZ25La+GSe/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822949; c=relaxed/simple; bh=oBcqkfXM7E90s1taQvAsnIcQGP+0/edriRflHVpoMcM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LdCzbz2qeFPZiXVnfpBkZ7h7JtSC2nBjqbpAoBoWJX9moUtC6YcjO+UOnEWQvMEz81o/wKQ+syoqrZs4gL/w1e3ET4DwzuQzDtM7VMaep5PIHyeqNtI9eg1NFo5Pi+/LbyIzndoUyjVMITM+rS43bUDjH1D8D6h+jwBi/wDywXE= 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.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="h+q564Bb" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7b6e8814842so5540785a.0 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=hOUti8vFOEnl661SEG3kuoIp3yvQibF+nOzpobXDtBHKHCB/1Bw61N5mq0ghNPFUTZ aoal3nZZiZHWxococTPIx6Y8HGPuJDnDVsfu4RMVUpXKH+SXTIccCZXlXyV0W5fcu4Is G+Q3GkvrpPbd3w62qtwWlqVnNGbnC/UuMLi+sNPiTVorX3w+f6a0kXtFCnouil0dgYU4 0/aIrK2dLVJKhiq9MwzUzCHcYOlRJEWjuXBIRYKmek+PByKcBOhy4M0xKUALWuks+tzM 9/Jf6fNIHPfhUVN6bW8sQYWpFN4cghLBG+dP9m9ZVaCswmTtkVQsD6IH48FjbMqt2sBF a2Vw== X-Forwarded-Encrypted: i=1; AJvYcCVdm3iV8NdMIj2PrgnhE2bDZ1ASEqQ2ACbjFC9969LjpyzZ5woZSx+GU+NxWPSZd7hUwN4idBEAGHRsZ8I=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9hwhAwyoz9ydlhf8/A9UjGWSxNVHIqMzmAm94Glb2bafsQGeQ n34Im/rNlTphIjX94qrvHog2F+c33CVRbqY0Voj0PNxAcjAvunsFmq85ryedUA== X-Gm-Gg: ASbGnct3mC75CIQ/SeSrZqhwDFCWWZ6AamFSxY7m9NJCG2/p6oi5vFrtmH1gGOLz0wq ArlyCWu5WdSrB/oeo3myve5qgez1NaRC39/baipeTnMgZhpAE93o8AnAcURLZU705xlPa/6WCCj e+N9yOykCHUjzz2bXttsXwVO8kdWsahfKIKJJviOiKXzx7MiwC8QopAHz+g4eAkCpVvaf7UmJIJ bp9vmduPdUJGn2W2ZvFUz3J1Uk2w+FVN2X0LKI/FnTaqP3LND9P6I3YRVet2FhDxJEuLB7C2fx+ oz1RZHFMqnCw+LxkbL3+qAn+/Kdv 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/v= 4l2-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 *op= s, 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 =3D=3D NULL) return -ENOTTY; =20 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, --=20 2.47.0.338.g60cca15819-goog From nobody Fri Dec 27 15:03:44 2024 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (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 44CA8234977 for ; Tue, 10 Dec 2024 09:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822951; cv=none; b=pB2z6HfB1RL/whU6xgkIZBkWZhwPiAimpA/lvC7y59EIzpqar4SEOHkmN9hJRyIz5iu7xMj/BBkV4dKcrL3pYOYpehusXc3jbwwVLNn7Hy5TJH+f91V72yBKzWQdolGuug0uMY7gVybmlgPeHyBz/mZGuU+AHcMYg18y4hHhgpU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733822951; c=relaxed/simple; bh=w7J6GH74FD94qUt1WS+yjzRqg4NaeMgHNEi8UiOgVn0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FQ9oHPDYof/yqxH+b2MYubKuOBk99V41dxmSsDeTCrb7Dn8d2q+eCKZR9g/uN4OLHnH716d0lS0GM+ZZpA+APM2/82jz5a1B2PrGwKXQlLE/IK8yTRM0kw7xLm4XB2bPo0muh9tHRvuUpNp8mI+CRuSUTxeiucY7oXvnH0AjRfs= 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.171 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-f171.google.com with SMTP id d75a77b69052e-46677ef6910so47750291cf.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=k0QQzbINoDyrk6qjVqrYWUFsBYkgFSOswO01rVTT4LNjSv+3oPUX2U8NetJDuyvSF9 sOATzCzGfGjFgxKcVxzL+ktuHkXD9//p5MA20qHcIUW2p4KJ/hASRZl1k8u81p++ghDY W5Pt6yuysWQ2CjAe/ZlTW+jZxlyXj4wTFlHeIt2+PfmxQSRynYwGdZv76Eod62S6QLht jXpC23du8fk0bbB9zcsbw3vzNcJ3jVBI0OYm0k4ZxWiytF6T1s2+eRs30Gp4fZrjBdAG X2fWRi7HLSwkM/C5FOBUkcTO99c32CIw+1PXHXAFODciLTFyCkmkIlcl0OfXRkIcrumb FuFg== X-Forwarded-Encrypted: i=1; AJvYcCVaIr9ROPGAiPY8QtNbNG2vAwjed2Gyg2jyXq4rHM3g2kfAzlm/nyylSPlcD/I/Tj9Tw+DXw/ybns5zxPw=@vger.kernel.org X-Gm-Message-State: AOJu0Yze82By8wqRJvQYzGGYQNFjrigCTMdQ92Tv11p9Kne69p0RglJB iuPYAGsyoMcBYFzMUQeDSt2goSdLjK1yHhNeuTlSYd1S+HWUpT8WTufXjdVsTw== X-Gm-Gg: ASbGnct2/cdfFK/6ox2hT5h/W6JX4tcl0hwcmOUpAakaWWpJT+VAVOdKmLsoOHEiWT8 5BN8/ZifF21SP93sEQ6YIqW97e9sp3cN3tng+STJxnsb/q0e4ze1+ee6XvtdK6PO7zFrjtRYYPU 77vLRIE3Y9eSDQqs4mqS2Xx5nt80iY/Z1tRndaS46CPeM5l0un1nSfYb7vjM7G3zwXG0E0X3MUc y4jcZ6q8CnB+Q1PuFcdVCk9rIFKfGhbltxgwc1T7tC65PoOUQspjqDFaQgBJ0a1pKDSk07sur7W vcO0BsC2pX/a/k9970+63BGK+hlc 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 *h= dl, struct v4l2_query_ext_ctr } EXPORT_SYMBOL(v4l2_query_ext_ctrl); =20 -/* Implement VIDIOC_QUERYCTRL */ -int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *q= c) +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 =3D { qc->id }; - int rc; + to->id =3D from->id; + to->type =3D from->type; + to->flags =3D from->flags; + strscpy(to->name, from->name, sizeof(to->name)); =20 - rc =3D v4l2_query_ext_ctrl(hdl, &qec); - if (rc) - return rc; - - qc->id =3D qec.id; - qc->type =3D qec.type; - qc->flags =3D 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 =3D qec.minimum; - qc->maximum =3D qec.maximum; - qc->step =3D qec.step; - qc->default_value =3D qec.default_value; + to->minimum =3D from->minimum; + to->maximum =3D from->maximum; + to->step =3D from->step; + to->default_value =3D from->default_value; break; default: - qc->minimum =3D 0; - qc->maximum =3D 0; - qc->step =3D 0; - qc->default_value =3D 0; + to->minimum =3D 0; + to->maximum =3D 0; + to->step =3D 0; + to->default_value =3D 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 *q= c) +{ + struct v4l2_query_ext_ctrl qec =3D { qc->id }; + int rc; + + rc =3D 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 =3D ops->vidioc_query_ext_ctrl(file, fh, &qec); if (ret) return ret; - - p->id =3D qec.id; - p->type =3D qec.type; - p->flags =3D 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 =3D qec.minimum; - p->maximum =3D qec.maximum; - p->step =3D qec.step; - p->default_value =3D qec.default_value; - break; - default: - p->minimum =3D 0; - p->maximum =3D 0; - p->step =3D 0; - p->default_value =3D 0; - break; - } - - return 0; + v4l2_query_ext_ctrl_to_v4l2_queryctrl(p, &qec); + return ret; } =20 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_han= dler *hdl, u32 id); */ int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *q= c); =20 +/** + * 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 --=20 2.47.0.338.g60cca15819-goog