Source-Changes-HG archive

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

[src/thorpej-i2c-spi-conf2]: src/sys/dev/ofw Remove unnecessary references to...



details:   https://anonhg.NetBSD.org/src/rev/51b9ca1f6fc0
branches:  thorpej-i2c-spi-conf2
changeset: 1024890:51b9ca1f6fc0
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Sep 10 15:45:27 2021 +0000

description:
Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.

diffstat:

 sys/arch/macppc/dev/cuda.c              |  10 ++--------
 sys/arch/macppc/dev/ki2c.c              |   3 ++-
 sys/arch/sandpoint/sandpoint/autoconf.c |  10 ++--------
 sys/arch/sparc64/sparc64/ofw_patch.c    |  10 ++--------
 sys/dev/acpi/acpi_i2c.c                 |   8 ++------
 sys/dev/i2c/adm1021.c                   |  11 +++++++----
 sys/dev/i2c/dbcool.c                    |  11 +++++++----
 sys/dev/i2c/dstemp.c                    |  11 +++++++----
 sys/dev/i2c/i2c.c                       |  10 +++-------
 sys/dev/i2c/i2cvar.h                    |   6 ++++--
 sys/dev/i2c/lm75.c                      |  12 +++++++-----
 sys/dev/ofw/ofw_i2c_subr.c              |   8 ++------
 12 files changed, 47 insertions(+), 63 deletions(-)

diffs (truncated from 432 to 300 lines):

diff -r 3e4ed7c93b55 -r 51b9ca1f6fc0 sys/arch/macppc/dev/cuda.c
--- a/sys/arch/macppc/dev/cuda.c        Fri Sep 10 15:43:03 2021 +0000
+++ b/sys/arch/macppc/dev/cuda.c        Fri Sep 10 15:45:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cuda.c,v 1.29.2.1 2021/08/09 00:30:08 thorpej Exp $ */
+/*     $NetBSD: cuda.c,v 1.29.2.2 2021/09/10 15:45:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.29.2.1 2021/08/09 00:30:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.29.2.2 2021/09/10 15:45:27 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -178,7 +178,6 @@
 cuda_i2c_enumerate_devices(device_t dev, devhandle_t call_handle, void *v)
 {
        struct i2c_enumerate_devices_args *args = v;
-       prop_dictionary_t props;
        int i;
        bool cbrv;
 
@@ -186,20 +185,15 @@
        struct cuda_softc *sc = args->ia->ia_tag->ic_cookie;
 
        for (i = 0; i < sc->sc_ni2c_devices; i++) {
-               props = prop_dictionary_create();
-
                args->ia->ia_addr = sc->sc_i2c_devices[i].addr;
                args->ia->ia_name = sc->sc_i2c_devices[i].name;
                args->ia->ia_clist = sc->sc_i2c_devices[i].compatible;
                args->ia->ia_clist_size = strlen(args->ia->ia_clist) + 1;
-               args->ia->ia_prop = props;
                /* Child gets no handle. */
                devhandle_invalidate(&args->ia->ia_devhandle);
 
                cbrv = args->callback(dev, args);
 
-               prop_object_release(props);
-
                if (!cbrv) {
                        break;  /* callback decides if we continue */
                }
diff -r 3e4ed7c93b55 -r 51b9ca1f6fc0 sys/arch/macppc/dev/ki2c.c
--- a/sys/arch/macppc/dev/ki2c.c        Fri Sep 10 15:43:03 2021 +0000
+++ b/sys/arch/macppc/dev/ki2c.c        Fri Sep 10 15:45:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ki2c.c,v 1.32.2.1 2021/08/09 00:30:08 thorpej Exp $    */
+/*     $NetBSD: ki2c.c,v 1.32.2.2 2021/09/10 15:45:28 thorpej Exp $    */
 /*     Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp */
 
 /*-
@@ -68,6 +68,7 @@
        char descr[32], num[8];
 
        /* We're fetching descriptions for sensors. */
