Source-Changes-HG archive

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

[src/trunk]: src/sys change PROM_getprop() from taking a "void **" for the st...



details:   https://anonhg.NetBSD.org/src/rev/a70e7794b636
branches:  trunk
changeset: 551022:a70e7794b636
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Aug 27 15:59:49 2003 +0000

description:
change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function.  this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing.  testing by martin@

diffstat:

 sys/arch/sparc/dev/bootbus.c        |  14 +++++++-------
 sys/arch/sparc/dev/ebus.c           |  12 ++++++------
 sys/arch/sparc/dev/sbus.c           |  16 ++++++++--------
 sys/arch/sparc/dev/vme_machdep.c    |  10 ++++++----
 sys/arch/sparc/dev/zs_kgdb.c        |   6 +++---
 sys/arch/sparc/include/promlib.h    |   4 ++--
 sys/arch/sparc/sparc/autoconf.c     |  12 ++++++------
 sys/arch/sparc/sparc/cpu.c          |  10 +++++-----
 sys/arch/sparc/sparc/cpuunit.c      |  10 +++++-----
 sys/arch/sparc/sparc/iommu.c        |   6 +++---
 sys/arch/sparc/sparc/machdep.c      |   6 +++---
 sys/arch/sparc/sparc/openprom.c     |   6 +++---
 sys/arch/sparc/sparc/pmap.c         |   6 +++---
 sys/arch/sparc/sparc/promlib.c      |  24 ++++++++++++------------
 sys/arch/sparc64/dev/ebus.c         |  18 +++++++++---------
 sys/arch/sparc64/dev/psycho.c       |  12 ++++++------
 sys/arch/sparc64/dev/sbus.c         |  14 +++++++-------
 sys/arch/sparc64/include/autoconf.h |   4 ++--
 sys/arch/sparc64/sparc64/autoconf.c |  18 +++++++++---------
 sys/arch/sparc64/sparc64/clock.c    |   6 +++---
 sys/arch/sparc64/sparc64/openprom.c |   6 +++---
 sys/dev/sbus/qec.c                  |   6 +++---
 22 files changed, 114 insertions(+), 112 deletions(-)

diffs (truncated from 1007 to 300 lines):

diff -r 6d57d44f2012 -r a70e7794b636 sys/arch/sparc/dev/bootbus.c
--- a/sys/arch/sparc/dev/bootbus.c      Wed Aug 27 15:41:03 2003 +0000
+++ b/sys/arch/sparc/dev/bootbus.c      Wed Aug 27 15:59:49 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootbus.c,v 1.10 2003/07/15 00:04:51 lukem Exp $       */
+/*     $NetBSD: bootbus.c,v 1.11 2003/08/27 15:59:50 mrg Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.10 2003/07/15 00:04:51 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.11 2003/08/27 15:59:50 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -115,7 +115,7 @@
         */
        error = PROM_getprop(sc->sc_node, "ranges",
            sizeof(struct openprom_range), &sc->sc_bustag->nranges,
-           (void **) &sc->sc_bustag->ranges);
+           &sc->sc_bustag->ranges);
        if (error) {
                printf("%s: error %d getting \"ranges\" property\n",
                    sc->sc_dev.dv_xname, error);
@@ -176,7 +176,7 @@
 
        memset(baa, 0, sizeof(*baa));
 
-       error = PROM_getprop(node, "name", 1, &n, (void **) &baa->ba_name);
+       error = PROM_getprop(node, "name", 1, &n, &baa->ba_name);
        if (error)
                return (error);
        baa->ba_name[n] = '\0';
@@ -185,21 +185,21 @@
        baa->ba_node = node;
 
        error = PROM_getprop(node, "reg", sizeof(struct openprom_addr),
-           &baa->ba_nreg, (void **) &baa->ba_reg);
+           &baa->ba_nreg, &baa->ba_reg);
        if (error) {
                bootbus_destroy_attach_args(baa);
                return (error);
        }
 
        error = PROM_getprop(node, "intr", sizeof(struct openprom_intr),
-           &baa->ba_nintr, (void **) &baa->ba_intr);
+           &baa->ba_nintr, &baa->ba_intr);
        if (error != 0 && error != ENOENT) {
                bootbus_destroy_attach_args(baa);
                return (error);
        }
 
        error = PROM_getprop(node, "address", sizeof(uint32_t),
-           &baa->ba_npromvaddrs, (void **) &baa->ba_promvaddrs);
+           &baa->ba_npromvaddrs, &baa->ba_promvaddrs);
        if (error != 0 && error != ENOENT) {
                bootbus_destroy_attach_args(baa);
                return (error);
diff -r 6d57d44f2012 -r a70e7794b636 sys/arch/sparc/dev/ebus.c
--- a/sys/arch/sparc/dev/ebus.c Wed Aug 27 15:41:03 2003 +0000
+++ b/sys/arch/sparc/dev/ebus.c Wed Aug 27 15:59:49 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus.c,v 1.14 2003/07/15 00:04:54 lukem Exp $ */ 
+/*     $NetBSD: ebus.c,v 1.15 2003/08/27 15:59:50 mrg Exp $ */ 
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.14 2003/07/15 00:04:54 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.15 2003/08/27 15:59:50 mrg Exp $");
 
 #if defined(DEBUG) && !defined(EBUS_DEBUG)
 #define EBUS_DEBUG
@@ -270,7 +270,7 @@
         * 
         */
        error = PROM_getprop(node, "reg", sizeof(struct ofw_pci_register),
-                            &sc->sc_nreg, (void **)&sc->sc_reg);
+                            &sc->sc_nreg, &sc->sc_reg);
        if (error)
                panic("%s: unable to read ebus registers (error %d)",
                      self->dv_xname, error);
