Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13330348ybl; Sun, 29 Dec 2019 09:27:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxrz+zJWgfq34fpHZeEpQ9D2ILJAXVyRmQzDsQ2gv/YQ4zgkKQuo290KoN0QywQdSq4LUTm X-Received: by 2002:a9d:674f:: with SMTP id w15mr70873527otm.243.1577640431153; Sun, 29 Dec 2019 09:27:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640431; cv=none; d=google.com; s=arc-20160816; b=aoOiZ/qAzKfHT3a8leX49GdmTKo6FfVXMEnzX7Y2JNLyHU7kOSmg8JNawjYxhvfsG0 14+bC8dCuWfSsB558VhgDb7PAdMnv9clCu8KOYuhNZis7BfG8Z1zrpXPXMtmiJ0IBfls tVpzdiweyPXrFbuL/Dk5tPwyhGX4kWlXlQ/C8vaJFbzRpUKxE8MLV7UDe/npqR7YPW0W 6CGwh3VvJrcQb5aqqQY3b2qA+arHNzjOVZf705BdD734YD1xDYVnC08RHXmK1Bca3W30 b6OBe14/pu5Iztv5jm1ogBmrEnM7S7NO2zQJ6bOQUy1E99+iTodaQiVW/FuIny8z9Fkh VONQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zv2j3H3WUlXw4mvZMQ0JgZ34DaLGez19IbJHjtiEJ9I=; b=k52m8QM0FeMIX+BzCbyAmOFsPaal52C7xm4BVjNGB1S8RidjVobl4d/saFVIlxrr5s derFNX7fGO3NjbEkT/Y/n1QIhhS1sAOawewjXQrnWLzpsa9Wd22eKzqkWlFf1pXcFlhv Cq5S645INZht7lzzTmniEaJll8mRkxwrtZNCACabS6w34Sh/NDKQ2BZhoR/XeQGJmU3p nxXL0MfnJzayxXSRgaWDHTAtP1G1HIKgvUJzVMXWDMdXSAVMDnMlR3mBLlrYLGUT3wjw kOfmfDI+0w+11KPDyctg+j/NWQZ2YAQQMvG1T490pEx1ByIlKANQpoZo8fK1y07W61kT K0Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1MhWYwgQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17si19346856otj.79.2019.12.29.09.27.00; Sun, 29 Dec 2019 09:27:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1MhWYwgQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728099AbfL2RZ6 (ORCPT + 99 others); Sun, 29 Dec 2019 12:25:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:46356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728092AbfL2RZ4 (ORCPT ); Sun, 29 Dec 2019 12:25:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E707821744; Sun, 29 Dec 2019 17:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640356; bh=SO5jFCBQPGyj0zKJ5SiSGQxk3Bo7ULmVJtiiuTwEgZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1MhWYwgQdhkPEDUUnufm6sc3ly8oKa9cl1SC4qdSdD7Rj9P6zFVxy90U6+TH7iNg/ CzEfTMCpF13VmQQMs25zysvMR/CtN2TABT3SfOnPB2VGNHqnPCplJKpiFiuuYMR2sO j/lBtjwM8mWs70WJCSTKzXnE1OFWLceEuc+QIe/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vandana BN , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 086/161] media: v4l2-core: fix touch support in v4l_g_fmt Date: Sun, 29 Dec 2019 18:18:54 +0100 Message-Id: <20191229162425.060612027@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vandana BN [ Upstream commit 545b618cfb5cadacd00c25066b9a36540e5ca9e9 ] v4l_s_fmt, for VFL_TYPE_TOUCH, sets unneeded members of the v4l2_pix_format structure to default values.This was missing in v4l_g_fmt, which would lead to failures in v4l2-compliance tests. Signed-off-by: Vandana BN Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/v4l2-core/v4l2-ioctl.c | 33 +++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 681eef972e63..7cafc8a57950 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1363,10 +1363,26 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops, return ret; } +static void v4l_pix_format_touch(struct v4l2_pix_format *p) +{ + /* + * The v4l2_pix_format structure contains fields that make no sense for + * touch. Set them to default values in this case. + */ + + p->field = V4L2_FIELD_NONE; + p->colorspace = V4L2_COLORSPACE_RAW; + p->flags = 0; + p->ycbcr_enc = 0; + p->quantization = 0; + p->xfer_func = 0; +} + static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct v4l2_format *p = arg; + struct video_device *vfd = video_devdata(file); int ret = check_fmt(file, p->type); if (ret) @@ -1404,6 +1420,8 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, ret = ops->vidioc_g_fmt_vid_cap(file, fh, arg); /* just in case the driver zeroed it again */ p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; + if (vfd->vfl_type == VFL_TYPE_TOUCH) + v4l_pix_format_touch(&p->fmt.pix); return ret; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: return ops->vidioc_g_fmt_vid_cap_mplane(file, fh, arg); @@ -1439,21 +1457,6 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, return -EINVAL; } -static void v4l_pix_format_touch(struct v4l2_pix_format *p) -{ - /* - * The v4l2_pix_format structure contains fields that make no sense for - * touch. Set them to default values in this case. - */ - - p->field = V4L2_FIELD_NONE; - p->colorspace = V4L2_COLORSPACE_RAW; - p->flags = 0; - p->ycbcr_enc = 0; - p->quantization = 0; - p->xfer_func = 0; -} - static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { -- 2.20.1