of: base: import of_find_node_by_type
Import of_find_node_by_type from Linux drivers/of/base.c - commit id d8dfad3. This function retrieves a node pointer based on the "device_type" property of the node. This is used by device tree update functions in PPC support. Signed-off-by: Renaud Barbier <renaud.barbier@ge.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
7f5c04321d
commit
da19582070
|
@ -400,6 +400,35 @@ struct device_node *of_find_node_by_name(struct device_node *from,
|
|||
}
|
||||
EXPORT_SYMBOL(of_find_node_by_name);
|
||||
|
||||
/**
|
||||
* of_find_node_by_type - Find a node by its "device_type" property
|
||||
* @from: The node to start searching from, or NULL to start searching
|
||||
* the entire device tree. The node you pass will not be
|
||||
* searched, only the next one will; typically, you pass
|
||||
* what the previous call returned.
|
||||
* @type: The type string to match against.
|
||||
*
|
||||
* Returns a pointer to the node found or NULL.
|
||||
*/
|
||||
struct device_node *of_find_node_by_type(struct device_node *from,
|
||||
const char *type)
|
||||
{
|
||||
struct device_node *np;
|
||||
const char *device_type;
|
||||
int ret;
|
||||
|
||||
if (!from)
|
||||
from = root_node;
|
||||
|
||||
of_tree_for_each_node_from(np, from) {
|
||||
ret = of_property_read_string(np, "device_type", &device_type);
|
||||
if (!ret && !of_node_cmp(device_type, type))
|
||||
return np;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(of_find_node_by_type);
|
||||
|
||||
/**
|
||||
* of_find_compatible_node - Find a node based on type and one of the
|
||||
* tokens in its "compatible" property
|
||||
|
|
|
@ -124,6 +124,8 @@ extern struct device_node *of_find_node_by_path_from(struct device_node *from,
|
|||
const char *path);
|
||||
extern struct device_node *of_find_node_by_path(const char *path);
|
||||
extern struct device_node *of_find_node_by_phandle(phandle phandle);
|
||||
extern struct device_node *of_find_node_by_type(struct device_node *from,
|
||||
const char *type);
|
||||
extern struct device_node *of_find_compatible_node(struct device_node *from,
|
||||
const char *type, const char *compat);
|
||||
extern const struct of_device_id *of_match_node(
|
||||
|
|
Loading…
Reference in New Issue