From patchwork Tue Apr 11 11:12:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 97239 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1756177qgd; Tue, 11 Apr 2017 04:13:03 -0700 (PDT) X-Received: by 10.99.97.147 with SMTP id v141mr61829282pgb.98.1491909183227; Tue, 11 Apr 2017 04:13:03 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si16485559plv.310.2017.04.11.04.13.02; Tue, 11 Apr 2017 04:13:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753671AbdDKLM7 (ORCPT + 23 others); Tue, 11 Apr 2017 07:12:59 -0400 Received: from mail-wr0-f178.google.com ([209.85.128.178]:36790 "EHLO mail-wr0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753235AbdDKLM5 (ORCPT ); Tue, 11 Apr 2017 07:12:57 -0400 Received: by mail-wr0-f178.google.com with SMTP id c55so92919665wrc.3 for ; Tue, 11 Apr 2017 04:12:57 -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=ZmSTJvk2dl5H5jOuV+FrFnbB9ExanM3ry1jXY6fGt0lpjc0ZfStHPvKtsg6yhV4A6v aeYykxexFAuKo1JZYfN0fvyWMJ6fxBHgSsUWn3lPqjHpYZjvXRt4ky+Tds2AV17UJ1Wd nUt0ZZVnSrd/PPOU2009HP2AtjwXURTRE03V4= 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=tnsOl9iMtND8lQbFfMwPvfOCZNkEKGX07SLQoDOqZ3AjDM2A9Ll2cbLlOjMaC95fjG /QL1FNA9iQv4RqxxcKFr+ZlRVA7PBXEPutlvZY3d8n8Y3oh5XwF6YEfdzXxJEs5l/EzK lXaGwHIBsj380i7PHog2SX8owkyaB83zBAKb6l4Iir073PhOhVFV9OwXvX8vuMxzt3Os WJvp+GFCGoebZiRxw3eJi5ER75Y5rvEo4e7gQVYrbTlWjquGIurT8ibXL7+H00OdsLVP UoWPQj/XzsD5C5aKZkECIfhAHO6Cqes+LyMRfzf90Y6J0yJ5z0pvdZG4UERzpZne7XCa +jtA== X-Gm-Message-State: AFeK/H3bdmUy41WrFyYpzDOaox5+KQSC+ecDfRCtgRbe1jhcIX3w2D5p/HuYVLVElW29zmQ5 X-Received: by 10.223.174.241 with SMTP id y104mr56296033wrc.79.1491909176227; Tue, 11 Apr 2017 04:12:56 -0700 (PDT) Received: from localhost.localdomain ([2.31.167.174]) by smtp.gmail.com with ESMTPSA id j138sm2069526wmg.10.2017.04.11.04.12.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 04:12:55 -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, patrice.chotard@st.com, linux@armlinux.org.uk, Lee Jones Subject: [RESEND 1/2] [media] rc-core: Add inlined stubs for core rc_* functions Date: Tue, 11 Apr 2017 12:12:43 +0100 Message-Id: <20170411111244.29599-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.9.3 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