Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp726385pxu; Thu, 3 Dec 2020 11:02:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx11h/SVrfXXnOSa7bQBjRvn9RJZSBhV/2onv5mL+TGEfwmdlZ4lKOQlKEBuX80bG5kYjnA X-Received: by 2002:a05:6402:114c:: with SMTP id g12mr4114089edw.167.1607022158219; Thu, 03 Dec 2020 11:02:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607022158; cv=none; d=google.com; s=arc-20160816; b=0Azv5v90P54/9iYc5ykE/q3sVVSx1aWI3ognQ8ar/WpMSeoKRydV6ji/nfDw/Dn5hb Z1mlWZPle4jbAOzJ2PW32bkQO4U/gw07sLlDmIX65c/hZ/QliyBz1j34qrUL1EcR3kCE TT9ziMiKR9XovuC3HfNHJyrcEKpP+R9QB16WYGUr1eSVe2/7DmfeK2DB0NjN/Wa9qYYh G2Lr/cekpfHf62aUSTACzVgkuVATRM/AXsvGwHMTDnud4+hOitaM87Howh6b+jga12LK 9Ubn8fUah4ICRo7fBBNRmRXpa2VaLoVoAHcXNFcqsEviyq470UXd+mOLfPquUBjJ8wXH pQFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=ERCkCneZmXlmcSkkK9fGRHPBppn9DardS4Sr/wZUI/E=; b=Xu2tn2VWNtpqV45Q7wXmEn4GWvv0qpPMpADAhXrfNCZfQDRfYEqRbD+peBeyPC/Sxs HkziNlTpAQsQjlpWlqT7Q2TqW0WNYnkG4hWQbp9eOCK4pJfEJF79CgdkGigknMhD856I pQmPrn+hQwAy/cMsVKN+nD7v6cT+vY7CuYdcmsHulOb7WCmTOcRMQ4uJtkq98ye6FJ5R C59mtM4ub13RgMmieA/y03b0wTzkKQYhBkCXePvFDfqV49yXmnUiAtbHDcbc98jFE91j KZbMY7b2GiSw4/ro36tCTsq1J2WaeUtOscWOx6f8k/CxHSR3/Z1/fspBeqUqeXz9Fzip FRZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=hp+9vWAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lz16si1654861ejb.373.2020.12.03.11.02.13; Thu, 03 Dec 2020 11:02:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=hp+9vWAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729481AbgLCTAs (ORCPT + 99 others); Thu, 3 Dec 2020 14:00:48 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:18299 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727718AbgLCTAq (ORCPT ); Thu, 3 Dec 2020 14:00:46 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 03 Dec 2020 11:00:06 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 3 Dec 2020 19:00:01 +0000 Received: from skomatineni-linux.nvidia.com (172.20.13.39) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Thu, 3 Dec 2020 19:00:00 +0000 From: Sowjanya Komatineni To: , , , , , CC: , , , , , Subject: [PATCH v3 01/13] media: tegra-video: Use zero crop settings if subdev has no get_selection Date: Thu, 3 Dec 2020 10:59:50 -0800 Message-ID: <1607022002-26575-2-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607022002-26575-1-git-send-email-skomatineni@nvidia.com> References: <1607022002-26575-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1607022006; bh=ERCkCneZmXlmcSkkK9fGRHPBppn9DardS4Sr/wZUI/E=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:X-NVConfidentiality:MIME-Version:Content-Type; b=hp+9vWAsmZRaQ5XaJvFVOeiNkH1BS6XZYb3wesU99yy5mVXOWBpTfJUn+34UhqgmC 34x1ftz3R/jeV56KvA7pIayHb8JHJMoD5jlvuln/zoCDdj2U160TYVI1WWxo0llggr f4XPsEH0xeXUwkHLN/tD0N+Grpu4NIyaZ2GUvj/OCePIveScHtKFjzXDTE6aAnIbZX zX6TL9okwMm5mXrc0QG9+KcXu9J9c8UdXJNc3+jbrM5xV1ZKfCH+rVWK4WOV97LyuA lzRWXO0UcN0eZzAQaYasHBeHAvKR7Afmi8xUk50jMIe7Yh9ZuaW5RBl+ZzDqnRkKrP KAXzoPMSmgrDQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently try format implementation doesn't check if subdevice has get_selection ops implemented and returns -EINVAL on error from direct v4l2_subdev_call of get_selection. Selection API's are not mandatory for all V4L2 subdevices. This patch fixes it by adding v4l2_subdev_has_ops check prior to calling get_selection ops and continues with try or set format with zero crop settings for subdevices that don't have get_selection and returns -EINVAL only for subdevices that has get_selection ops. Signed-off-by: Sowjanya Komatineni --- drivers/staging/media/tegra-video/vi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index 560d8b3..7edd35c 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -533,11 +533,18 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan, fse.code = fmtinfo->code; ret = v4l2_subdev_call(subdev, pad, enum_frame_size, pad_cfg, &fse); if (ret) { - ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, &sdsel); - if (ret) - return -EINVAL; - pad_cfg->try_crop.width = sdsel.r.width; - pad_cfg->try_crop.height = sdsel.r.height; + if (!v4l2_subdev_has_op(subdev, pad, get_selection)) { + pad_cfg->try_crop.width = 0; + pad_cfg->try_crop.height = 0; + } else { + ret = v4l2_subdev_call(subdev, pad, get_selection, + NULL, &sdsel); + if (ret) + return -EINVAL; + + pad_cfg->try_crop.width = sdsel.r.width; + pad_cfg->try_crop.height = sdsel.r.height; + } } else { pad_cfg->try_crop.width = fse.max_width; pad_cfg->try_crop.height = fse.max_height; -- 2.7.4