From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753283AbdBMTJ1 (ORCPT ); Mon, 13 Feb 2017 14:09:27 -0500 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:36216 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753223AbdBMTJY (ORCPT ); Mon, 13 Feb 2017 14:09:24 -0500 From: Thibault Saunier To: linux-kernel@vger.kernel.org Cc: Mauro Carvalho Chehab , Marek Szyprowski , Kukjin Kim , Mauro Carvalho Chehab , Nicolas Dufresne , Andi Shyti , linux-media@vger.kernel.org, Shuah Khan , Javier Martinez Canillas , linux-samsung-soc@vger.kernel.org, Krzysztof Kozlowski , Inki Dae , Sylwester Nawrocki , Thibault Saunier , linux-arm-kernel@lists.infradead.org, Ulf Hansson , Andrzej Hajda , Jeongtae Park , Kyungmin Park , Kamil Debski Subject: [PATCH v4 4/4] [media] s5p-mfc: Check and set 'v4l2_pix_format:field' field in try_fmt Date: Mon, 13 Feb 2017 16:08:36 -0300 Message-Id: <20170213190836.26972-5-thibault.saunier@osg.samsung.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170213190836.26972-1-thibault.saunier@osg.samsung.com> References: <20170213190836.26972-1-thibault.saunier@osg.samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is required by the standard that the field order is set by the driver. Signed-off-by: Thibault Saunier --- Changes in v4: None Changes in v3: - Do not check values in the g_fmt functions as Andrzej explained in previous review Changes in v2: - Fix a silly build error that slipped in while rebasing the patches drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 0976c3e0a5ce..c954b34cb988 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -385,6 +385,20 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) struct s5p_mfc_dev *dev = video_drvdata(file); struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp; struct s5p_mfc_fmt *fmt; + enum v4l2_field field; + + field = f->fmt.pix.field; + if (field == V4L2_FIELD_ANY) { + field = V4L2_FIELD_NONE; + } else if (field != V4L2_FIELD_NONE) { + mfc_debug(2, "Not supported field order(%d)\n", pix_mp->field); + return -EINVAL; + } + + /* V4L2 specification suggests the driver corrects the format struct + * if any of the dimensions is unsupported + */ + f->fmt.pix.field = field; mfc_debug(2, "Type is %d\n", f->type); if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { -- 2.11.1