diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2008-01-08 14:20:40 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-16 22:53:22 -0500 |
commit | 283029d16a882539ab0027afd94ac52858d050b2 (patch) | |
tree | 78ad81fba51de1fbafd30706f162dc9315690e8b /include/linux | |
parent | 91bbbe22dbd6d156b7059af13adb26a978a45661 (diff) |
[POWERPC] Add of_find_matching_node() helper function
Similar to of_find_compatible_node(), of_find_matching_node() and
for_each_matching_node() allow you to iterate over the device tree
looking for specific nodes, except that they take of_device_id
tables instead of strings.
This also moves of_match_node() from driver/of/device.c to
driver/of/base.c to colocate it with the of_find_matching_node which
depends on it.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/of.h | 8 | ||||
-rw-r--r-- | include/linux/of_device.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index c65af7bd1e9c..b5f33efcb8e2 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
20 | #include <linux/mod_devicetable.h> | ||
20 | 21 | ||
21 | #include <asm/prom.h> | 22 | #include <asm/prom.h> |
22 | 23 | ||
@@ -41,6 +42,11 @@ extern struct device_node *of_find_compatible_node(struct device_node *from, | |||
41 | #define for_each_compatible_node(dn, type, compatible) \ | 42 | #define for_each_compatible_node(dn, type, compatible) \ |
42 | for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ | 43 | for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ |
43 | dn = of_find_compatible_node(dn, type, compatible)) | 44 | dn = of_find_compatible_node(dn, type, compatible)) |
45 | extern struct device_node *of_find_matching_node(struct device_node *from, | ||
46 | const struct of_device_id *matches); | ||
47 | #define for_each_matching_node(dn, matches) \ | ||
48 | for (dn = of_find_matching_node(NULL, matches); dn; \ | ||
49 | dn = of_find_matching_node(dn, matches)) | ||
44 | extern struct device_node *of_find_node_by_path(const char *path); | 50 | extern struct device_node *of_find_node_by_path(const char *path); |
45 | extern struct device_node *of_find_node_by_phandle(phandle handle); | 51 | extern struct device_node *of_find_node_by_phandle(phandle handle); |
46 | extern struct device_node *of_get_parent(const struct device_node *node); | 52 | extern struct device_node *of_get_parent(const struct device_node *node); |
@@ -60,5 +66,7 @@ extern const void *of_get_property(const struct device_node *node, | |||
60 | int *lenp); | 66 | int *lenp); |
61 | extern int of_n_addr_cells(struct device_node *np); | 67 | extern int of_n_addr_cells(struct device_node *np); |
62 | extern int of_n_size_cells(struct device_node *np); | 68 | extern int of_n_size_cells(struct device_node *np); |
69 | extern const struct of_device_id *of_match_node( | ||
70 | const struct of_device_id *matches, const struct device_node *node); | ||
63 | 71 | ||
64 | #endif /* _LINUX_OF_H */ | 72 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 212bffb2b174..6dc11959770c 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
@@ -10,8 +10,6 @@ | |||
10 | 10 | ||
11 | #define to_of_device(d) container_of(d, struct of_device, dev) | 11 | #define to_of_device(d) container_of(d, struct of_device, dev) |
12 | 12 | ||
13 | extern const struct of_device_id *of_match_node( | ||
14 | const struct of_device_id *matches, const struct device_node *node); | ||
15 | extern const struct of_device_id *of_match_device( | 13 | extern const struct of_device_id *of_match_device( |
16 | const struct of_device_id *matches, const struct of_device *dev); | 14 | const struct of_device_id *matches, const struct of_device *dev); |
17 | 15 | ||