diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-12-12 11:25:57 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-12-12 15:40:16 -0500 |
commit | 15c9a0acc3f7873db4b7d35d016729b2dc229b49 (patch) | |
tree | cfd9d6dd645d8116709521001e90dd75ffc19992 /include/linux/of.h | |
parent | 1a2d397a6eb5cf40c382d9e3d4bc04aaeb025336 (diff) |
of: create of_phandle_args to simplify return of phandle parsing data
of_parse_phandle_with_args() needs to return quite a bit of data. Rather
than making each datum a separate **out_ argument, this patch creates
struct of_phandle_args to contain all the returned data and reworks the
user of the function. This patch also enables of_parse_phandle_with_args()
to return the device node pointer for the phandle node.
This patch also ends up being fairly major surgery to
of_parse_handle_with_args(). The existing structure didn't work well
when extending to use of_phandle_args, and I discovered bugs during testing.
I also took the opportunity to rename the function to be like the
existing of_parse_phandle().
v2: - moved declaration of of_phandle_args to fix compile on non-DT builds
- fixed incorrect index in example usage
- fixed incorrect return code handling for empty entries
Reviewed-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 4948552d60f5..ea44fd72af5f 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -65,6 +65,13 @@ 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 | |||
68 | #ifdef CONFIG_OF | 75 | #ifdef CONFIG_OF |
69 | 76 | ||
70 | /* Pointer for first entry in chain of all nodes. */ | 77 | /* Pointer for first entry in chain of all nodes. */ |
@@ -230,9 +237,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, | 237 | extern struct device_node *of_parse_phandle(struct device_node *np, |
231 | const char *phandle_name, | 238 | const char *phandle_name, |
232 | int index); | 239 | int index); |
233 | extern int of_parse_phandles_with_args(struct device_node *np, | 240 | extern int of_parse_phandle_with_args(struct device_node *np, |
234 | const char *list_name, const char *cells_name, int index, | 241 | const char *list_name, const char *cells_name, int index, |
235 | struct device_node **out_node, const void **out_args); | 242 | struct of_phandle_args *out_args); |
236 | 243 | ||
237 | extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); | 244 | 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); | 245 | extern int of_alias_get_id(struct device_node *np, const char *stem); |