Module Name:    src
Committed By:   jdc
Date:           Tue Sep 24 18:04:53 UTC 2013

Modified Files:
        src/sys/dev/i2c: i2c.c
        src/sys/dev/ofw: ofw_subr.c

Log Message:
Add a property "i2c-indirect-config" to allow/disallow i2c indirect config.
If missing, "allowed" is assumed.  Set it to false for OFW machines.
Patch from martin@.  Removes erroneous i2c probe messages that appeared with
wildcard support.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/i2c/i2c.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ofw/ofw_subr.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/dev/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.41 src/sys/dev/i2c/i2c.c:1.42
--- src/sys/dev/i2c/i2c.c:1.41	Thu Sep 12 20:20:03 2013
+++ src/sys/dev/i2c/i2c.c	Tue Sep 24 18:04:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.41 2013/09/12 20:20:03 martin Exp $	*/
+/*	$NetBSD: i2c.c,v 1.42 2013/09/24 18:04:53 jdc Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.41 2013/09/12 20:20:03 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.42 2013/09/24 18:04:53 jdc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -166,9 +166,11 @@ iic_attach(device_t parent, device_t sel
 	struct iic_softc *sc = device_private(self);
 	struct i2cbus_attach_args *iba = aux;
 	prop_array_t child_devices;
+	prop_dictionary_t props;
 	char *buf;
 	i2c_tag_t ic;
 	int rv;
+	bool indirect_config;
 
 	aprint_naive("\n");
 	aprint_normal(": I2C bus\n");
@@ -190,8 +192,11 @@ iic_attach(device_t parent, device_t sel
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
-	child_devices = prop_dictionary_get(device_properties(parent),
-		"i2c-child-devices");
+	props = device_properties(parent);
+	if (!prop_dictionary_get_bool(props, "i2c-indirect-config",
+	    &indirect_config))
+		indirect_config = true;
+	child_devices = prop_dictionary_get(props, "i2c-child-devices");
 	if (child_devices) {
 		unsigned int i, count;
 		prop_dictionary_t dev;
@@ -250,7 +255,7 @@ iic_attach(device_t parent, device_t sel
 			if (buf)
 				free(buf, M_TEMP);
 		}
-	} else {
+	} else if (indirect_config) {
 		/*
 		 * Attach all i2c devices described in the kernel
 		 * configuration file.

Index: src/sys/dev/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.21 src/sys/dev/ofw/ofw_subr.c:1.22
--- src/sys/dev/ofw/ofw_subr.c:1.21	Fri Feb  8 15:17:00 2013
+++ src/sys/dev/ofw/ofw_subr.c	Tue Sep 24 18:04:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.c,v 1.21 2013/02/08 15:17:00 jdc Exp $	*/
+/*	$NetBSD: ofw_subr.c,v 1.22 2013/09/24 18:04:53 jdc Exp $	*/
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.21 2013/02/08 15:17:00 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.22 2013/09/24 18:04:53 jdc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -393,4 +393,6 @@ of_enter_i2c_devs(prop_dictionary_t prop
 		prop_dictionary_set(props, "i2c-child-devices", array);
 		prop_object_release(array);
 	}
+
+	prop_dictionary_set_bool(props, "i2c-indirect-config", false);
 }

Reply via email to