From patchwork Tue Jan 29 16:07:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 10786539 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 599176C2 for ; Tue, 29 Jan 2019 16:08:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49AAF2D199 for ; Tue, 29 Jan 2019 16:08:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C1DA2D2DA; Tue, 29 Jan 2019 16:08:20 +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 D051B2D199 for ; Tue, 29 Jan 2019 16:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727786AbfA2QIR (ORCPT ); Tue, 29 Jan 2019 11:08:17 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:46931 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727100AbfA2QIR (ORCPT ); Tue, 29 Jan 2019 11:08:17 -0500 Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28] helo=dude02.lab.pengutronix.de) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1goVvk-0007VO-Pk; Tue, 29 Jan 2019 17:08:08 +0100 Received: from mfe by dude02.lab.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1goVvj-0000dn-EK; Tue, 29 Jan 2019 17:08:07 +0100 From: Marco Felsch To: mchehab@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, sakari.ailus@linux.intel.com Cc: devicetree@vger.kernel.org, p.zabel@pengutronix.de, javierm@redhat.com, afshin.nasser@gmail.com, laurent.pinchart@ideasonboard.com, linux-media@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v4 4/7] media: v4l2-subdev: add stubs for v4l2_subdev_get_try_* Date: Tue, 29 Jan 2019 17:07:54 +0100 Message-Id: <20190129160757.2314-5-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129160757.2314-1-m.felsch@pengutronix.de> References: <20190129160757.2314-1-m.felsch@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org 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 In case of missing CONFIG_VIDEO_V4L2_SUBDEV_API those helpers aren't available. So each driver have to add ifdefs around those helpers or add the CONFIG_VIDEO_V4L2_SUBDEV_API as dependcy. Make these helpers available in case of CONFIG_VIDEO_V4L2_SUBDEV_API isn't set to avoid ifdefs. This approach is less error prone too. Signed-off-by: Marco Felsch --- include/media/v4l2-subdev.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 47af609dc8f1..90c9a301d72a 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -916,8 +916,6 @@ struct v4l2_subdev_fh { #define to_v4l2_subdev_fh(fh) \ container_of(fh, struct v4l2_subdev_fh, vfh) -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) - /** * v4l2_subdev_get_try_format - ancillary routine to call * &struct v4l2_subdev_pad_config->try_fmt @@ -931,9 +929,13 @@ static inline struct v4l2_mbus_framefmt struct v4l2_subdev_pad_config *cfg, unsigned int pad) { +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &cfg[pad].try_fmt; +#else + return NULL; +#endif } /** @@ -949,9 +951,13 @@ static inline struct v4l2_rect struct v4l2_subdev_pad_config *cfg, unsigned int pad) { +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &cfg[pad].try_crop; +#else + return NULL; +#endif } /** @@ -967,11 +973,14 @@ static inline struct v4l2_rect struct v4l2_subdev_pad_config *cfg, unsigned int pad) { +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &cfg[pad].try_compose; -} +#else + return NULL; #endif +} extern const struct v4l2_file_operations v4l2_subdev_fops;