9
0
Fork 0

of: Added of_set_property_to_child_phandle

Set a property to a phandle of a child node. This may be used
for selections like display-timings.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Teresa Gámez 2014-09-30 13:15:29 +02:00 committed by Sascha Hauer
parent d1d7876499
commit e5707ec702
2 changed files with 22 additions and 0 deletions

View File

@ -356,6 +356,27 @@ phandle of_node_create_phandle(struct device_node *node)
}
EXPORT_SYMBOL(of_node_create_phandle);
int of_set_property_to_child_phandle(struct device_node *node, char *prop_name)
{
int ret;
phandle p;
/* Check if property exist */
if (!of_get_property(of_get_parent(node), prop_name, NULL))
return -EINVAL;
/* Create or get existing phandle of child node */
p = of_node_create_phandle(node);
p = cpu_to_be32(p);
node = of_get_parent(node);
ret = of_set_property(node, prop_name, &p, sizeof(p), 0);
return ret;
}
EXPORT_SYMBOL(of_set_property_to_child_phandle);
/*
* Find a property with a given name for a given node
* and return the value.

View File

@ -714,6 +714,7 @@ int of_device_disable_path(const char *path);
phandle of_get_tree_max_phandle(struct device_node *root);
phandle of_node_create_phandle(struct device_node *node);
int of_set_property_to_child_phandle(struct device_node *node, char *prop_name);
struct device_node *of_find_node_by_alias(struct device_node *root,
const char *alias);
struct device_node *of_find_node_by_path_or_alias(struct device_node *root,