diff options
Diffstat (limited to 'include/linux/of.h')
| -rw-r--r-- | include/linux/of.h | 36 |
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 |
| 149 | void of_core_init(void); | 149 | void of_core_init(void); |
| 150 | 150 | ||
| 151 | static inline bool is_of_node(struct fwnode_handle *fwnode) | 151 | static 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 | ||
| 156 | static 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 | ||
| 164 | static inline bool of_have_populated_dt(void) | 174 | static 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 | ||
| 536 | static inline bool is_of_node(struct fwnode_handle *fwnode) | 546 | static inline bool is_of_node(const struct fwnode_handle *fwnode) |
| 537 | { | 547 | { |
| 538 | return false; | 548 | return false; |
| 539 | } | 549 | } |
| 540 | 550 | ||
| 541 | static inline struct device_node *to_of_node(struct fwnode_handle *fwnode) | 551 | static 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 | ||
| 640 | static inline int of_device_compatible_match(struct device_node *device, | ||
| 641 | const char *const *compat) | ||
| 642 | { | ||
| 643 | return 0; | ||
| 644 | } | ||
| 645 | |||
| 630 | static inline bool of_device_is_available(const struct device_node *device) | 646 | static inline bool of_device_is_available(const struct device_node *device) |
| 631 | { | 647 | { |
| 632 | return false; | 648 | return false; |
