linux/of.h: Add of_find_node_by_path()

Update #3277.
This commit is contained in:
Sebastian Huber 2018-01-17 14:14:30 +01:00
parent 44fca38058
commit 81fc57de35
2 changed files with 19 additions and 0 deletions

View File

@ -88,6 +88,9 @@ bool of_device_is_available(const struct device_node *dn);
int of_device_is_compatible(const struct device_node *dn, const char *name);
struct device_node *of_find_node_by_path(struct device_node *dns,
const char *path);
struct device_node *of_find_compatible_node(struct device_node *dns,
const struct device_node *dn, const char *type, const char *compatible);

View File

@ -89,6 +89,22 @@ of_device_is_compatible(const struct device_node *dn, const char *name)
return (fdt_node_check_compatible(fdt, dn->offset, name) == 0);
}
struct device_node *
of_find_node_by_path(struct device_node *dns, const char *path)
{
const void *fdt = bsp_fdt_get();
int node;
memset(dns, 0, sizeof(*dns));
node = fdt_path_offset(fdt, path);
if (node < 0)
return (NULL);
dns->offset = node;
return (dns);
}
struct device_node *
of_find_compatible_node(struct device_node *dns, const struct device_node *dn,
const char *type, const char *compatible)