Skip to content
Snippets Groups Projects
Commit 10aeabd1 authored by Kumar Gala's avatar Kumar Gala
Browse files

fdt: Add new fdt_create_phandle helper


Add a helper function that will return a phandle value for the given
node.  If the node doesn't have a phandle already one will be created.

Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
Acked-by: default avatarGerald Van Baren <vanbaren@cideas.com>
parent f117c0f0
No related branches found
No related tags found
No related merge requests found
...@@ -1235,6 +1235,26 @@ int fdt_set_phandle(void *fdt, int nodeoffset, uint32_t phandle) ...@@ -1235,6 +1235,26 @@ int fdt_set_phandle(void *fdt, int nodeoffset, uint32_t phandle)
return ret; return ret;
} }
/*
* fdt_create_phandle: Create a phandle property for the given node
*
* @fdt: ptr to device tree
* @nodeoffset: node to update
*/
int fdt_create_phandle(void *fdt, int nodeoffset)
{
/* see if there is a phandle already */
int phandle = fdt_get_phandle(fdt, nodeoffset);
/* if we got 0, means no phandle so create one */
if (phandle == 0) {
phandle = fdt_alloc_phandle(fdt);
fdt_set_phandle(fdt, nodeoffset, phandle);
}
return phandle;
}
#if defined(CONFIG_VIDEO) #if defined(CONFIG_VIDEO)
int fdt_add_edid(void *blob, const char *compat, unsigned char *edid_buf) int fdt_add_edid(void *blob, const char *compat, unsigned char *edid_buf)
{ {
......
...@@ -90,6 +90,7 @@ int fdt_node_offset_by_compat_reg(void *blob, const char *compat, ...@@ -90,6 +90,7 @@ int fdt_node_offset_by_compat_reg(void *blob, const char *compat,
phys_addr_t compat_off); phys_addr_t compat_off);
int fdt_alloc_phandle(void *blob); int fdt_alloc_phandle(void *blob);
int fdt_set_phandle(void *fdt, int nodeoffset, uint32_t phandle); int fdt_set_phandle(void *fdt, int nodeoffset, uint32_t phandle);
int fdt_create_phandle(void *fdt, int nodeoffset);
int fdt_add_edid(void *blob, const char *compat, unsigned char *buf); int fdt_add_edid(void *blob, const char *compat, unsigned char *buf);
int fdt_verify_alias_address(void *fdt, int anode, const char *alias, int fdt_verify_alias_address(void *fdt, int anode, const char *alias,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment