From patchwork Wed Nov 28 17:19:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10703029 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 0964714BD for ; Wed, 28 Nov 2018 17:20:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6BC42D9AA for ; Wed, 28 Nov 2018 17:20:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB4D52D9B3; Wed, 28 Nov 2018 17:20:16 +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 82CF22D9AA for ; Wed, 28 Nov 2018 17:20:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729163AbeK2EWA (ORCPT ); Wed, 28 Nov 2018 23:22:00 -0500 Received: from shell.v3.sk ([90.176.6.54]:39069 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729089AbeK2EWA (ORCPT ); Wed, 28 Nov 2018 23:22:00 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id B68E5996A0; Wed, 28 Nov 2018 18:19:35 +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 z4zLtW5ehbw0; 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 890329978D; Wed, 28 Nov 2018 18:19:27 +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 CpC3tVJxRvaH; Wed, 28 Nov 2018 18:19:25 +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 9372B996A0; 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 1/6] media: v4l2-subdev: stub v4l2_subdev_get_try_format() Date: Wed, 28 Nov 2018 18:19:13 +0100 Message-Id: <20181128171918.160643-2-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 Provide a dummy implementation when configured without CONFIG_VIDEO_V4L2_SUBDEV_API to avoid ifdef dance in the drivers that can be built either with or without the option. Suggested-by: Jacopo Mondi Signed-off-by: Lubomir Rintel --- include/media/v4l2-subdev.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 9102d6ca566e..906e28011bb4 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -967,6 +967,17 @@ static inline struct v4l2_rect pad = 0; return &cfg[pad].try_compose; } + +#else /* !defined(CONFIG_VIDEO_V4L2_SUBDEV_API) */ + +static inline struct v4l2_mbus_framefmt +*v4l2_subdev_get_try_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + unsigned int pad) +{ + return ERR_PTR(-ENOTTY); +} + #endif extern const struct v4l2_file_operations v4l2_subdev_fops; 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; } From patchwork Wed Nov 28 17:19:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10703023 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 04F7014BD for ; Wed, 28 Nov 2018 17:20:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E29572D9A7 for ; Wed, 28 Nov 2018 17:20:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5B6B2D9B2; Wed, 28 Nov 2018 17:20:01 +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 71C432D9A7 for ; Wed, 28 Nov 2018 17:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729224AbeK2EWE (ORCPT ); Wed, 28 Nov 2018 23:22:04 -0500 Received: from shell.v3.sk ([90.176.6.54]:39096 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729200AbeK2EWD (ORCPT ); Wed, 28 Nov 2018 23:22:03 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 50195983F6; Wed, 28 Nov 2018 18:19:39 +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 Uh99ZI_oSq3F; Wed, 28 Nov 2018 18:19:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id CF1759969F; 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 Zm2HnB_wFnML; 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 169EA996DF; Wed, 28 Nov 2018 18:19:26 +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 3/6] media: ov2659: get rid of extra ifdefs Date: Wed, 28 Nov 2018 18:19:15 +0100 Message-Id: <20181128171918.160643-4-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/ov2659.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c index 799acce803fe..a66c12c8f278 100644 --- a/drivers/media/i2c/ov2659.c +++ b/drivers/media/i2c/ov2659.c @@ -1046,17 +1046,15 @@ static int ov2659_get_fmt(struct v4l2_subdev *sd, dev_dbg(&client->dev, "ov2659_get_fmt\n"); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *mf; mf = v4l2_subdev_get_try_format(sd, cfg, 0); + if (IS_ERR(mf)) + return PTR_ERR(mf); mutex_lock(&ov2659->lock); fmt->format = *mf; mutex_unlock(&ov2659->lock); return 0; -#else - return -ENOTTY; -#endif } mutex_lock(&ov2659->lock); @@ -1126,12 +1124,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, mutex_lock(&ov2659->lock); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); + if (IS_ERR(mf)) + return PTR_ERR(mf); *mf = fmt->format; -#else - return -ENOTTY; -#endif } else { s64 val; From patchwork Wed Nov 28 17:19:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10703027 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 CFCEC14BD for ; Wed, 28 Nov 2018 17:20:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B64022D9A7 for ; Wed, 28 Nov 2018 17:20:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A75DD2D9B3; Wed, 28 Nov 2018 17:20:12 +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 9FD4E2D9A7 for ; Wed, 28 Nov 2018 17:20:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729202AbeK2EWC (ORCPT ); Wed, 28 Nov 2018 23:22:02 -0500 Received: from shell.v3.sk ([90.176.6.54]:39078 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728775AbeK2EWC (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 84B2E996DF; Wed, 28 Nov 2018 18:19:36 +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 YhmkZBNFjByK; Wed, 28 Nov 2018 18:19:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 1DB5D99796; Wed, 28 Nov 2018 18:19:29 +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 v0M1f7Cf_5hq; 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 503F6996E4; Wed, 28 Nov 2018 18:19:26 +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 4/6] media: ov2680: get rid of extra ifdefs Date: Wed, 28 Nov 2018 18:19:16 +0100 Message-Id: <20181128171918.160643-5-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/ov2680.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 0e34e15b67b3..f8b873aaacec 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -680,11 +680,9 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, mutex_lock(&sensor->lock); if (format->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API fmt = v4l2_subdev_get_try_format(&sensor->sd, cfg, format->pad); -#else - ret = -ENOTTY; -#endif + if (IS_ERR(fmt)) + return PTR_ERR(fmt); } else { fmt = &sensor->fmt; } @@ -703,9 +701,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, { struct ov2680_dev *sensor = to_ov2680_dev(sd); struct v4l2_mbus_framefmt *fmt = &format->format; -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *try_fmt; -#endif const struct ov2680_mode_info *mode; int ret = 0; @@ -728,12 +724,11 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, } if (format->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API try_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); - format->format = *try_fmt; -#else - ret = -ENOTTY; -#endif + if (IS_ERR(try_fmt)) + ret = PTR_ERR(try_fmt); + else + format->format = *try_fmt; goto unlock; } From patchwork Wed Nov 28 17:19:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10703019 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 876DC14BD for ; Wed, 28 Nov 2018 17:19:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69BB32D9A7 for ; Wed, 28 Nov 2018 17:19:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AB072D9B2; Wed, 28 Nov 2018 17:19:54 +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 F084A2D9A7 for ; Wed, 28 Nov 2018 17:19:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729262AbeK2EWI (ORCPT ); Wed, 28 Nov 2018 23:22:08 -0500 Received: from shell.v3.sk ([90.176.6.54]:39112 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729251AbeK2EWH (ORCPT ); Wed, 28 Nov 2018 23:22:07 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 412C9996A0; Wed, 28 Nov 2018 18:19:44 +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 HJGPn88B5NSw; Wed, 28 Nov 2018 18:19:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 4AC4B85774; Wed, 28 Nov 2018 18:19:30 +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-bYHvuFz9M8; Wed, 28 Nov 2018 18:19:27 +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 8AA3B996F1; Wed, 28 Nov 2018 18:19:26 +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 5/6] media: ov5695: get rid of extra ifdefs Date: Wed, 28 Nov 2018 18:19:17 +0100 Message-Id: <20181128171918.160643-6-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/ov5695.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c index 5d107c53364d..1469e8b90e1a 100644 --- a/drivers/media/i2c/ov5695.c +++ b/drivers/media/i2c/ov5695.c @@ -810,6 +810,7 @@ static int ov5695_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *fmt) { struct ov5695 *ov5695 = to_ov5695(sd); + struct v4l2_mbus_framefmt *try_fmt; const struct ov5695_mode *mode; s64 h_blank, vblank_def; @@ -821,12 +822,12 @@ static int ov5695_set_fmt(struct v4l2_subdev *sd, fmt->format.height = mode->height; fmt->format.field = V4L2_FIELD_NONE; if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; -#else - mutex_unlock(&ov5695->mutex); - return -ENOTTY; -#endif + try_fmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); + if (IS_ERR(try_fmt)) { + mutex_unlock(&ov5695->mutex); + return PTR_ERR(try_fmt); + } + *try_fmt = fmt->format; } else { ov5695->cur_mode = mode; h_blank = mode->hts_def - mode->width; @@ -845,24 +846,25 @@ static int ov5695_set_fmt(struct v4l2_subdev *sd, static int ov5695_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *fmt) + struct v4l2_subdev_format *format) { struct ov5695 *ov5695 = to_ov5695(sd); + struct v4l2_mbus_framefmt *fmt; const struct ov5695_mode *mode = ov5695->cur_mode; mutex_lock(&ov5695->mutex); - if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API - fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); -#else - mutex_unlock(&ov5695->mutex); - return -ENOTTY; -#endif + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { + fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); + if (IS_ERR(fmt)) { + mutex_unlock(&ov5695->mutex); + return PTR_ERR(fmt); + } + format->format = *fmt; } else { - fmt->format.width = mode->width; - fmt->format.height = mode->height; - fmt->format.code = MEDIA_BUS_FMT_SBGGR10_1X10; - fmt->format.field = V4L2_FIELD_NONE; + format->format.width = mode->width; + format->format.height = mode->height; + format->format.code = MEDIA_BUS_FMT_SBGGR10_1X10; + format->format.field = V4L2_FIELD_NONE; } mutex_unlock(&ov5695->mutex); From patchwork Wed Nov 28 17:19:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10703021 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 07283109C for ; Wed, 28 Nov 2018 17:19:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E310A2D9A7 for ; Wed, 28 Nov 2018 17:19:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D76172D9B2; Wed, 28 Nov 2018 17:19:56 +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 B2D652D9A7 for ; Wed, 28 Nov 2018 17:19:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729249AbeK2EWF (ORCPT ); Wed, 28 Nov 2018 23:22:05 -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 S1728775AbeK2EWE (ORCPT ); Wed, 28 Nov 2018 23:22:04 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 508A99969F; Wed, 28 Nov 2018 18:19:42 +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 yys5QUCXtdQJ; Wed, 28 Nov 2018 18:19:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 9119A996BC; Wed, 28 Nov 2018 18:19:30 +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 MuZ_fI_V2dBb; Wed, 28 Nov 2018 18:19:28 +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 C434B99789; Wed, 28 Nov 2018 18:19:26 +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 6/6] media: ov7670: get rid of extra ifdefs Date: Wed, 28 Nov 2018 18:19:18 +0100 Message-Id: <20181128171918.160643-7-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/ov7670.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c index bc68a3a5b4ec..7d1fdf51bd91 100644 --- a/drivers/media/i2c/ov7670.c +++ b/drivers/media/i2c/ov7670.c @@ -1013,9 +1013,7 @@ static int ov7670_set_fmt(struct v4l2_subdev *sd, struct ov7670_format_struct *ovfmt; struct ov7670_win_size *wsize; struct ov7670_info *info = to_state(sd); -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *mbus_fmt; -#endif unsigned char com7, com10 = 0; int ret; @@ -1026,13 +1024,11 @@ static int ov7670_set_fmt(struct v4l2_subdev *sd, ret = ov7670_try_fmt_internal(sd, &format->format, NULL, NULL); if (ret) return ret; -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); + if (IS_ERR(mbus_fmt)) + return PTR_ERR(mbus_fmt); *mbus_fmt = format->format; return 0; -#else - return -ENOTTY; -#endif } ret = ov7670_try_fmt_internal(sd, &format->format, &ovfmt, &wsize); @@ -1105,18 +1101,14 @@ static int ov7670_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) { struct ov7670_info *info = to_state(sd); -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *mbus_fmt; -#endif if (format->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); + if (IS_ERR(mbus_fmt)) + return PTR_ERR(mbus_fmt); format->format = *mbus_fmt; return 0; -#else - return -ENOTTY; -#endif } else { format->format = info->format; }