From nobody Sat Dec 28 04:42:15 2024 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 098F0195980 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-6d8a3e99e32so37967196d6.2 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=K8Ia0JkggXHIj4Ilbkk261g9D2H2c7ufnexhL4i1tXrqmg2te816qEOLi/dVP+Y6wg oQ4/S9OvtqWC3jr5Sm6Oq5NueR1jG1S8Uamu6qWqLzqpSG2kQlVxzFIJe3u/+bhLHY84 u7cdZfas+W48p6EwaYiVdcykiqjrz+trvPnEh/L3himrHvHiKyFh7F7G67APO4f3fLU6 Qzb62Xa0hjFOQvtWJU0tG5+DKltTRySgQOpykpvnpRiSgIzv1AKEjltpGfkgMG8Vnff7 SipN00bc/WouziAXUPJSpJr2GycXJNF/1XOLTmlf6ntOWYwsNcunNFBmxV7gcvTyjikH 4SPQ== X-Forwarded-Encrypted: i=1; AJvYcCXBnEAG1ujBvZjZCnv1MM752En5k7aHcrIwfx4gZ1d5yyoXyfMkzjHrpzHqxmSuKVT2ZSXTDbeyrie/YwI=@vger.kernel.org X-Gm-Message-State: AOJu0YxJggeLoGh/tKL96b5U5hjVcDzTAklbxu1qFFzM4c4qQitMqb6r wnC4ZIkcj8SsHPyQNQshzJgCGIr3RzEAXLx/IX0ANGekWd2Z+dthpJ/eElfxDQ== X-Gm-Gg: ASbGnctwylkN6/d/oVbJm65RCadvWVkAIzQW8gOLZKwzKFp30szULWKmaCIF2JAA9Pz 1CSATqiuU2df7MpSdkcsLWLpxw33TLV9+Iwd6pmZ0EpIrVugLQROaB4y7zKkycCU9ABWplobybJ xPeqEwgFRjFZEMd13kWju+jjNKcjOkoriZXpNkU3k0oj7Pm3HnAQb9kT9OX1yMpTxGcR5HoL8UR VokB8dogiLCy/2CLR5WFqWjdUvaLgxnHPRlw9p0XvUsdtR9dtC3nqA6SLxKD2Je2aTxoms1nBU8 M03FuTjVHQXk7LhUNUhlxahA 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-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: <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/st= aging/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 =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,35 @@ 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; + memcpy(qc, &ci_v4l2_controls[i], sizeof(*qc)); + qc->nr_of_dims =3D 0; + 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 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 +1565,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