/* Returns a node pointer with refcount incremented, use of_node_put() on it when done.  */
struct device_node* of_find_compatible_node(struct device_node *from, const char *type, const char *compatible)
/* Returns a node pointer with refcount incremented, use of_node_put() on it when done.  */
struct device_node* of_find_compatible_node(struct device_node *from, const char *type, const char *compatible)
{
	struct device_node *np;
	read_lock(&devtree_lock);
	np = from ? from->allnext : allnodes;
	for (; np; np = np->allnext) {
		if (type
		    && !(np->type && (of_node_cmp(np->type, type) == 0)))
			continue;
		if (of_device_is_compatible(np, compatible) && of_node_get(np))
			break;
	}
	of_node_put(from);
	read_unlock(&devtree_lock);
	return np;
}