Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13336416ybl; Sun, 29 Dec 2019 09:34:28 -0800 (PST) X-Google-Smtp-Source: APXvYqysX2JzbRXRGJQmJIt8KFZkK0YWMmQ8f6tya4EAUycC/ZInAKhDpTLZ4cC8mYyql6TxTo04 X-Received: by 2002:a05:6830:20cf:: with SMTP id z15mr69759152otq.277.1577640868491; Sun, 29 Dec 2019 09:34:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640868; cv=none; d=google.com; s=arc-20160816; b=IFM2PttbMIHYqNoSC9DQ+74r7WoGhMKBAvgZHtOrMGnuovlev3SsTEFwaCWjxSnpGb dAJBnEhVHKNK6FLdZ10Y6iRbZsNOoRLImpFWLookxekVWj1QZuZgm7umIMD7b37nDQkb pwON5OGnSK/lmx1hvishZMONYjBXy9rh9BQZKyiRswphJ5kkzejRd4uS7/YYETwr41lZ zPRrwrDe8Dgsa88QgyaKXoXVFKmf3GB87vnjBbmY9l6D8cKct+GdZdodECLqJlZofUws 05z4gWkDBKMQsnjTknPykPy+zsx7VwIVhbLE6+b6eI2/AuiYcSnP2Clb+a4RG9nb7F16 kEtA== 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=OF2atSEclDtJaP2l753ftxDxhdg0Nz/s8ATYm/CIVyU=; b=VfU6wMjMpZ+C1MXriWUTfuVJpO9cwzXNQVNGGIr0RAidkF/eSX2blCP5HNggSIRU5e +TqYV+f42KDosUHtJ/uhS4plGkcxl0x7PHeynb+Hccwg4ShazHpvdOUGsDUPjqDS+un1 nXzaZCyiHuuT6+r9A5M5CJNxePUfb8XrAPxwHi9kKYzLMv7MtpDrvrKiSadwnV81NzQl DsMkvbTOzfeBwvZUn1j233+0nSmLdwGP8scfgX+pItLEgngQUp2oWJdCcSNKtvVsuxu9 CSfChjv6n5HXSh6TGC8Ob6QUGJxNXuiodjHFmdUYIj3DgwKR3bp1tIutoZwSj6+I+Qrd sJuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rYJYvj7u; 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 c24si21315328otf.14.2019.12.29.09.34.17; Sun, 29 Dec 2019 09:34:28 -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=rYJYvj7u; 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 S1729298AbfL2RcT (ORCPT + 99 others); Sun, 29 Dec 2019 12:32:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:60664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729292AbfL2RcQ (ORCPT ); Sun, 29 Dec 2019 12:32:16 -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 5138D20409; Sun, 29 Dec 2019 17:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640735; bh=zKupZsP3hwBkIV+DX9F2WhuhPMqFF5B4PJdUbkfqzxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rYJYvj7ugvVZAf/Ck9KfrisEKAcb0g8XBT6tGhp8RaYe++Wkm2Rti6EIXsRAQkNx0 8HZT6sesEpmzvwZytKQcZ73Oe9SDbeSxy/wDkT76YN94aWYbsVr4m5cYDnFMWcLGGC fXIjd7hmHqz1KzGhhDSjl57r6Bc2Q1PDUOc2pSOM= 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.19 116/219] media: v4l2-core: fix touch support in v4l_g_fmt Date: Sun, 29 Dec 2019 18:18:38 +0100 Message-Id: <20191229162526.206349119@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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 a4d3e94a400c..7675b645db2e 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1415,10 +1415,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) @@ -1456,6 +1472,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); @@ -1491,21 +1509,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