Author: gonzo
Date: Sun May 24 23:53:10 2015
New Revision: 283503
URL: https://svnweb.freebsd.org/changeset/base/283503

Log:
  Rename fdt_find_child to ofw_bus_find_child. There is nothing FDT-specific
  in this function.
  
  Suggested by: andrew@

Modified:
  head/sys/arm/ti/am335x/am335x_lcd.c
  head/sys/dev/fdt/fdt_common.c
  head/sys/dev/fdt/fdt_common.h
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/dev/ofw/ofw_bus_subr.h

Modified: head/sys/arm/ti/am335x/am335x_lcd.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_lcd.c Sun May 24 23:19:47 2015        
(r283502)
+++ head/sys/arm/ti/am335x/am335x_lcd.c Sun May 24 23:53:10 2015        
(r283503)
@@ -273,7 +273,7 @@ am335x_read_timing(device_t dev, phandle
        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, pha
        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);
 

Modified: head/sys/dev/fdt/fdt_common.c
==============================================================================
--- head/sys/dev/fdt/fdt_common.c       Sun May 24 23:19:47 2015        
(r283502)
+++ head/sys/dev/fdt/fdt_common.c       Sun May 24 23:53:10 2015        
(r283503)
@@ -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
 
@@ -311,22 +310,6 @@ fdt_find_compatible(phandle_t start, con
 }
 
 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)
 {
        phandle_t child, node;

Modified: head/sys/dev/fdt/fdt_common.h
==============================================================================
--- head/sys/dev/fdt/fdt_common.h       Sun May 24 23:19:47 2015        
(r283502)
+++ head/sys/dev/fdt/fdt_common.h       Sun May 24 23:53:10 2015        
(r283503)
@@ -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 **);

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==============================================================================
--- head/sys/dev/ofw/ofw_bus_subr.c     Sun May 24 23:19:47 2015        
(r283502)
+++ head/sys/dev/ofw/ofw_bus_subr.c     Sun May 24 23:53:10 2015        
(r283503)
@@ -503,6 +503,28 @@ ofw_bus_intr_to_rl(device_t dev, phandle
 }
 
 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)
 {
        phandle_t child, ret;

Modified: head/sys/dev/ofw/ofw_bus_subr.h
==============================================================================
--- head/sys/dev/ofw/ofw_bus_subr.h     Sun May 24 23:19:47 2015        
(r283502)
+++ head/sys/dev/ofw/ofw_bus_subr.h     Sun May 24 23:53:10 2015        
(r283503)
@@ -104,4 +104,7 @@ int ofw_bus_has_prop(device_t, const cha
 /* 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_ */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to