@@ -303,7 +303,7 @@
 
        memset(ea, 0, sizeof(struct ebus_attach_args));
 
-       err = PROM_getprop(node, "name", 1, &n, (void **)&ea->ea_name);
+       err = PROM_getprop(node, "name", 1, &n, &ea->ea_name);
        if (err != 0)
                return (err);
        ea->ea_name[n] = '\0';
@@ -313,7 +313,7 @@
        ea->ea_dmatag = sc->sc_dmatag;
 
        err = PROM_getprop(node, "reg", sizeof(struct ebus_regs),
-                          &ea->ea_nreg, (void **)&ea->ea_reg);
+                          &ea->ea_nreg, &ea->ea_reg);
        if (err != 0)
                return (err);
 
@@ -331,7 +331,7 @@
 
 
        err = PROM_getprop(node, "address", sizeof(u_int32_t),
-                          &ea->ea_nvaddr, (void **)&ea->ea_vaddr);
+                          &ea->ea_nvaddr, &ea->ea_vaddr);
        if (err != ENOENT) {
                if (err != 0)
                        return (err);
diff -r 6d57d44f2012 -r a70e7794b636 sys/arch/sparc/dev/sbus.c
--- a/sys/arch/sparc/dev/sbus.c Wed Aug 27 15:41:03 2003 +0000
+++ b/sys/arch/sparc/dev/sbus.c Wed Aug 27 15:59:49 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbus.c,v 1.58 2003/08/07 16:29:36 agc Exp $ */
+/*     $NetBSD: sbus.c,v 1.59 2003/08/27 15:59:50 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.58 2003/08/07 16:29:36 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.59 2003/08/27 15:59:50 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -404,7 +404,7 @@
         * Collect address translations from the OBP.
         */
        error = PROM_getprop(busnode, "ranges", sizeof(struct rom_range),
-                       &sbt->nranges, (void **) &sbt->ranges);
+                       &sbt->nranges, &sbt->ranges);
        switch (error) {
        case 0:
                break;
@@ -472,7 +472,7 @@
        int n, error;
 
        bzero(sa, sizeof(struct sbus_attach_args));
-       error = PROM_getprop(node, "name", 1, &n, (void **)&sa->sa_name);
+       error = PROM_getprop(node, "name", 1, &n, &sa->sa_name);
        if (error != 0)
                return (error);
        sa->sa_name[n] = '\0';
@@ -483,7 +483,7 @@
        sa->sa_frequency = sc->sc_clockfreq;
 
        error = PROM_getprop(node, "reg", sizeof(struct openprom_addr),
-                       &sa->sa_nreg, (void **)&sa->sa_reg);
+                       &sa->sa_nreg, &sa->sa_reg);
        if (error != 0) {
                char buf[32];
                if (error != ENOENT ||
@@ -505,7 +505,7 @@
                return (error);
 
        error = PROM_getprop(node, "address", sizeof(u_int32_t),
-                        &sa->sa_npromvaddrs, (void **)&sa->sa_promvaddrs);
+                        &sa->sa_npromvaddrs, &sa->sa_promvaddrs);
        if (error != 0 && error != ENOENT)
                return (error);
 
@@ -617,7 +617,7 @@
         * The `interrupts' property contains the Sbus interrupt level.
         */
        if (PROM_getprop(node, "interrupts", sizeof(int), np,
-                        (void **)&ipl) == 0) {
+                        &ipl) == 0) {
                /* Change format to an `struct openprom_intr' array */
                struct openprom_intr *ip;
                ip = malloc(*np * sizeof(struct openprom_intr), M_DEVBUF,
@@ -640,7 +640,7 @@
         */
        *ipp = NULL;
        error = PROM_getprop(node, "intr", sizeof(struct openprom_intr),
-                       np, (void **)ipp);
+                       np, ipp);
        switch (error) {
        case 0:
                for (n = *np; n-- > 0;) {
diff -r 6d57d44f2012 -r a70e7794b636 sys/arch/sparc/dev/vme_machdep.c
--- a/sys/arch/sparc/dev/vme_machdep.c  Wed Aug 27 15:41:03 2003 +0000
+++ b/sys/arch/sparc/dev/vme_machdep.c  Wed Aug 27 15:59:49 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vme_machdep.c,v 1.47 2003/08/01 12:19:50 pk Exp $      */
+/*     $NetBSD: vme_machdep.c,v 1.48 2003/08/27 15:59:50 mrg Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.47 2003/08/01 12:19:50 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.48 2003/08/27 15:59:50 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/extent.h>
@@ -464,7 +464,7 @@
         * Get "range" property.
         */
        if (PROM_getprop(node, "ranges", sizeof(struct rom_range),
-                   &sc->sc_nrange, (void **)&sc->sc_range) != 0) {
+                   &sc->sc_nrange, &sc->sc_range) != 0) {
                panic("%s: can't get ranges property", self->dv_xname);
        }
 
@@ -932,6 +932,7 @@
 {
        bus_addr_t dva;
        bus_size_t sgsize;
+       u_long ldva;
        vaddr_t va, voff;
        pmap_t pmap;
        int pagesz = PAGE_SIZE;
@@ -953,9 +954,10 @@
                             (flags & BUS_DMA_NOWAIT) == 0
                                        ? EX_WAITOK
                                        : EX_NOWAIT,
-                            (u_long *)&dva);
+                            &ldva);
        if (error != 0)
                return (error);
+       dva = (bus_addr_t)ldva;
 
        map->dm_mapsize = buflen;
        map->dm_nsegs = 1;
diff -r 6d57d44f2012 -r a70e7794b636 sys/arch/sparc/dev/zs_kgdb.c
--- a/sys/arch/sparc/dev/zs_kgdb.c      Wed Aug 27 15:41:03 2003 +0000
+++ b/sys/arch/sparc/dev/zs_kgdb.c      Wed Aug 27 15:59:49 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs_kgdb.c,v 1.12 2003/07/15 00:04:58 lukem Exp $       */
+/*     $NetBSD: zs_kgdb.c,v 1.13 2003/08/27 15:59:50 mrg Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zs_kgdb.c,v 1.12 2003/07/15 00:04:58 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs_kgdb.c,v 1.13 2003/08/27 15:59:50 mrg Exp $");
 
 #include "opt_kgdb.h"
 
@@ -384,7 +384,7 @@
                        vaddrs = vstore;
                        nvaddrs = sizeof(vstore)/sizeof(vstore[0]);
                        if (PROM_getprop(node, "address", sizeof(int),
-                                   &nvaddrs, (void **)&vaddrs) != 0)
+                                   &nvaddrs, &vaddrs) != 0)
                                return (NULL);
 
                        return ((void *)vaddrs[0]);
diff -r 6d57d44f2012 -r a70e7794b636 sys/arch/sparc/include/promlib.h
--- a/sys/arch/sparc/include/promlib.h  Wed Aug 27 15:41:03 2003 +0000
+++ b/sys/arch/sparc/include/promlib.h  Wed Aug 27 15:59:49 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: promlib.h,v 1.10 2003/06/25 14:38:53 martin Exp $ */
+/*     $NetBSD: promlib.h,v 1.11 2003/08/27 15:59:50 mrg Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -141,7 +141,7 @@
 
 /* Utility routines */
 int    prom_prop       __P((int, char *, int, int *, void **));
-int    PROM_getprop            __P((int, char *, int, int *, void **));
+int    PROM_getprop            __P((int, char *, int, int *, void *));
 int    PROM_getpropint __P((int node, char *name, int deflt));
 char   *PROM_getpropstring     __P((int node, char *name));
 char   *PROM_getpropstringA    __P((int node, char *name, char *, size_t));
diff -r 6d57d44f2012 -r a70e7794b636 sys/arch/sparc/sparc/autoconf.c
--- a/sys/arch/sparc/sparc/autoconf.c   Wed Aug 27 15:41:03 2003 +0000
+++ b/sys/arch/sparc/sparc/autoconf.c   Wed Aug 27 15:59:49 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.200 2003/08/25 17:50:26 uwe Exp $ */
+/*     $NetBSD: autoconf.c,v 1.201 2003/08/27 15:59:52 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.200 2003/08/25 17:50:26 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.201 2003/08/27 15:59:52 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -371,7 +371,7 @@
        vaddrs = vstore;
        nvaddrs = sizeof(vstore)/sizeof(vstore[0]);



Home | Main Index | Thread Index | Old Index