Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1622255
| Path | csiph.com!2.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news.szaf.org!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Lee Jones <lee.jones@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/2] [media] rc-core: Add inlined stubs for core rc_* functions |
| Date | Wed, 12 Apr 2017 17:50:01 +0200 |
| Message-ID | <tvsGR-6f3-3@gated-at.bofh.it> (permalink) |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=zP/FCmfAPEjGvhxKfCM/diDVPdlmpLtz1x4mGXEdsTs=; b=ZiUdxMtmh/Vb7VgtoGOVTvhJPHtx/2lP29HXj+8NduOa9XX8LMwevBpoKFCqXK6foy 6MBQDX6LsuSquczLepIvptPWhXvJIB4Cxs+hoW02E4Zugkfr5eO+KmKjnu1tc2JjIQ0v dRPKiR+eZEbBcAbx2iW+iYM1kD7PmOlapQp/A= |
| 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=zP/FCmfAPEjGvhxKfCM/diDVPdlmpLtz1x4mGXEdsTs=; b=FqLU1EnMnot7j5KOVHD/9LI35e9NvRcigsnKOzTGOsP1KRaLv9XeExjML4T3THyQEk /jzVAvgS3WmjHyt52PyuiRjIF0vKRoN5krjDVLU8JDMKVD4Q+b+uhVQ+bRVg4DHNgowu Z3a0d+WaRI+5z751D0F+Y0WXMebR/YajVR9TmbQw+8h/JQ2vnPZR0oXdwaHkUg3Gd2w9 CEduSRO2FF4LnWCowqyPR3h3+LRcUCAcK10ckjbsismPxKph1UHxoBJacGgUAyYAdiQU 7NUjapeSNxjQTZNopRb60BAYp1Y3JwX2NU4z3b8aXRVLqwG32gyQrX+7+V392iX+WCbZ EunQ== |
| X-Gm-Message-State | AN3rC/4A80zlCcxYKfHfvTpp3b5PkMBRoGqF53eQ0yfs3OocTrdqWAno 11J0a3SWIL2IYKS5 |
| X-Received | by 10.28.146.207 with SMTP id u198mr20143556wmd.103.1492011601615; Wed, 12 Apr 2017 08:40:01 -0700 (PDT) |
| X-Mailer | git-send-email 2.9.3 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 110 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, patrice.chotard@st.com, linux@armlinux.org.uk, Lee Jones <lee.jones@linaro.org> |
| X-Original-Date | Wed, 12 Apr 2017 16:39:55 +0100 |
| X-Original-Message-ID | <20170412153956.13329-1-lee.jones@linaro.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1622255 |
Show key headers only | View raw
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 <lee.jones@linaro.org>
---
v1 => v2
- Use '#if IF_ENABLED()' instead of '#ifdef' in order to do the
right thing, even when CONFIG_RC_CORE=m.
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..f176a9e 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.
*/
+#if IS_ENABLED(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.
*/
+#if IS_ENABLED(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.
*/
+#if IS_ENABLED(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.
*/
+#if IS_ENABLED(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.
*/
+#if IS_ENABLED(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.
*/
+#if IS_ENABLED(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
--
2.9.3
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v2 1/2] [media] rc-core: Add inlined stubs for core rc_* functions Lee Jones <lee.jones@linaro.org> - 2017-04-12 17:50 +0200
csiph-web