aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h36
1 files changed, 26 insertions, 10 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 50fcdb54087f..fa089a2789a0 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -148,18 +148,28 @@ extern raw_spinlock_t devtree_lock;
148#ifdef CONFIG_OF 148#ifdef CONFIG_OF
149void of_core_init(void); 149void of_core_init(void);
150 150
151static inline bool is_of_node(struct fwnode_handle *fwnode) 151static inline bool is_of_node(const struct fwnode_handle *fwnode)
152{ 152{
153 return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_OF; 153 return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_OF;
154} 154}
155 155
156static inline struct device_node *to_of_node(struct fwnode_handle *fwnode) 156#define to_of_node(__fwnode) \
157{ 157 ({ \
158 return is_of_node(fwnode) ? 158 typeof(__fwnode) __to_of_node_fwnode = (__fwnode); \
159 container_of(fwnode, struct device_node, fwnode) : NULL; 159 \
160} 160 is_of_node(__to_of_node_fwnode) ? \
161 161 container_of(__to_of_node_fwnode, \
162#define of_fwnode_handle(node) (&(node)->fwnode) 162 struct device_node, fwnode) : \
163 NULL; \
164 })
165
166#define of_fwnode_handle(node) \
167 ({ \
168 typeof(node) __of_fwnode_handle_node = (node); \
169 \
170 __of_fwnode_handle_node ? \
171 &__of_fwnode_handle_node->fwnode : NULL; \
172 })
163 173
164static inline bool of_have_populated_dt(void) 174static inline bool of_have_populated_dt(void)
165{ 175{
@@ -533,12 +543,12 @@ static inline void of_core_init(void)
533{ 543{
534} 544}
535 545
536static inline bool is_of_node(struct fwnode_handle *fwnode) 546static inline bool is_of_node(const struct fwnode_handle *fwnode)
537{ 547{
538 return false; 548 return false;
539} 549}
540 550
541static inline struct device_node *to_of_node(struct fwnode_handle *fwnode) 551static inline struct device_node *to_of_node(const struct fwnode_handle *fwnode)
542{ 552{
543 return NULL; 553 return NULL;
544} 554}
@@ -627,6 +637,12 @@ static inline int of_device_is_compatible(const struct device_node *device,
627 return 0; 637 return 0;
628} 638}
629 639
640static inline int of_device_compatible_match(struct device_node *device,
641 const char *const *compat)
642{
643 return 0;
644}
645
630static inline bool of_device_is_available(const struct device_node *device) 646static inline bool of_device_is_available(const struct device_node *device)
631{ 647{
632 return false; 648 return false;