From patchwork Wed Apr 5 10:37:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 9663735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 099666021C for ; Wed, 5 Apr 2017 10:41:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15A5E285A3 for ; Wed, 5 Apr 2017 10:41:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08FFD285A4; Wed, 5 Apr 2017 10:41:32 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable 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 985EA2859A for ; Wed, 5 Apr 2017 10:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933519AbdDEKiw (ORCPT ); Wed, 5 Apr 2017 06:38:52 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:35144 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933161AbdDEKh7 (ORCPT ); Wed, 5 Apr 2017 06:37:59 -0400 Received: by mail-wr0-f179.google.com with SMTP id k6so7764786wre.2 for ; Wed, 05 Apr 2017 03:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=gFRwKOWkruLyGP5Uv9NUu9OO+9gGbysW7etyjN2G0Hs=; b=ZGlliXANg4FC2jWK0zULuerbADyieog/4P/pCQeea5EaDbRgpRQgJHSBy6BWZzrXU1 zUhZnL4s+VTVYlatZm56O6XZlKDT+JaYHPeNj8xf9vYXN3GAPV5LZ0C6DAKw6VMAYKvO JMeOFce7rABbirQwvGcYXvDB3XVcOb59RPePM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=gFRwKOWkruLyGP5Uv9NUu9OO+9gGbysW7etyjN2G0Hs=; b=VIUWlTTCKbcjzgElrw8SC8liUTXRKG8F6mUa5W4qbvd2iB2QiHfu6Ae69i4qNLlrKK b8cLq8h3M0GUCAZe1nzc4wiupbAf/FLC270VA3fqOfbgiXpro+VB/scLWdI+ahCafqKo bEApuHXQFjiMCyvkXP6fb/z3gC/klza1mfZF9Sfc7Ugf79TidPMYLBh0LzBXD99tHPpW GgMLZLEvAoyqa3F0ZOnz1gR8KopCzqSSCwAIFyHeXsmVk8ZC7MbgRearb9mSCjKikQ/z zLZf1Gf2gSPzwwhXMgIDY9gAmGOUm+ufnCSJS52yfRGp1ulooIcy1olAtFzD8z6Kb5Iw LrNw== X-Gm-Message-State: AFeK/H3JAPFUxIyn4+QDziWM52zhmL23wYNcMSbZo6WgrKv5VDgQ2GNU qi46tIi9D0SzF0T/R4RsSA== X-Received: by 10.28.73.197 with SMTP id w188mr18679965wma.46.1491388678213; Wed, 05 Apr 2017 03:37:58 -0700 (PDT) Received: from localhost.localdomain ([2.31.167.174]) by smtp.gmail.com with ESMTPSA id 189sm21882284wmm.31.2017.04.05.03.37.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 03:37:57 -0700 (PDT) From: Lee Jones To: hans.verkuil@cisco.com, mchehab@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, patrice.chotard@st.com, linux-media@vger.kernel.org, benjamin.gaignard@st.com, linux@armlinux.org.uk, Lee Jones Subject: [PATCH 1/2] [media] rc-core: Add inlined stubs for core rc_* functions Date: Wed, 5 Apr 2017 11:37:51 +0100 Message-Id: <20170405103752.2057-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.9.3 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 Currently users have to use all sorts of ugly #ifery within their drivers in order to avoid linking issues at build time. This patch allows users to safely call these functions when !CONFIG_RC_CORE and make decisions based on the return value instead. This is a much more common and clean way of doing things within the Linux kernel. Signed-off-by: Lee Jones --- include/media/rc-core.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 73ddd721..45ba739 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -209,7 +209,14 @@ struct rc_dev { * @rc_driver_type: specifies the type of the RC output to be allocated * returns a pointer to struct rc_dev. */ +#ifdef CONFIG_RC_CORE struct rc_dev *rc_allocate_device(enum rc_driver_type); +#else +static inline struct rc_dev *rc_allocate_device(int unused) +{ + return NULL; +} +#endif /** * devm_rc_allocate_device - Managed RC device allocation @@ -218,21 +225,42 @@ struct rc_dev *rc_allocate_device(enum rc_driver_type); * @rc_driver_type: specifies the type of the RC output to be allocated * returns a pointer to struct rc_dev. */ +#ifdef CONFIG_RC_CORE struct rc_dev *devm_rc_allocate_device(struct device *dev, enum rc_driver_type); +#else +static inline struct rc_dev *devm_rc_allocate_device(struct device *dev, int unused) +{ + return NULL; +} +#endif /** * rc_free_device - Frees a RC device * * @dev: pointer to struct rc_dev. */ +#ifdef CONFIG_RC_CORE void rc_free_device(struct rc_dev *dev); +#else +static inline void rc_free_device(struct rc_dev *dev) +{ + return; +} +#endif /** * rc_register_device - Registers a RC device * * @dev: pointer to struct rc_dev. */ +#ifdef CONFIG_RC_CORE int rc_register_device(struct rc_dev *dev); +#else +static inline int rc_register_device(struct rc_dev *dev) +{ + return -EOPNOTSUPP; +} +#endif /** * devm_rc_register_device - Manageded registering of a RC device @@ -240,14 +268,28 @@ int rc_register_device(struct rc_dev *dev); * @parent: pointer to struct device. * @dev: pointer to struct rc_dev. */ +#ifdef CONFIG_RC_CORE int devm_rc_register_device(struct device *parent, struct rc_dev *dev); +#else +static inline int devm_rc_register_device(struct device *parent, struct rc_dev *dev) +{ + return -EOPNOTSUPP; +} +#endif /** * rc_unregister_device - Unregisters a RC device * * @dev: pointer to struct rc_dev. */ +#ifdef CONFIG_RC_CORE void rc_unregister_device(struct rc_dev *dev); +#else +static inline void rc_unregister_device(struct rc_dev *dev) +{ + return; +} +#endif /** * rc_open - Opens a RC device