Rename fdt_find_child to ofw_bus_find_child. There is nothing FDT-specific
in this function. Suggested by: andrew@
This commit is contained in:
parent
4342741d9a
commit
81e58ddcdd
@ -273,7 +273,7 @@ am335x_read_timing(device_t dev, phandle_t node, struct panel_info *panel)
|
||||
int error;
|
||||
phandle_t timings_node, timing_node, native;
|
||||
|
||||
timings_node = fdt_find_child(node, "display-timings");
|
||||
timings_node = ofw_bus_find_child(node, "display-timings");
|
||||
if (timings_node == 0) {
|
||||
device_printf(dev, "no \"display-timings\" node\n");
|
||||
return (-1);
|
||||
@ -346,7 +346,7 @@ am335x_read_panel_info(device_t dev, phandle_t node, struct panel_info *panel)
|
||||
int error;
|
||||
phandle_t panel_info_node;
|
||||
|
||||
panel_info_node = fdt_find_child(node, "panel-info");
|
||||
panel_info_node = ofw_bus_find_child(node, "panel-info");
|
||||
if (panel_info_node == 0)
|
||||
return (-1);
|
||||
|
||||
|
@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define FDT_COMPAT_LEN 255
|
||||
#define FDT_TYPE_LEN 64
|
||||
#define FDT_NAME_LEN 32
|
||||
|
||||
#define FDT_REG_CELLS 4
|
||||
|
||||
@ -310,22 +309,6 @@ fdt_find_compatible(phandle_t start, const char *compat, int strict)
|
||||
return (0);
|
||||
}
|
||||
|
||||
phandle_t
|
||||
fdt_find_child(phandle_t start, const char *child_name)
|
||||
{
|
||||
char name[FDT_NAME_LEN];
|
||||
phandle_t child;
|
||||
|
||||
for (child = OF_child(start); child != 0; child = OF_peer(child)) {
|
||||
if (OF_getprop(child, "name", name, sizeof(name)) <= 0)
|
||||
continue;
|
||||
if (strcmp(name, child_name) == 0)
|
||||
return (child);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
phandle_t
|
||||
fdt_depth_search_compatible(phandle_t start, const char *compat, int strict)
|
||||
{
|
||||
|
@ -81,7 +81,6 @@ u_long fdt_data_get(void *, int);
|
||||
int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *);
|
||||
phandle_t fdt_find_compatible(phandle_t, const char *, int);
|
||||
phandle_t fdt_depth_search_compatible(phandle_t, const char *, int);
|
||||
phandle_t fdt_find_child(phandle_t, const char *);
|
||||
int fdt_get_mem_regions(struct mem_region *, int *, uint32_t *);
|
||||
int fdt_get_reserved_regions(struct mem_region *, int *);
|
||||
int fdt_get_phyaddr(phandle_t, device_t, int *, void **);
|
||||
|
@ -502,6 +502,28 @@ ofw_bus_intr_to_rl(device_t dev, phandle_t node,
|
||||
return (err);
|
||||
}
|
||||
|
||||
phandle_t
|
||||
ofw_bus_find_child(phandle_t start, const char *child_name)
|
||||
{
|
||||
char *name;
|
||||
int ret;
|
||||
phandle_t child;
|
||||
|
||||
for (child = OF_child(start); child != 0; child = OF_peer(child)) {
|
||||
ret = OF_getencprop_alloc(child, "name", sizeof(*name), (void **)&name);
|
||||
if (ret == -1)
|
||||
continue;
|
||||
if (strcmp(name, child_name) == 0) {
|
||||
free(name, M_OFWPROP);
|
||||
return (child);
|
||||
}
|
||||
|
||||
free(name, M_OFWPROP);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
phandle_t
|
||||
ofw_bus_find_compatible(phandle_t node, const char *onecompat)
|
||||
{
|
||||
|
@ -104,4 +104,7 @@ int ofw_bus_has_prop(device_t, const char *);
|
||||
/* Helper to search for a child with a given compat prop */
|
||||
phandle_t ofw_bus_find_compatible(phandle_t, const char *);
|
||||
|
||||
/* Helper to search for a child with a given name */
|
||||
phandle_t ofw_bus_find_child(phandle_t, const char *);
|
||||
|
||||
#endif /* !_DEV_OFW_OFW_BUS_SUBR_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user