summaryrefslogtreecommitdiff
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2019-03-28 10:47:24 -0300
committerGitHub <noreply@github.com>2019-03-28 10:47:24 -0300
commit0a8ab17689e628c84a666195bfc6ab85d11cf057 (patch)
tree01630dc4a6935df99bf7d11d34ff8d384fed86e2 /include/linux/of.h
parent1e71d8c630cbc0d1f5d762fd019690b5cdb880ae (diff)
parent32aca03c2ce868d3412da0bb6ce6798c7bea357e (diff)
Merge pull request #46 from toradex/4.9-2.3.x-imx
4.9 2.3.x imx
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 15338b45ea22..5c5ace1de7d9 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -148,16 +148,20 @@ extern raw_spinlock_t devtree_lock;
#ifdef CONFIG_OF
void of_core_init(void);
-static inline bool is_of_node(struct fwnode_handle *fwnode)
+static inline bool is_of_node(const struct fwnode_handle *fwnode)
{
return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_OF;
}
-static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
-{
- return is_of_node(fwnode) ?
- container_of(fwnode, struct device_node, fwnode) : NULL;
-}
+#define to_of_node(__fwnode) \
+ ({ \
+ typeof(__fwnode) __to_of_node_fwnode = (__fwnode); \
+ \
+ is_of_node(__to_of_node_fwnode) ? \
+ container_of(__to_of_node_fwnode, \
+ struct device_node, fwnode) : \
+ NULL; \
+ })
static inline bool of_have_populated_dt(void)
{
@@ -530,12 +534,12 @@ static inline void of_core_init(void)
{
}
-static inline bool is_of_node(struct fwnode_handle *fwnode)
+static inline bool is_of_node(const struct fwnode_handle *fwnode)
{
return false;
}
-static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
+static inline struct device_node *to_of_node(const struct fwnode_handle *fwnode)
{
return NULL;
}