libfdt: add function fdt_device_is_available
Change-Id: Ia6c727e246339107c280f715d0e35edd54ce6dc3 Signed-off-by: Mark Yao <mark.yao@rock-chips.com> Signed-off-by: yxj <yxj@rock-chips.com>
This commit is contained in:
parent
d4bafcc833
commit
f82d121178
|
|
@ -680,3 +680,26 @@ int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
|
|||
|
||||
return offset; /* error from fdt_next_node() */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* of_device_is_available - check if a device is available for use
|
||||
*
|
||||
* @device: Node to check for availability
|
||||
*
|
||||
* Returns 1 if the status property is absent or set to "okay" or "ok",
|
||||
* 0 otherwise
|
||||
*/
|
||||
int fdt_device_is_available(const void *blob, int node)
|
||||
{
|
||||
const char *cell;
|
||||
cell = fdt_getprop(blob, node, "status", NULL);
|
||||
if (cell) {
|
||||
if (!strcmp(cell, "okay") || !strcmp(cell, "ok"))
|
||||
return 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2165,6 +2165,7 @@ int fdt_next_region(const void *fdt,
|
|||
*/
|
||||
int fdt_add_alias_regions(const void *fdt, struct fdt_region *region, int count,
|
||||
int max_regions, struct fdt_region_state *info);
|
||||
int fdt_device_is_available(const void *blob, int node);
|
||||
#endif /* SWIG */
|
||||
|
||||
#endif /* _LIBFDT_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue