diff options
| author | Rob Herring <robh@kernel.org> | 2017-07-05 09:31:52 -0400 |
|---|---|---|
| committer | Rob Herring <robh@kernel.org> | 2017-07-05 09:31:52 -0400 |
| commit | a4485b545e2fad4d65732cb7c60089bf4246de5c (patch) | |
| tree | 452caf921257d924d9d7b2b1efbf6f80a03d6a52 /include/linux | |
| parent | 5e1743c0af9d5179cf575c0bc2777af02a79b911 (diff) | |
| parent | b8ba92b101e82b82a5359dc2dfbd772eb46780d4 (diff) | |
Merge branch 'dt/property-move' into dt/next
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/of.h | 30 | ||||
| -rw-r--r-- | include/linux/of_graph.h | 21 |
2 files changed, 41 insertions, 10 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index c72ba9437a43..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 | } |
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index abdb02eaef06..3e058f05ab04 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h | |||
| @@ -43,11 +43,15 @@ struct of_endpoint { | |||
| 43 | #ifdef CONFIG_OF | 43 | #ifdef CONFIG_OF |
| 44 | int of_graph_parse_endpoint(const struct device_node *node, | 44 | int of_graph_parse_endpoint(const struct device_node *node, |
| 45 | struct of_endpoint *endpoint); | 45 | struct of_endpoint *endpoint); |
| 46 | int of_graph_get_endpoint_count(const struct device_node *np); | ||
| 46 | struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); | 47 | struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); |
| 47 | struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, | 48 | struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, |
| 48 | struct device_node *previous); | 49 | struct device_node *previous); |
| 49 | struct device_node *of_graph_get_endpoint_by_regs( | 50 | struct device_node *of_graph_get_endpoint_by_regs( |
| 50 | const struct device_node *parent, int port_reg, int reg); | 51 | const struct device_node *parent, int port_reg, int reg); |
| 52 | struct device_node *of_graph_get_remote_endpoint( | ||
| 53 | const struct device_node *node); | ||
| 54 | struct device_node *of_graph_get_port_parent(struct device_node *node); | ||
| 51 | struct device_node *of_graph_get_remote_port_parent( | 55 | struct device_node *of_graph_get_remote_port_parent( |
| 52 | const struct device_node *node); | 56 | const struct device_node *node); |
| 53 | struct device_node *of_graph_get_remote_port(const struct device_node *node); | 57 | struct device_node *of_graph_get_remote_port(const struct device_node *node); |
| @@ -61,6 +65,11 @@ static inline int of_graph_parse_endpoint(const struct device_node *node, | |||
| 61 | return -ENOSYS; | 65 | return -ENOSYS; |
| 62 | } | 66 | } |
| 63 | 67 | ||
| 68 | static inline int of_graph_get_endpoint_count(const struct device_node *np) | ||
| 69 | { | ||
| 70 | return 0; | ||
| 71 | } | ||
| 72 | |||
| 64 | static inline struct device_node *of_graph_get_port_by_id( | 73 | static inline struct device_node *of_graph_get_port_by_id( |
| 65 | struct device_node *node, u32 id) | 74 | struct device_node *node, u32 id) |
| 66 | { | 75 | { |
| @@ -80,6 +89,18 @@ static inline struct device_node *of_graph_get_endpoint_by_regs( | |||
| 80 | return NULL; | 89 | return NULL; |
| 81 | } | 90 | } |
| 82 | 91 | ||
| 92 | static inline struct device_node *of_graph_get_remote_endpoint( | ||
| 93 | const struct device_node *node) | ||
| 94 | { | ||
| 95 | return NULL; | ||
| 96 | } | ||
| 97 | |||
| 98 | static inline struct device_node *of_graph_get_port_parent( | ||
| 99 | struct device_node *node) | ||
| 100 | { | ||
| 101 | return NULL; | ||
| 102 | } | ||
| 103 | |||
| 83 | static inline struct device_node *of_graph_get_remote_port_parent( | 104 | static inline struct device_node *of_graph_get_remote_port_parent( |
| 84 | const struct device_node *node) | 105 | const struct device_node *node) |
| 85 | { | 106 | { |
