diff options
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 4948552d60f5..a75a831e2057 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -65,6 +65,27 @@ struct device_node { | |||
65 | #endif | 65 | #endif |
66 | }; | 66 | }; |
67 | 67 | ||
68 | #define MAX_PHANDLE_ARGS 8 | ||
69 | struct of_phandle_args { | ||
70 | struct device_node *np; | ||
71 | int args_count; | ||
72 | uint32_t args[MAX_PHANDLE_ARGS]; | ||
73 | }; | ||
74 | |||
75 | #if defined(CONFIG_SPARC) || !defined(CONFIG_OF) | ||
76 | /* Dummy ref counting routines - to be implemented later */ | ||
77 | static inline struct device_node *of_node_get(struct device_node *node) | ||
78 | { | ||
79 | return node; | ||
80 | } | ||
81 | static inline void of_node_put(struct device_node *node) | ||
82 | { | ||
83 | } | ||
84 | #else | ||
85 | extern struct device_node *of_node_get(struct device_node *node); | ||
86 | extern void of_node_put(struct device_node *node); | ||
87 | #endif | ||
88 | |||
68 | #ifdef CONFIG_OF | 89 | #ifdef CONFIG_OF |
69 | 90 | ||
70 | /* Pointer for first entry in chain of all nodes. */ | 91 | /* Pointer for first entry in chain of all nodes. */ |
@@ -95,21 +116,6 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag) | |||
95 | 116 | ||
96 | extern struct device_node *of_find_all_nodes(struct device_node *prev); | 117 | extern struct device_node *of_find_all_nodes(struct device_node *prev); |
97 | 118 | ||
98 | #if defined(CONFIG_SPARC) | ||
99 | /* Dummy ref counting routines - to be implemented later */ | ||
100 | static inline struct device_node *of_node_get(struct device_node *node) | ||
101 | { | ||
102 | return node; | ||
103 | } | ||
104 | static inline void of_node_put(struct device_node *node) | ||
105 | { | ||
106 | } | ||
107 | |||
108 | #else | ||
109 | extern struct device_node *of_node_get(struct device_node *node); | ||
110 | extern void of_node_put(struct device_node *node); | ||
111 | #endif | ||
112 | |||
113 | /* | 119 | /* |
114 | * OF address retrieval & translation | 120 | * OF address retrieval & translation |
115 | */ | 121 | */ |
@@ -219,8 +225,8 @@ extern int of_device_is_available(const struct device_node *device); | |||
219 | extern const void *of_get_property(const struct device_node *node, | 225 | extern const void *of_get_property(const struct device_node *node, |
220 | const char *name, | 226 | const char *name, |
221 | int *lenp); | 227 | int *lenp); |
222 | #define for_each_property(pp, properties) \ | 228 | #define for_each_property_of_node(dn, pp) \ |
223 | for (pp = properties; pp != NULL; pp = pp->next) | 229 | for (pp = dn->properties; pp != NULL; pp = pp->next) |
224 | 230 | ||
225 | extern int of_n_addr_cells(struct device_node *np); | 231 | extern int of_n_addr_cells(struct device_node *np); |
226 | extern int of_n_size_cells(struct device_node *np); | 232 | extern int of_n_size_cells(struct device_node *np); |
@@ -230,9 +236,9 @@ extern int of_modalias_node(struct device_node *node, char *modalias, int len); | |||
230 | extern struct device_node *of_parse_phandle(struct device_node *np, | 236 | extern struct device_node *of_parse_phandle(struct device_node *np, |
231 | const char *phandle_name, | 237 | const char *phandle_name, |
232 | int index); | 238 | int index); |
233 | extern int of_parse_phandles_with_args(struct device_node *np, | 239 | extern int of_parse_phandle_with_args(struct device_node *np, |
234 | const char *list_name, const char *cells_name, int index, | 240 | const char *list_name, const char *cells_name, int index, |
235 | struct device_node **out_node, const void **out_args); | 241 | struct of_phandle_args *out_args); |
236 | 242 | ||
237 | extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); | 243 | extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); |
238 | extern int of_alias_get_id(struct device_node *np, const char *stem); | 244 | extern int of_alias_get_id(struct device_node *np, const char *stem); |