blob: b168a924fce2ecd808941f86588dec29b7c7db12 [file] [log] [blame]
From foo@baz Fri Jan 10 14:47:34 PST 2014
From: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
Date: Tue, 7 Jan 2014 15:48:09 +0900
Subject: [PATCH] of: remove #ifdef from linux/of_platform.h
To: ltsi-dev@lists.linuxfoundation.org
Cc: gregkh@linuxfoundation.org, michal.simek@xilinx.com
Message-ID: <1389077290-13613-2-git-send-email-daniel.sangorrin@toshiba.co.jp>
From: Arnd Bergmann <arnd@arndb.de>
A lot of code uses the functions from of_platform.h when built for
devicetree-enabled platforms but can also be built without them.
In order to avoid using #ifdef everywhere in drivers, this
makes all the function declarations visible, which means we
can use "if (IS_ENABLED(CONFIG_OF))" in driver code and get build
coverage over the code but let the compiler drop the reference
in the object code.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
(cherry picked from commit 8a46f4f7f95f2bece108998a2e1b87b58f99d590)
Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
Signed-off-by: Yoshitake Kobayashi <yoshitake.kobayashi@toshiba.co.jp>
---
include/linux/of_platform.h | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -13,8 +13,6 @@
#include <linux/device.h>
#include <linux/mod_devicetable.h>
-
-#ifdef CONFIG_OF_DEVICE
#include <linux/pm.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
@@ -82,7 +80,6 @@ extern struct platform_device *of_device
struct device *parent);
extern struct platform_device *of_find_device_by_node(struct device_node *np);
-#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */
/* Platform devices and busses creation */
extern struct platform_device *of_platform_device_create(struct device_node *np,
const char *bus_id,
@@ -91,17 +88,12 @@ extern struct platform_device *of_platfo
extern int of_platform_bus_probe(struct device_node *root,
const struct of_device_id *matches,
struct device *parent);
+#ifdef CONFIG_OF_ADDRESS
extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
struct device *parent);
-#endif /* CONFIG_OF_ADDRESS */
-
-#endif /* CONFIG_OF_DEVICE */
-
-#if !defined(CONFIG_OF_ADDRESS)
-struct of_dev_auxdata;
-struct device_node;
+#else
static inline int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
@@ -109,6 +101,6 @@ static inline int of_platform_populate(s
{
return -ENODEV;
}
-#endif /* !CONFIG_OF_ADDRESS */
+#endif
#endif /* _LINUX_OF_PLATFORM_H */