Author: andrew
Date: Sun Apr  8 22:07:06 2018
New Revision: 332309
URL: https://svnweb.freebsd.org/changeset/base/332309

Log:
  Replace calls to fdt_is_compatible with ofw_bus_node_is_compatible. These
  are almost identical so there is no need to keep the former around.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/fdt/fdt_common.c

Modified: head/sys/dev/fdt/fdt_common.c
==============================================================================
--- head/sys/dev/fdt/fdt_common.c       Sun Apr  8 21:56:35 2018        
(r332308)
+++ head/sys/dev/fdt/fdt_common.c       Sun Apr  8 22:07:06 2018        
(r332309)
@@ -71,8 +71,6 @@ vm_offset_t fdt_immr_size;
 
 struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head);
 
-static int fdt_is_compatible(phandle_t, const char *);
-
 static int
 fdt_get_range_by_busaddr(phandle_t node, u_long addr, u_long *base,
     u_long *size)
@@ -215,7 +213,7 @@ fdt_immr_addr(vm_offset_t immr_va)
         * Try to access the SOC node directly i.e. through /aliases/.
         */
        if ((node = OF_finddevice("soc")) != -1)
-               if (fdt_is_compatible(node, "simple-bus"))
+               if (ofw_bus_node_is_compatible(node, "simple-bus"))
                        goto moveon;
        /*
         * Find the node the long way.
@@ -236,45 +234,6 @@ moveon:
        return (r);
 }
 
-/*
- * This routine is an early-usage version of the ofw_bus_is_compatible() when
- * the ofw_bus I/F is not available (like early console routines and similar).
- * Note the buffer has to be on the stack since malloc() is usually not
- * available in such cases either.
- */
-static int
-fdt_is_compatible(phandle_t node, const char *compatstr)
-{
-       char buf[FDT_COMPAT_LEN];
-       char *compat;
-       int len, onelen, l, rv;
-
-       if ((len = OF_getproplen(node, "compatible")) <= 0)
-               return (0);
-
-       compat = (char *)&buf;
-       bzero(compat, FDT_COMPAT_LEN);
-
-       if (OF_getprop(node, "compatible", compat, FDT_COMPAT_LEN) < 0)
-               return (0);
-
-       onelen = strlen(compatstr);
-       rv = 0;
-       while (len > 0) {
-               if (strncasecmp(compat, compatstr, onelen) == 0) {
-                       /* Found it. */
-                       rv = 1;
-                       break;
-               }
-               /* Slide to the next sub-string. */
-               l = strlen(compat) + 1;
-               compat += l;
-               len -= l;
-       }
-
-       return (rv);
-}
-
 int
 fdt_is_compatible_strict(phandle_t node, const char *compatible)
 {
@@ -303,7 +262,7 @@ fdt_find_compatible(phandle_t start, const char *compa
         * matching 'compatible' property.
         */
        for (child = OF_child(start); child != 0; child = OF_peer(child))
-               if (fdt_is_compatible(child, compat)) {
+               if (ofw_bus_node_is_compatible(child, compat)) {
                        if (strict)
                                if (!fdt_is_compatible_strict(child, compat))
                                        continue;
@@ -322,7 +281,7 @@ fdt_depth_search_compatible(phandle_t start, const cha
         * matching 'compatible' property.
         */
        for (node = OF_child(start); node != 0; node = OF_peer(node)) {
-               if (fdt_is_compatible(node, compat) && 
+               if (ofw_bus_node_is_compatible(node, compat) &&
                    (strict == 0 || fdt_is_compatible_strict(node, compat))) {
                        return (node);
                }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to