diff options
author | Dave Airlie <airlied@redhat.com> | 2015-04-13 03:28:16 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-04-13 03:28:16 -0400 |
commit | bb1dc08c94ead1b98e750caf535422f79363c1a2 (patch) | |
tree | 8e1db4d7b2de470223c7a98aca3e2f47d6d5ed83 /include/linux/of_graph.h | |
parent | a7d6883619584c2dbeeb5f6a1cf86cde6a3993de (diff) | |
parent | ecaa4902222fd4d28692203bec028513fbac29c7 (diff) |
Merge tag 'of-graph-drm-2015-04-08' of git://git.pengutronix.de/git/pza/linux into drm-next
drm: Use of-graph helpers to loop over endpoints
Convert all drm callers that use of_graph_get_next_endpoint to loop over
of-graph endpoints to the newly introduced for_each_endpoint_of_node
helper macro.
* tag 'of-graph-drm-2015-04-08' of git://git.pengutronix.de/git/pza/linux:
drm/rockchip: use for_each_endpoint_of_node macro, drop endpoint reference on break
drm/rcar-du: use for_each_endpoint_of_node macro
drm/imx: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id
drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs
of: Explicitly include linux/types.h in of_graph.h
dt-bindings: brcm: rationalize Broadcom documentation naming
of/unittest: replace 'selftest' with 'unittest'
Documentation: rename of_selftest.txt to of_unittest.txt
Documentation: update the of_selftest.txt
dt: OF_UNITTEST make dependency broken
MAINTAINERS: Pantelis Antoniou device tree overlay maintainer
of: Add of_graph_get_port_by_id function
of: Add for_each_endpoint_of_node helper macro
of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint
Diffstat (limited to 'include/linux/of_graph.h')
-rw-r--r-- | include/linux/of_graph.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index befef42e015b..7bc92e050608 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h | |||
@@ -14,6 +14,8 @@ | |||
14 | #ifndef __LINUX_OF_GRAPH_H | 14 | #ifndef __LINUX_OF_GRAPH_H |
15 | #define __LINUX_OF_GRAPH_H | 15 | #define __LINUX_OF_GRAPH_H |
16 | 16 | ||
17 | #include <linux/types.h> | ||
18 | |||
17 | /** | 19 | /** |
18 | * struct of_endpoint - the OF graph endpoint data structure | 20 | * struct of_endpoint - the OF graph endpoint data structure |
19 | * @port: identifier (value of reg property) of a port this endpoint belongs to | 21 | * @port: identifier (value of reg property) of a port this endpoint belongs to |
@@ -26,9 +28,21 @@ struct of_endpoint { | |||
26 | const struct device_node *local_node; | 28 | const struct device_node *local_node; |
27 | }; | 29 | }; |
28 | 30 | ||
31 | /** | ||
32 | * for_each_endpoint_of_node - iterate over every endpoint in a device node | ||
33 | * @parent: parent device node containing ports and endpoints | ||
34 | * @child: loop variable pointing to the current endpoint node | ||
35 | * | ||
36 | * When breaking out of the loop, of_node_put(child) has to be called manually. | ||
37 | */ | ||
38 | #define for_each_endpoint_of_node(parent, child) \ | ||
39 | for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \ | ||
40 | child = of_graph_get_next_endpoint(parent, child)) | ||
41 | |||
29 | #ifdef CONFIG_OF | 42 | #ifdef CONFIG_OF |
30 | int of_graph_parse_endpoint(const struct device_node *node, | 43 | int of_graph_parse_endpoint(const struct device_node *node, |
31 | struct of_endpoint *endpoint); | 44 | struct of_endpoint *endpoint); |
45 | struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); | ||
32 | struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, | 46 | struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, |
33 | struct device_node *previous); | 47 | struct device_node *previous); |
34 | struct device_node *of_graph_get_remote_port_parent( | 48 | struct device_node *of_graph_get_remote_port_parent( |
@@ -42,6 +56,12 @@ static inline int of_graph_parse_endpoint(const struct device_node *node, | |||
42 | return -ENOSYS; | 56 | return -ENOSYS; |
43 | } | 57 | } |
44 | 58 | ||
59 | static inline struct device_node *of_graph_get_port_by_id( | ||
60 | struct device_node *node, u32 id) | ||
61 | { | ||
62 | return NULL; | ||
63 | } | ||
64 | |||
45 | static inline struct device_node *of_graph_get_next_endpoint( | 65 | static inline struct device_node *of_graph_get_next_endpoint( |
46 | const struct device_node *parent, | 66 | const struct device_node *parent, |
47 | struct device_node *previous) | 67 | struct device_node *previous) |