From patchwork Mon Dec 9 19:25:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 848578 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 C6D041957FC for ; Mon, 9 Dec 2024 19:25:36 +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=1733772338; cv=none; b=LFQwunsTc5P9OE0In6Yf8SY/UXYWpwLk1ulhiu9fInAyCHzQn4izE7LW2We6MNVcmNOsC/qtgzBucHS4HlWikooOK0oiTkHrm2iTRDyOU0B7vVSrbLOwqest3RyIA0esh1mgIlTiY1RcBTjPfo0QE3hZYXtUbNDvfueHaK6MjMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772338; c=relaxed/simple; bh=EY8oqmKTiUV81iDV12LiEs5fxLsbZtTGDuxYmfLNCp0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UbmrdbOGzrlv2Gaf3uuLzrrte+ASlwVINOorX74PSGY+Z13iNkkHQjqIxPqWoRJivSbJuWIN9esWy0Dk2TaCHtPhdsYLajXyRl2tYJ7H314dZFn/IJYVyEw8nQpw3hioO7baAn2EX/AOFwyK8li82rn7AsowAQq4MeyOU9fSnuk= 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=eDl8YVIC; 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="eDl8YVIC" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-4676e708aeaso7091711cf.1 for ; Mon, 09 Dec 2024 11:25:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733772335; x=1734377135; 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=ALuCNiC6NiBbAaZWJ7ZF+lCNq8dvy5S4QphoAjogwrE=; b=eDl8YVICjG0HdP+oStEBU76cEvD73LNGZQr4bUC3PDPQJmWs7MzS8TFDsg/zZuBS5j yYuDMdi5DgpjIQ/0YWuz6/Bl3DagroPNpJyjVOQ4E6Ip7/B1MMSGcCH+uuPFoxVarOGt Cb0J8FRa92vYKcg0Yi1HDY8Zf92Bpn/xFfOxA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733772335; x=1734377135; 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=ALuCNiC6NiBbAaZWJ7ZF+lCNq8dvy5S4QphoAjogwrE=; b=UxPl4b2E+BdrTwDyv4mQwbys1xJywccPHyylakgSfVWFp+cBcduY3BBPQPXqfqkfha 4jPZc0sg13sTRih5BEK1N0Py0gqyexAqqzJlAfax5nhhZ92qBwHHR0TZfrJaRWg5S3Km uJHAN2jk5CMYxNKhM78VS7KLSnDlJE2gvpM9Ywo7kyPI7wNkmbbAeqTvhZV5clVCCkyz H3JbNtRYQsTCrzG3k+5SWbsca2bezN4C0nRqIppUGDuMRdHrhCDe1NWfXSA2PNlPkEqP JWgTL8gybqFvwwY0MQjIMxpdkCSglAU036zGmwXwIH12zQ1ur64zD+B7wQCCdlD+fZeB uJ6Q== X-Gm-Message-State: AOJu0YzYhedmhrY11eSrsv5vY1edlOm5QCCtPYSUP3omT4/HFYY2KsWX a9hXKiMmh4Om/0+42P6u9vVQ//HiUZJWpKS8asc7PcWrKxX03qRgFtK94KNkvA== X-Gm-Gg: ASbGncsxRc/oi7ptQH7XJStFvEpTE8In27vN+gNBFEk0/sKKeaAXjUiYJTwO3zv1LNK 1QqKEnbBWG9GYcuSVAdSOg+CeSVm4FaXvhwBzsdyS3Gw3En92p8F/b4871LGRoIxzaiVcxwkh8N 4u3I7TlDaYHjbWBW7vv0AhBJy5z545XwpR/orNcBqtnZA15Y5viV8aNNTjFmSlwUZjjnlVHRzAi WNIWDC14GR5eYapK1E4sCCQ/9eh/e7Qu48i1UiUpqeYtlFkcvz8D3iZbsIn4zTNXdBqVt8Yf+YI HZOtxmB/x9V9uCDatr7mXMZv X-Google-Smtp-Source: AGHT+IHsk+VHbWui+xY2odwllC141usB+LpKAHlP2mMq7yUmbaK9+La1b1tTbukiapbv37JDSVTxrw== X-Received: by 2002:a05:6214:5086:b0:6d8:9002:bde2 with SMTP id 6a1803df08f44-6d8e71a8c8fmr234897486d6.28.1733772335566; Mon, 09 Dec 2024 11:25:35 -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 af79cd13be357-7b6cc1cf6fesm217433385a.102.2024.12.09.11.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 11:25:35 -0800 (PST) From: Ricardo Ribalda Date: Mon, 09 Dec 2024 19:25:32 +0000 Subject: [PATCH 01/10] 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: <20241209-queryctrl-v1-1-deff7acfcdcb@chromium.org> References: <20241209-queryctrl-v1-0-deff7acfcdcb@chromium.org> In-Reply-To: <20241209-queryctrl-v1-0-deff7acfcdcb@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 | 22 +++++++++++++++++++++- 2 files changed, 23 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..a5562f2f1fc9 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,25 @@ 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; + strscpy(p->name, qec.name, sizeof(p->name)); + p->minimum = qec.minimum; + p->maximum = qec.maximum; + p->step = qec.step; + p->default_value = qec.default_value; + p->flags = qec.flags; + + return 0; } static int v4l_query_ext_ctrl(const struct v4l2_ioctl_ops *ops, From patchwork Mon Dec 9 19:25:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 848577 Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (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 2186619884B for ; Mon, 9 Dec 2024 19:25:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772339; cv=none; b=KwyACy9L2jDYw4vNDjQTlhV1KGopur5Td0JYlVg92i5+zDqwyTfZWV/8X8vrTFN4sgTFmhHkgvKwdaYRqBZORUtb2tDJC947/SMovjgo0frGxt0dH8xwHGyY+JhkATKlcoQuWP9aXV26NLmz5dSl53v7op/ffKJWgSEc/U6N/VA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772339; c=relaxed/simple; bh=QTPQ1DyM59FTFwoOCCInfTij+St4lWshfJMO2MNF9Jk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oBidjE4byME47WY7Tsv6hR7z77xPrEH4YgQaiTrQeBTtiV74TYhNsgHQD/CeLfDex+v56inFjZG8yu0Hf82KD37dL4b9PxcQ9E44SuXKCG6KTrLpAu0l+yOSvAE5sUF2U69JBYfpTJnnHsUU4j0u4mEEkulyO051zfHUCzaZlmY= 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=iIu4JGBY; arc=none smtp.client-ip=209.85.219.44 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="iIu4JGBY" Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6d8d44e177cso44947146d6.1 for ; Mon, 09 Dec 2024 11:25:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733772337; x=1734377137; 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=iIu4JGBYFJSNofCrIrysiSZl9FgvesfdhxENnmlefDM0UeeFchhFDA+My5CX+z4pPA 8Zf9kWY7mboSXqHCRLZ2PIgXIPg+3yZoswhJg0+HvcNkQ69et2SO2G7mvcfZQFjQH0kz HVaJ7aWizBd2cQsYf5o627aVW51ZCCx5/WR9E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733772337; x=1734377137; 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=K0p8VGtzoHlj93aW4ZVy/fHObpyUArkyJaGUXwNlUhiU8RFacsFbG92pO8FLwaXMeT 8Cd8QJnsF5Xy2aRbYJ5CHHSpey5Qgwjm0afRmQze1vutyIyJSTzO7+XVh/jysdR8HuM4 fiv3FURRKCDNubbkN+gNsRiaMlAHo52FqCAJkIU3JtmfCeW341CrU3uT04dTXtNBeNps EmFu5ZVQxwEWQa1/ovNkf4ny2larTUXCnXWiXiM2W1sz6Ka/rZPtkOYrRoYqrd3m+qpa qa9KmEwOEqq9kj9ssSSRNcku+CL2BX2tw02KGWF1CwTRLgyJBemFXyMFi0L8oHMKTKt5 gtuA== X-Gm-Message-State: AOJu0YzOdVZdUmmCqupDH7VVgRGQ4cWqTrzgo1nx26s9K1E22j9U+rls yQYhdizgsE5/kRoXwbx1mGA3Jimxqh2Ui0G87D7F5lQ1FRPzyJJLjDFWN9Lnrw== X-Gm-Gg: ASbGnctwxY+olJJt2MKfDfbtAmOPirjPXvUH+2q70N6DkzxQ57b7dN/gU+yFs8qhrZi /jBR03eUTwl3tOr7UZvHAw6ej1ZhTmGk4YQ9i4xkUyRW9utokTYiHc5pPM1IT51HLg3o6/UnEYF yzhI2K/WCfXMJ6EbsJq+DfKmHErTYs79airgz+vGo2m4cMiRKxHtWZVNRDzxPRdBoNGNtVuRwo0 CHyZK3QXf+6obKuKC6/M/e7SeElrcrrw6pEQEj0vtwHA6cudKaSc9rZM7aDutFlCoo3+YbuMqwK ZTO4DZwYKughI20xEyy3qfTk X-Google-Smtp-Source: AGHT+IFHW0/0qUHG8qwMzURyamcTUPmaaCxTzs+9Cce4VEgPbFPUYI69YdWNaUrMvMWP46LE5wus3A== X-Received: by 2002:a05:6214:27c2:b0:6d9:1532:d8fc with SMTP id 6a1803df08f44-6d9212c7c65mr9382816d6.11.1733772337147; Mon, 09 Dec 2024 11:25:37 -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 af79cd13be357-7b6cc1cf6fesm217433385a.102.2024.12.09.11.25.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 11:25:36 -0800 (PST) From: Ricardo Ribalda Date: Mon, 09 Dec 2024 19:25:34 +0000 Subject: [PATCH 03/10] 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: <20241209-queryctrl-v1-3-deff7acfcdcb@chromium.org> References: <20241209-queryctrl-v1-0-deff7acfcdcb@chromium.org> In-Reply-To: <20241209-queryctrl-v1-0-deff7acfcdcb@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 Mon Dec 9 19:25:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 848576 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (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 09B54199249 for ; Mon, 9 Dec 2024 19:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772342; cv=none; b=R1hLlxO9MtCX5IbQwgf67/t1r+qd0k6Q8kclu47VREAbPgCG2Tmkq5Y+xQu9oX4T6Ypt/u3CrM0UPRkdKClATzsYrHEuz1QxkC2ryho6LYgUnNYS++dt6Xui/ccivvYfLPE+3r3iX1vPpZSr/0z/BaS+4qs+5z5eWtVU3hz1Le0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772342; c=relaxed/simple; bh=3hn+UbgNRo1Vvg//E6tf3MH9DX6Es4eU9XONllUKPyw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tXN0SdP+a3eAboa841xFj75tl6mNRu6TWTuw+gCSzlRZ/XxXCGbOBKdL2rbmqWljHu6Ix+j3znFdetmBUzUt6EE/Glt6jEf3/ANeaG+k9aLMiBFprOxtqlEGLY4aIxZq9BPp87pV5IYK1HiEXadh6a8In9cJA7rhSZoex9Au1ok= 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=bLvxZVLf; arc=none smtp.client-ip=209.85.219.52 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="bLvxZVLf" Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6d8edbd1a3bso23221576d6.3 for ; Mon, 09 Dec 2024 11:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733772339; x=1734377139; 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=LZ2bYJmReZdYhWgrWqbpm/s7LwVM5L6DZW3JOy2ZqFs=; b=bLvxZVLfJsZBwDreq9bMF0xGQRIpteKVAZuJV7c2roC+c4knnOur5AydYTB4SmeDmh tBbbjv9xNPo/TqZMV1fw8TVIFnGh7tniypSQoSnflmJW2N+lFEqpz4kGGizYIJ9JruFv fAdnqVipkQtZXi/nZCz4OHJ2mfENiMg7JlwdE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733772339; x=1734377139; 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=LZ2bYJmReZdYhWgrWqbpm/s7LwVM5L6DZW3JOy2ZqFs=; b=FSnuLYPbCbnp8TIvlDEj6cctqGpdC+QSbACo2QuZiyGzqaGVWm0Vtpxc0F6wy1JD/E Ae3JEmC0SW+kcUDMWNuYOrWENIGH/pVOoP9ymTMgiQSQarmJwldsDHmibx2ZmoHwcYJG fed0c6Jg+vRB0jzgT0VaS+GlKNvyHIxchdXOUiiIGi5vEBpWVYb2y3ivTrdqqyCDamTh ydUgIMVBQudUbAbrRlQq+BKvcj2ccS0enG5PTb2nrVcvgcJEOZF7aDl1pQmQgb/lUVb5 Cy+JpIsrIrcWfuIEG1HKuuYiPJOgM+QJgm50ufFT5obCCZ5dmmTwlUH2VLUYGZt0pG4B lHBA== X-Gm-Message-State: AOJu0YzqFFJyPXRp6oIUngA3MQ+22nUHQKOcoNiLZ7BPxOOGWufKxReB u+TmuQ94RJMNH+rMYC8P4u94OAawZH04F26XopbDmP78IjMwzmSS7Nqf9R7CrA== X-Gm-Gg: ASbGncvnIXIP9rPZysygUtVahs034c6ASU8viz5heaWteKkNkYePoXto/3OZnQnBMcs Er586LVWp8iHsouWAgRV3uekVusvUnX+FQTDPu/mViJrQlLxz3uyPwFSF1wMDa8rqfdDLZ/oMTI cPpJSlzAzRJgvMe7Jp5eJUWtKJiw6D73vEyVTvX2qT2LxaC4pqxFhjbrI0urR6pGvB0aDv3SSEZ i/E8ROojsjDxXeyNDtMIexg9kyFmBR3ehkYdDT7oHwPl/A0gk8lwqmWHixuMkIksuzt/aw7GF+Y NxFJTzkCpsmLZchlp5TGGaSm X-Google-Smtp-Source: AGHT+IEEzHN2lOcUckbzOhPkCQcj1XO3mZCg8zUBijND4xHIzep7iljKXyw3l3y8ggzjN0SCzkOjSw== X-Received: by 2002:a05:6214:d84:b0:6d4:1e43:f395 with SMTP id 6a1803df08f44-6d91e399f68mr25209096d6.24.1733772338843; Mon, 09 Dec 2024 11:25:38 -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 af79cd13be357-7b6cc1cf6fesm217433385a.102.2024.12.09.11.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 11:25:38 -0800 (PST) From: Ricardo Ribalda Date: Mon, 09 Dec 2024 19:25:36 +0000 Subject: [PATCH 05/10] 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: <20241209-queryctrl-v1-5-deff7acfcdcb@chromium.org> References: <20241209-queryctrl-v1-0-deff7acfcdcb@chromium.org> In-Reply-To: <20241209-queryctrl-v1-0-deff7acfcdcb@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 | 34 +++++++++++++---------- 1 file changed, 19 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..d24420d8bd57 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,35 @@ 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; + memcpy(qc, &ci_v4l2_controls[i], sizeof(*qc)); + qc->nr_of_dims = 0; + 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 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 +1565,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 Mon Dec 9 19:25:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 848575 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 8395D198A01 for ; Mon, 9 Dec 2024 19:25:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772344; cv=none; b=OZ/nB9lJdHUlJFQy1QxEndMnHx7RUztVpoe9zGAIuPpSdINF1y9q6QK6D/BX9/rNqqERUyl5BZePwkn/SjQ6tAG63zOkzYQOeNA8DaVvMjKzvnk8RRAOzGhML33opxLvrpVCBNUq7yH6Zx4CSm+RJwSHylM7z3fCmVMJqmleHT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772344; c=relaxed/simple; bh=oaCq3lFHUlXWfLBs1yLgfb1pQhfpAzznJwSy1NrE1wY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gCLt+rG66IbUxP9eF4+FZIkx2UC7AJz5MtLC7a/0cKub4ocm3CcX9RrP9XVX5MzFon1y2fcSv5sJ7K2lF5oddXZIaIx+Rway6r14fkkHkn6PA0vaQMFjysAzLqORUBReu6jjMoefZAARlUf4xZOTZqdYs6D+MEyZlH0eB2/crKY= 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=m/fipHAp; arc=none smtp.client-ip=209.85.222.182 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="m/fipHAp" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-7b6c6baf8d6so164524085a.0 for ; Mon, 09 Dec 2024 11:25:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733772341; x=1734377141; 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=ltErOm77Oh5lK6TbfQofWHlLQPTPm1Kvo+0ZzyBQyKQ=; b=m/fipHApLRWoXOYh7YusvwGzNf5CW5p+47YbogJlAMIOgzgXaOAdXFkic2X5Rfd02w /6cPL/kTauMxSls1e9w1oxjVPObxtFsaM194/hjD5vLQm42XHvbfgJK473TvFh9+yAlm RCFjKEq4lJ7twwDPXcwV36++P0ztVg8Y2QYtQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733772341; x=1734377141; 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=ltErOm77Oh5lK6TbfQofWHlLQPTPm1Kvo+0ZzyBQyKQ=; b=Wlir/qaMWllloTstK/H5xKNtqD8DjybDE4DxYxJmWN8W6NZ0QWHxL0NI2DZNXJeoji dHHPu1i8A3VUlH1c1p4KQEFGiqKVmtAoA2cV2U6O7E3gJAhU28ij2BeSkvOtWwjohLrK wOrHUBvkoeM/GAHfhOOKOJask2Kq4+Unb2FOa8mf/YenwsvAG0enat/j8cfj7YmxzqOK TBcvXin2Df9KIt2u8GHTvTfMlWOnBDq7CL8C4m+exrd/1W6feaS7XCP6Wxoodjnw85IZ RDPk0IqWs9laP4U5mbnMqptrb6at8pGRsP0oudhazXaKCcniQHZgseUVONlt24BAKOyG A6vg== X-Gm-Message-State: AOJu0YyCPHmpbPyqpq/t7FHgaiPfu6WIceKCuPXQV8OQvpnNqn2DEGto 3C/19RBHZL5VktD9IETeQJ5HbQ8swkbhku9ZqxiIEpYIw7Rpwvx7Fx/plKBJ9A== X-Gm-Gg: ASbGncvFAigw7W2BJy4V8OzJohgLMFiH+36vf44GMjxvHBHo86F9b9/cvZz0P7a2QCJ zchs5e+JhpMSIwTrgo783FAO+EHN2g2iwuWQkL9k3Q6jJDW208q3lPO2Nka9aMOgZk8tmttWygK xs+2h/83n3lVD9KRw0gSVzyPJxhr9FvWECl5XOme3Mxncw0pWYgV3lrZ5oZ/mt/ebtW1mGqEkqo CBpDmyiPhUuBEpl+nvGgO0VOUkTdap3Gcw5fisTZCKuQ2nlwUW2nhNGcL5eoRlc6ILw6rJb52KE +0Oqv2n7vrsvvT0pkbXh/AqQ X-Google-Smtp-Source: AGHT+IEC8fFJCiNRaM0A+A/h+DVBohii9gw561GeeuVFgC5WSmzaiO9D+NgO5W3/1EB4ImZzjjZjKw== X-Received: by 2002:a05:620a:468f:b0:7b6:d0be:ca31 with SMTP id af79cd13be357-7b6de762d37mr79678685a.25.1733772341402; Mon, 09 Dec 2024 11:25:41 -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 af79cd13be357-7b6cc1cf6fesm217433385a.102.2024.12.09.11.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 11:25:40 -0800 (PST) From: Ricardo Ribalda Date: Mon, 09 Dec 2024 19:25:38 +0000 Subject: [PATCH 07/10] 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: <20241209-queryctrl-v1-7-deff7acfcdcb@chromium.org> References: <20241209-queryctrl-v1-0-deff7acfcdcb@chromium.org> In-Reply-To: <20241209-queryctrl-v1-0-deff7acfcdcb@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 a5562f2f1fc9..30e32ce5278f 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 Mon Dec 9 19:25:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 848574 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 E616119CC24 for ; Mon, 9 Dec 2024 19:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772346; cv=none; b=jXxs3v+UvQaK+fSRWVXEkHcBdAWl+bYa8b1BcOKTCAPIaOcNUsdbTLgBbAdzGQx4deiBETnlsSq+/V3aV7ard7IdGDiqWJ/VtTUriBFAGOPVmxiWwIUru2kyTilkUBteXo1IriU400fF6qPmGO0QJY/SbdQh0xIQMIYhTXyMyew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733772346; c=relaxed/simple; bh=YVfCDMG+ewVwUxyDDbbSOUAdz+veaEMx7LKaz5GBLvs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ro/0i8+TDXjP0mkA4thYagKDaUlPUlzdZzzjTaN1bQIhICh6Sdaj2UpObWJdwrHIWQzm2Ls9JOKrYJ7xOMt/dH+V9PnV+oPVd3BIR7yhn6EvsiqrtS6gdWqPz5CMRaC06m9Tx1Q+08mcegBWBD3Vr/Q3+RHlO44jAfsCjSyjI4w= 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=UGur48/o; arc=none smtp.client-ip=209.85.222.178 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="UGur48/o" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7b6d07c7d84so131705585a.2 for ; Mon, 09 Dec 2024 11:25:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733772343; x=1734377143; 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=UGur48/ozXYn0XUNvTuW8/Z0MIoh8wjLTbHOlPf57pyiN/ifs6VG8YP5cmqNzhhwKL 8n0kabYc0ADcrqNCo/IpJbyKSpasFP90PxKGRoaVaOieWY8njQsmXEhvoTH55DneoxM9 ZQRWOoJJokP5fSef33mBXg8o5Qhg4IVuUf4Qo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733772343; x=1734377143; 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=nSizvh0L5RVVD5WR+SPalsX90rd1y+jNJzhnlBF97qX6N/v4qS9K7OqfFHfKG5Hznz pNbVW6sExxqJOIq8ZEuPyIG2AKZBeTKXQuWmI3eQXEpP+IITLRFwIc18x8ueVkbnuvpZ QE/+dquF1dDLZ/wyPPa/avKyiq16NJMSb0woWzHnTot76b2uNHjmrJIzQ2dzxTJ5v56m mkw8nr4295M0ibbkAOKP10c7tpI/liz8453eUFlVmY3+o+4jF5gzcnuHGvXoD6skcj0I cujKtaSn+3Gzv65pnMIwR0ld0x/G5XYEafgQ9ypw7HXY06cdxc38ib/8vQYz4k/j+jKK HMfA== X-Gm-Message-State: AOJu0YyveOb5gj2YBMl7C0kGphgPheVSs9k5NUWTQiFCqIaK6vVqoPf4 KCpZ0t9eNJt8VqyVLlq26UUhhDPU4+b+Dc644VsmFZrXGxUVYooNm+Z5iJwr+g== X-Gm-Gg: ASbGncvWYribwMrzWE8vduVCvbmwFNo96xa5cTe7rp/+s8UmrDQzaB3RYgz80PbiXwr xrvZE0WeXhU/NK/Ff3rliGBCtmzJ3E9d1L3EySPiUySdUY09LBeaNlQgU5jMxc7LdbQ4oOVFUQt vyAaQlu/QM9o65QYeGKYy9GrFVFWhRZzpelk3d0YfUCpZI1V6uIZf+jjuaU3xIk+vupbLrOL4Nv 3iuf/wUgvga1PqSGH99nrcdExs5gGfFn0t5MAKaEvkbQuBJBAyXkm5u+bcm7wTkv9fRVd1jm7fe oe4fzTihYSvnYJ1ePiKj/OfY X-Google-Smtp-Source: AGHT+IEEiNvdKrQR0ZlgT/dI9fWuGcmjgZ2kgyinLriV9vaeViM47DQlUbu8twZBqoLXdUvISKJmXQ== X-Received: by 2002:a05:620a:1918:b0:7b1:48ff:6b3c with SMTP id af79cd13be357-7b6dcdfe7c9mr246350985a.16.1733772342811; Mon, 09 Dec 2024 11:25:42 -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 af79cd13be357-7b6cc1cf6fesm217433385a.102.2024.12.09.11.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 11:25:42 -0800 (PST) From: Ricardo Ribalda Date: Mon, 09 Dec 2024 19:25:40 +0000 Subject: [PATCH 09/10] 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: <20241209-queryctrl-v1-9-deff7acfcdcb@chromium.org> References: <20241209-queryctrl-v1-0-deff7acfcdcb@chromium.org> In-Reply-To: <20241209-queryctrl-v1-0-deff7acfcdcb@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,