Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Add a property "i2c-indirect-config" to allow/disall...



details:   https://anonhg.NetBSD.org/src/rev/a8cc3a0c4bb8
branches:  trunk
changeset: 790185:a8cc3a0c4bb8
user:      jdc <jdc%NetBSD.org@localhost>
date:      Tue Sep 24 18:04:53 2013 +0000

description:
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.

diffstat:

 sys/dev/i2c/i2c.c      |  15 ++++++++++-----
 sys/dev/ofw/ofw_subr.c |   6 ++++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (78 lines):

diff -r ec5c1cd90c5e -r a8cc3a0c4bb8 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Tue Sep 24 13:28:50 2013 +0000
+++ b/sys/dev/i2c/i2c.c Tue Sep 24 18:04:53 2013 +0000
@@ -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 @@
        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 @@
        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 @@
                        if (buf)
                                free(buf, M_TEMP);
                }
-       } else {
+       } else if (indirect_config) {
                /*
                 * Attach all i2c devices described in the kernel
                 * configuration file.
diff -r ec5c1cd90c5e -r a8cc3a0c4bb8 sys/dev/ofw/ofw_subr.c
--- a/sys/dev/ofw/ofw_subr.c    Tue Sep 24 13:28:50 2013 +0000
+++ b/sys/dev/ofw/ofw_subr.c    Tue Sep 24 18:04:53 2013 +0000
@@ -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 @@
                prop_dictionary_set(props, "i2c-child-devices", array);
                prop_object_release(array);
        }
+
+       prop_dictionary_set_bool(props, "i2c-indirect-config", false);
 }



Home | Main Index | Thread Index | Old Index