linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible.
@ 2008-03-20  4:33 Tony Breeds
  2008-03-20  4:33 ` [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine Tony Breeds
  2008-03-20  9:41 ` [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Benjamin Herrenschmidt
  0 siblings, 2 replies; 5+ messages in thread
From: Tony Breeds @ 2008-03-20  4:33 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev; +Cc: Olof Johansson, Jan-Bernd Themann

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
 arch/powerpc/kernel/prom.c |   21 ++++++++++++++-------
 include/asm-powerpc/prom.h |    2 ++
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index eac97f4..f73e18b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -205,25 +205,32 @@ void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
 	} while(1);
 }
 
-int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
+int __init of_flat_dt_search(unsigned long node, const char *str,
+                             const char *prop_name)
 {
-	const char* cp;
-	unsigned long cplen, l;
+	const char *cp;
+	unsigned long plen, l;
 
-	cp = of_get_flat_dt_prop(node, "compatible", &cplen);
+	cp = of_get_flat_dt_prop(node, prop_name, &plen);
 	if (cp == NULL)
 		return 0;
-	while (cplen > 0) {
-		if (strncasecmp(cp, compat, strlen(compat)) == 0)
+	while (plen > 0) {
+		if (strncasecmp(cp, str, strlen(str)) == 0)
 			return 1;
 		l = strlen(cp) + 1;
 		cp += l;
-		cplen -= l;
+		plen -= l;
 	}
 
 	return 0;
 }
 
+int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
+{
+
+	return of_flat_dt_search(node, compat, "compatible");
+}
+
 static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
 				       unsigned long align)
 {
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 78b7b0d..7b587f1 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -134,6 +134,8 @@ extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
 				  void *data);
 extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
 					unsigned long *size);
+extern int __init of_flat_dt_search(unsigned long node, const char *str,
+                                  const char *prop_name);
 extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long __init of_get_flat_dt_root(void);
 
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-20 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20  4:33 [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Tony Breeds
2008-03-20  4:33 ` [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine Tony Breeds
2008-03-20  7:18   ` Nathan Lynch
2008-03-20  9:23     ` Paul Mackerras
2008-03-20  9:41 ` [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).