aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/base.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 2ce58be314af..785e9cc1b207 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -615,6 +615,27 @@ int of_modalias_node(struct device_node *node, char *modalias, int len)
615EXPORT_SYMBOL_GPL(of_modalias_node); 615EXPORT_SYMBOL_GPL(of_modalias_node);
616 616
617/** 617/**
618 * of_find_node_by_phandle - Find a node given a phandle
619 * @handle: phandle of the node to find
620 *
621 * Returns a node pointer with refcount incremented, use
622 * of_node_put() on it when done.
623 */
624struct device_node *of_find_node_by_phandle(phandle handle)
625{
626 struct device_node *np;
627
628 read_lock(&devtree_lock);
629 for (np = allnodes; np; np = np->allnext)
630 if (np->phandle == handle)
631 break;
632 of_node_get(np);
633 read_unlock(&devtree_lock);
634 return np;
635}
636EXPORT_SYMBOL(of_find_node_by_phandle);
637
638/**
618 * of_parse_phandle - Resolve a phandle property to a device_node pointer 639 * of_parse_phandle - Resolve a phandle property to a device_node pointer
619 * @np: Pointer to device node holding phandle property 640 * @np: Pointer to device node holding phandle property
620 * @phandle_name: Name of property holding a phandle value 641 * @phandle_name: Name of property holding a phandle value