]> Pileus Git - ~andy/linux/commitdiff
of/flattree: Merge of_flat_dt_is_compatible
authorGrant Likely <grant.likely@secretlab.ca>
Tue, 24 Nov 2009 03:07:00 +0000 (20:07 -0700)
committerGrant Likely <grant.likely@secretlab.ca>
Tue, 24 Nov 2009 03:07:00 +0000 (20:07 -0700)
Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
arch/microblaze/kernel/prom.c
arch/powerpc/kernel/prom.c
drivers/of/fdt.c

index d75c6253c0de8ab484422c081bbf932acb56af56..eb27bd3a39b4edf08a023f754d11c6835fb316a8 100644 (file)
@@ -50,25 +50,6 @@ typedef u32 cell_t;
 /* export that to outside world */
 struct device_node *of_chosen;
 
-int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
-{
-       const char *cp;
-       unsigned long cplen, l;
-
-       cp = of_get_flat_dt_prop(node, "compatible", &cplen);
-       if (cp == NULL)
-               return 0;
-       while (cplen > 0) {
-               if (strncasecmp(cp, compat, strlen(compat)) == 0)
-                       return 1;
-               l = strlen(cp) + 1;
-               cp += l;
-               cplen -= l;
-       }
-
-       return 0;
-}
-
 static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
                                        unsigned long align)
 {
index cd0a2bfc978b10d520985eac54c1ef91514e810f..413e608863ddfc8041dc3cfada1f09112cd1481a 100644 (file)
@@ -80,25 +80,6 @@ extern rwlock_t devtree_lock;        /* temporary while merging */
 /* export that to outside world */
 struct device_node *of_chosen;
 
-int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
-{
-       const char* cp;
-       unsigned long cplen, l;
-
-       cp = of_get_flat_dt_prop(node, "compatible", &cplen);
-       if (cp == NULL)
-               return 0;
-       while (cplen > 0) {
-               if (strncasecmp(cp, compat, strlen(compat)) == 0)
-                       return 1;
-               l = strlen(cp) + 1;
-               cp += l;
-               cplen -= l;
-       }
-
-       return 0;
-}
-
 static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
                                       unsigned long align)
 {
index b17a9086cbfc9f4dd523cd41329205d55b796b85..5cdd958db9af6210d40dd9bce06e56b326c17d49 100644 (file)
@@ -142,3 +142,27 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
        } while (1);
 }
 
+/**
+ * of_flat_dt_is_compatible - Return true if given node has compat in compatible list
+ * @node: node to test
+ * @compat: compatible string to compare with compatible list.
+ */
+int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
+{
+       const char *cp;
+       unsigned long cplen, l;
+
+       cp = of_get_flat_dt_prop(node, "compatible", &cplen);
+       if (cp == NULL)
+               return 0;
+       while (cplen > 0) {
+               if (strncasecmp(cp, compat, strlen(compat)) == 0)
+                       return 1;
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       return 0;
+}
+