Module Name:    src
Committed By:   nakayama
Date:           Sun Jan 22 10:32:35 UTC 2012

Modified Files:
        src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
pmu's i2c devices are under the "i2c" node, so find it out before
calling of_enter_i2c_devs().


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/sparc64/sparc64/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.183 src/sys/arch/sparc64/sparc64/autoconf.c:1.184
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.183	Sat Jul  9 15:03:35 2011
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Jan 22 10:32:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.183 2011/07/09 15:03:35 mrg Exp $ */
+/*	$NetBSD: autoconf.c,v 1.184 2012/01/22 10:32:35 nakayama Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.183 2011/07/09 15:03:35 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.184 2012/01/22 10:32:35 nakayama Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1040,9 +1040,30 @@ noether:
 			prop_dictionary_t props = device_properties(busdev);
 			prop_object_t cfg = prop_dictionary_get(props,
 				"i2c-child-devices");
-			if (!cfg)
+			if (!cfg) {
+				int node;
+				const char *name;
+
+				/*
+				 * pmu's i2c devices are under the "i2c" node,
+				 * so find it out.
+				 */
+				name = prom_getpropstring(busnode, "name");
+				if (strcmp(name, "pmu") == 0) {
+					for (node = OF_child(busnode);
+					     node != 0; node = OF_peer(node)) {
+						name = prom_getpropstring(node,
+						    "name");
+						if (strcmp(name, "i2c") == 0) {
+							busnode = node;
+							break;
+						}
+					}
+				}
+
 				of_enter_i2c_devs(props, busnode,
 				    sizeof(cell_t));
+			}
 		}
 	}
 

Reply via email to