+       /* XXX This is a terrible hack and should not be done this way XXX */
 
        for (node = OF_child(node); node != 0; node = OF_peer(node)) {
                if (of_getprop_uint32(node, "reg", &reg) == -1) {
diff -r 3e4ed7c93b55 -r 51b9ca1f6fc0 sys/arch/sandpoint/sandpoint/autoconf.c
--- a/sys/arch/sandpoint/sandpoint/autoconf.c   Fri Sep 10 15:43:03 2021 +0000
+++ b/sys/arch/sandpoint/sandpoint/autoconf.c   Fri Sep 10 15:45:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.29.16.2 2021/08/24 03:27:39 thorpej Exp $       */
+/*     $NetBSD: autoconf.c,v 1.29.16.3 2021/09/10 15:45:28 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.29.16.2 2021/08/24 03:27:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.29.16.3 2021/09/10 15:45:28 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -118,7 +118,6 @@
        struct i2c_enumerate_devices_args *args = v;
        const struct device_compatible_entry *dce;
        const struct sandpoint_i2cdev *i2cdev;
-       prop_dictionary_t props;
        bool cbrv;
 
        KASSERT(bi_pfam != NULL);
@@ -141,20 +140,15 @@
                        }
                }
 
-               props = prop_dictionary_create();
-
                args->ia->ia_addr = i2cdev->addr;
                args->ia->ia_name = i2cdev->name;
                args->ia->ia_clist = i2cdev->compat;
                args->ia->ia_clist_size = strlen(i2cdev->compat) + 1;
-               args->ia->ia_prop = props;
                /* no devhandle for child devices. */
                devhandle_invalidate(&args->ia->ia_devhandle);
 
                cbrv = args->callback(dev, args);
 
-               prop_object_release(props);
-
                if (!cbrv) {
                        break;
                }
diff -r 3e4ed7c93b55 -r 51b9ca1f6fc0 sys/arch/sparc64/sparc64/ofw_patch.c
--- a/sys/arch/sparc64/sparc64/ofw_patch.c      Fri Sep 10 15:43:03 2021 +0000
+++ b/sys/arch/sparc64/sparc64/ofw_patch.c      Fri Sep 10 15:45:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofw_patch.c,v 1.7.14.1 2021/08/09 00:30:08 thorpej Exp $ */
+/*     $NetBSD: ofw_patch.c,v 1.7.14.2 2021/09/10 15:45:28 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020, 2021 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7.14.1 2021/08/09 00:30:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7.14.2 2021/09/10 15:45:28 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -143,20 +143,16 @@
        /* Now enumerate our additions. */
        const struct i2c_addition *i2c_adds = fixup->i2c_additions;
        KASSERT(i2c_adds != NULL);
-       prop_dictionary_t props;
        int i;
        bool cbrv;
 
        for (i = 0; i < fixup->i2c_nadditions; i++) {
-               props = prop_dictionary_create();
-
                args->ia->ia_addr = i2c_adds[i].addr;
                args->ia->ia_name = i2c_adds[i].name;
                args->ia->ia_clist = i2c_adds[i].compat;
                args->ia->ia_clist_size = args->ia->ia_clist != NULL
                    ? strlen(i2c_adds[i].compat) + 1
                    : 0;
-               args->ia->ia_prop = props;
                if (fixup->i2c_phandle != 0) {
                        args->ia->ia_devhandle =
                            devhandle_from_of(fixup->i2c_phandle);
@@ -166,8 +162,6 @@
 
                cbrv = args->callback(dev, args);
 
-               prop_object_release(props);
-
                if (! cbrv) {
                        break;
                }
diff -r 3e4ed7c93b55 -r 51b9ca1f6fc0 sys/dev/acpi/acpi_i2c.c
--- a/sys/dev/acpi/acpi_i2c.c   Fri Sep 10 15:43:03 2021 +0000
+++ b/sys/dev/acpi/acpi_i2c.c   Fri Sep 10 15:45:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_i2c.c,v 1.11.14.1 2021/08/09 00:30:09 thorpej Exp $ */
+/* $NetBSD: acpi_i2c.c,v 1.11.14.2 2021/09/10 15:45:28 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2017, 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.11.14.1 2021/08/09 00:30:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.11.14.2 2021/09/10 15:45:28 thorpej Exp $");
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
@@ -74,7 +74,6 @@
 {
        char *clist;
        size_t clist_size;
-       prop_dictionary_t props;
        struct acpi_i2c_context i2cc;
        bool cbrv;
        ACPI_STATUS rv;
@@ -97,18 +96,15 @@
                    ad->ad_name);
                return true;    /* keep enumerating */
        }
-       props = prop_dictionary_create();
 
        args->ia->ia_addr = i2cc.i2c_addr;
        args->ia->ia_name = ad->ad_name;
        args->ia->ia_clist = clist;
        args->ia->ia_clist_size = clist_size;
-       args->ia->ia_prop = props;
        args->ia->ia_devhandle = devhandle_from_acpi(ad->ad_handle);
 
        cbrv = args->callback(dev, args);
 
-       prop_object_release(props);
        kmem_free(clist, clist_size);
 
        return cbrv;    /* callback decides if we keep enumerating */
diff -r 3e4ed7c93b55 -r 51b9ca1f6fc0 sys/dev/i2c/adm1021.c
--- a/sys/dev/i2c/adm1021.c     Fri Sep 10 15:43:03 2021 +0000
+++ b/sys/dev/i2c/adm1021.c     Fri Sep 10 15:45:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adm1021.c,v 1.29 2021/06/21 03:12:54 christos Exp $ */
+/*     $NetBSD: adm1021.c,v 1.29.6.1 2021/09/10 15:45:28 thorpej Exp $ */
 /*     $OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $        */
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.29 2021/06/21 03:12:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.29.6.1 2021/09/10 15:45:28 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -341,8 +341,11 @@
 
        sc->sc_tag = ia->ia_tag;
        sc->sc_addr = ia->ia_addr;
-       sc->sc_prop = ia->ia_prop;
-       prop_object_retain(sc->sc_prop);
+
+       /* XXX XXX XXX */
+       if ((sc->sc_prop = ia->ia_prop) != NULL) {
+               prop_object_retain(sc->sc_prop);
+       }
 
        if (iic_acquire_bus(sc->sc_tag, 0)) {
                aprint_error_dev(self, "cannot acquire iic bus\n");
diff -r 3e4ed7c93b55 -r 51b9ca1f6fc0 sys/dev/i2c/dbcool.c
--- a/sys/dev/i2c/dbcool.c      Fri Sep 10 15:43:03 2021 +0000
+++ b/sys/dev/i2c/dbcool.c      Fri Sep 10 15:45:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dbcool.c,v 1.62 2021/06/21 03:12:54 christos Exp $ */
+/*     $NetBSD: dbcool.c,v 1.62.6.1 2021/09/10 15:45:28 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.62 2021/06/21 03:12:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.62.6.1 2021/09/10 15:45:28 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -775,8 +775,11 @@
        sc->sc_dc.dc_readreg = dbcool_readreg;
        sc->sc_dc.dc_writereg = dbcool_writereg;
        sc->sc_dev = self;
-       sc->sc_prop = args->ia_prop;
-       prop_object_retain(sc->sc_prop);
+
+       /* XXX XXX XXX */
+       if ((sc->sc_prop = args->ia_prop) != NULL) {
+               prop_object_retain(sc->sc_prop);
+       }
 
        if (dbcool_chip_ident(&sc->sc_dc) < 0 || sc->sc_dc.dc_chip == NULL)
                panic("could not identify chip at addr %d", args->ia_addr);
diff -r 3e4ed7c93b55 -r 51b9ca1f6fc0 sys/dev/i2c/dstemp.c
--- a/sys/dev/i2c/dstemp.c      Fri Sep 10 15:43:03 2021 +0000
+++ b/sys/dev/i2c/dstemp.c      Fri Sep 10 15:45:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dstemp.c,v 1.14 2021/06/21 03:12:54 christos Exp $ */
+/* $NetBSD: dstemp.c,v 1.14.6.1 2021/09/10 15:45:28 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.14 2021/06/21 03:12:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.14.6.1 2021/09/10 15:45:28 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -109,8 +109,11 @@
        sc->sc_dev = self;
        sc->sc_i2c = ia->ia_tag;
        sc->sc_addr = ia->ia_addr;
-       sc->sc_prop = ia->ia_prop;
-       prop_object_retain(sc->sc_prop);
+
+       /* XXX XXX XXX */
+       if ((sc->sc_prop = ia->ia_prop) != NULL) {
+               prop_object_retain(sc->sc_prop);
+       }
 
        aprint_naive("\n");
        aprint_normal(": DS1361\n");



Home | Main Index | Thread Index | Old Index