mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-21 14:21:48 +00:00
of: Add cpu node iterator for_each_of_cpu_node()
Iterating thru cpu nodes is a common pattern. Create a common iterator which can find child nodes either by node name or device_type == cpu. Using the former will allow for eventually dropping device_type properties which are deprecated for FDT. Cc: Frank Rowand <frowand.list@gmail.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
parent
f6707fd624
commit
f1f207e43b
2 changed files with 50 additions and 0 deletions
|
@ -353,6 +353,8 @@ extern const void *of_get_property(const struct device_node *node,
|
|||
const char *name,
|
||||
int *lenp);
|
||||
extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
|
||||
extern struct device_node *of_get_next_cpu_node(struct device_node *prev);
|
||||
|
||||
#define for_each_property_of_node(dn, pp) \
|
||||
for (pp = dn->properties; pp != NULL; pp = pp->next)
|
||||
|
||||
|
@ -754,6 +756,11 @@ static inline struct device_node *of_get_cpu_node(int cpu,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct device_node *of_get_next_cpu_node(struct device_node *prev)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int of_n_addr_cells(struct device_node *np)
|
||||
{
|
||||
return 0;
|
||||
|
@ -1217,6 +1224,10 @@ static inline int of_property_read_s32(const struct device_node *np,
|
|||
for (child = of_get_next_available_child(parent, NULL); child != NULL; \
|
||||
child = of_get_next_available_child(parent, child))
|
||||
|
||||
#define for_each_of_cpu_node(cpu) \
|
||||
for (cpu = of_get_next_cpu_node(NULL); cpu != NULL; \
|
||||
cpu = of_get_next_cpu_node(cpu))
|
||||
|
||||
#define for_each_node_with_property(dn, prop_name) \
|
||||
for (dn = of_find_node_with_property(NULL, prop_name); dn; \
|
||||
dn = of_find_node_with_property(dn, prop_name))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue