Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Do not use unitialized bus_space_tag_t's. Use the t...



details:   https://anonhg.NetBSD.org/src/rev/8c8a5d747561
branches:  trunk
changeset: 753365:8c8a5d747561
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Wed Mar 24 01:13:30 2010 +0000

description:
Do not use unitialized bus_space_tag_t's.  Use the tag(s) from the
attachment arguments.

diffstat:

 sys/dev/acpi/acpi_ec.c |  21 ++++++++++++++-------
 sys/dev/isa/pas.c      |  14 +++++++-------
 2 files changed, 21 insertions(+), 14 deletions(-)

diffs (135 lines):

diff -r 0d94c382eb0d -r 8c8a5d747561 sys/dev/acpi/acpi_ec.c
--- a/sys/dev/acpi/acpi_ec.c    Wed Mar 24 00:41:21 2010 +0000
+++ b/sys/dev/acpi/acpi_ec.c    Wed Mar 24 01:13:30 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_ec.c,v 1.62 2010/03/05 14:00:16 jruoho Exp $      */
+/*     $NetBSD: acpi_ec.c,v 1.63 2010/03/24 01:13:30 dyoung Exp $      */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.62 2010/03/05 14:00:16 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.63 2010/03/24 01:13:30 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -149,7 +149,8 @@
 static void acpiec_attach(device_t, device_t, void *);
 
 static void acpiec_common_attach(device_t, device_t, ACPI_HANDLE,
-    bus_addr_t, bus_addr_t, ACPI_HANDLE, uint8_t);
+    bus_space_tag_t, bus_addr_t, bus_space_tag_t, bus_addr_t,
+    ACPI_HANDLE, uint8_t);
 
 static bool acpiec_suspend(device_t, const pmf_qual_t *);
 static bool acpiec_resume(device_t, const pmf_qual_t *);
@@ -225,6 +226,7 @@
 static void
 acpiecdt_attach(device_t parent, device_t self, void *aux)
 {
+       struct acpi_attach_args *aa = aux;
        ACPI_HANDLE ec_handle;
        bus_addr_t cmd_reg, data_reg;
        uint8_t gpebit;
@@ -235,8 +237,8 @@
        aprint_naive("\n");
        aprint_normal(": ACPI Embedded Controller via ECDT\n");
 
-       acpiec_common_attach(parent, self, ec_handle, cmd_reg, data_reg,
-           NULL, gpebit);
+       acpiec_common_attach(parent, self, ec_handle, aa->aa_iot, cmd_reg,
+           aa->aa_iot, data_reg, NULL, gpebit);
 }
 
 static int
@@ -290,7 +292,8 @@
        }
 
        acpiec_common_attach(parent, self, aa->aa_node->ad_handle,
-           io1->ar_base, io0->ar_base, gpe_handle, gpebit);
+           aa->aa_iot, io1->ar_base, aa->aa_iot, io0->ar_base,
+           gpe_handle, gpebit);
 
 free_res:
        acpi_resource_cleanup(&ec_res);
@@ -298,13 +301,17 @@
 
 static void
 acpiec_common_attach(device_t parent, device_t self,
-    ACPI_HANDLE ec_handle, bus_addr_t cmd_reg, bus_addr_t data_reg,
+    ACPI_HANDLE ec_handle, bus_space_tag_t cmdt, bus_addr_t cmd_reg,
+    bus_space_tag_t datat, bus_addr_t data_reg,
     ACPI_HANDLE gpe_handle, uint8_t gpebit)
 {
        struct acpiec_softc *sc = device_private(self);
        ACPI_STATUS rv;
        ACPI_INTEGER val;
 
+       sc->sc_csr_st = cmdt;
+       sc->sc_data_st = datat;
+
        sc->sc_ech = ec_handle;
        sc->sc_gpeh = gpe_handle;
        sc->sc_gpebit = gpebit;
diff -r 0d94c382eb0d -r 8c8a5d747561 sys/dev/isa/pas.c
--- a/sys/dev/isa/pas.c Wed Mar 24 00:41:21 2010 +0000
+++ b/sys/dev/isa/pas.c Wed Mar 24 01:13:30 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pas.c,v 1.67 2008/03/15 21:09:02 cube Exp $    */
+/*     $NetBSD: pas.c,v 1.68 2010/03/24 01:13:30 dyoung Exp $  */
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -57,7 +57,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pas.c,v 1.67 2008/03/15 21:09:02 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pas.c,v 1.68 2010/03/24 01:13:30 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -287,7 +287,7 @@
                return 0;
 
        memset(sc, 0, sizeof *sc);
-       return pasfind(match, sc, aux, PASPROBE);
+       return pasfind(match, sc, ia, PASPROBE);
 }
 
 /*
@@ -309,7 +309,7 @@
                return 0;
        }
 
-       if (bus_space_map(sc->sc_sbdsp.sc_iot, PAS_DEFAULT_BASE, 1, 0,
+       if (bus_space_map(ia->ia_iot, PAS_DEFAULT_BASE, 1, 0,
            &sc->pas_port_handle)) {
                printf("pas: can't map base register %x in probe\n",
                    PAS_DEFAULT_BASE);
@@ -395,7 +395,7 @@
        sc->sc_sbdsp.sc_iot = ia->ia_iot;
 
        /* Map i/o space [we map 24 ports which is the max of the sb and pro */
-       if (bus_space_map(sc->sc_sbdsp.sc_iot, ia->ia_io[0].ir_addr,
+       if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr,
            SBP_NPORT, 0, &sc->sc_sbdsp.sc_ioh)) {
                printf("pas: can't map i/o space 0x%x/%d in probe\n",
                    ia->ia_io[0].ir_addr, SBP_NPORT);
@@ -444,11 +444,11 @@
 
  unmap:
        if (rc == 0 || probing)
-               bus_space_unmap(sc->sc_sbdsp.sc_iot, sc->sc_sbdsp.sc_ioh,
+               bus_space_unmap(ia->ia_iot, sc->sc_sbdsp.sc_ioh,
                    SBP_NPORT);
  unmap1:
        if (rc == 0 || probing)
-               bus_space_unmap(sc->sc_sbdsp.sc_iot, PAS_DEFAULT_BASE, 1);
+               bus_space_unmap(ia->ia_iot, PAS_DEFAULT_BASE, 1);
        return rc;
 }
 



Home | Main Index | Thread Index | Old Index