From patchwork Wed Nov 28 17:19:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10703025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1560109C for ; Wed, 28 Nov 2018 17:20:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8F8C2D9AA for ; Wed, 28 Nov 2018 17:20:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D80A2D9B3; Wed, 28 Nov 2018 17:20:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B5C02D9AA for ; Wed, 28 Nov 2018 17:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729251AbeK2EW1 (ORCPT ); Wed, 28 Nov 2018 23:22:27 -0500 Received: from shell.v3.sk ([90.176.6.54]:39088 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729160AbeK2EWC (ORCPT ); Wed, 28 Nov 2018 23:22:02 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 54497996FF; Wed, 28 Nov 2018 18:19:38 +0100 (CET) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id cQurqNvyUPMq; Wed, 28 Nov 2018 18:19:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 17550983F6; Wed, 28 Nov 2018 18:19:28 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id N_cwyyut0UiB; Wed, 28 Nov 2018 18:19:26 +0100 (CET) Received: from belphegor.brq.redhat.com (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id CB661996A6; Wed, 28 Nov 2018 18:19:25 +0100 (CET) From: Lubomir Rintel To: "Lad, Prabhakar" , Mauro Carvalho Chehab , Rui Miguel Silva , Shunqian Zheng , Jonathan Corbet , Wenyou Yang Cc: Jacopo Mondi , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Lubomir Rintel Subject: [PATCH 2/6] media: ov7740: get rid of extra ifdefs Date: Wed, 28 Nov 2018 18:19:14 +0100 Message-Id: <20181128171918.160643-3-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128171918.160643-1-lkundrak@v3.sk> References: <20181128171918.160643-1-lkundrak@v3.sk> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Stubbed v4l2_subdev_get_try_format() will return a correct error when configured without CONFIG_VIDEO_V4L2_SUBDEV_API. Signed-off-by: Lubomir Rintel --- drivers/media/i2c/ov7740.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c index 6e9c233cfbe3..781ddcc743d4 100644 --- a/drivers/media/i2c/ov7740.c +++ b/drivers/media/i2c/ov7740.c @@ -780,9 +780,7 @@ static int ov7740_set_fmt(struct v4l2_subdev *sd, struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); const struct ov7740_pixfmt *ovfmt; const struct ov7740_framesize *fsize; -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *mbus_fmt; -#endif int ret; mutex_lock(&ov7740->mutex); @@ -795,16 +793,15 @@ static int ov7740_set_fmt(struct v4l2_subdev *sd, ret = ov7740_try_fmt_internal(sd, &format->format, NULL, NULL); if (ret) goto error; -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); + if (IS_ERR(mbus_fmt)) { + ret = PTR_ERR(mbus_fmt); + goto error; + } *mbus_fmt = format->format; mutex_unlock(&ov7740->mutex); return 0; -#else - ret = -ENOTTY; - goto error; -#endif } ret = ov7740_try_fmt_internal(sd, &format->format, &ovfmt, &fsize); @@ -827,20 +824,18 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) { struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *mbus_fmt; -#endif int ret = 0; mutex_lock(&ov7740->mutex); if (format->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); - format->format = *mbus_fmt; - ret = 0; -#else - ret = -ENOTTY; -#endif + if (IS_ERR(mbus_fmt)) { + ret = PTR_ERR(mbus_fmt); + } else { + format->format = *mbus_fmt; + ret = 0; + } } else { format->format = ov7740->format; }