Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/cardbus This is *always* compiled with #define rbus ...



details:   https://anonhg.NetBSD.org/src/rev/f4d86eb6d708
branches:  trunk
changeset: 752885:f4d86eb6d708
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Wed Mar 10 00:21:10 2010 +0000

description:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-       cardbus_intr_disestablish(cc, cf, ih);
+       Cardbus_intr_disestablish(ct, ih);

-       ih = cardbus_intr_establish(cc, cf, ...);
+       ih = Cardbus_intr_establish(ct, ...);

Tested by Klaus Heinz.

diffstat:

 sys/dev/cardbus/ehci_cardbus.c   |  15 +++++----------
 sys/dev/cardbus/if_tlp_cardbus.c |  22 +++++-----------------
 sys/dev/cardbus/ohci_cardbus.c   |  15 +++++----------
 3 files changed, 15 insertions(+), 37 deletions(-)

diffs (193 lines):

diff -r 45b9606edc55 -r f4d86eb6d708 sys/dev/cardbus/ehci_cardbus.c
--- a/sys/dev/cardbus/ehci_cardbus.c    Tue Mar 09 23:17:12 2010 +0000
+++ b/sys/dev/cardbus/ehci_cardbus.c    Wed Mar 10 00:21:10 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci_cardbus.c,v 1.27 2010/02/26 00:57:01 dyoung Exp $ */
+/*     $NetBSD: ehci_cardbus.c,v 1.28 2010/03/10 00:21:10 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.27 2010/02/26 00:57:01 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.28 2010/03/10 00:21:10 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -153,11 +153,6 @@
        sc->sc_ct = ct;
        sc->sc.sc_bus.dmatag = ca->ca_dmat;
 
-#if rbus
-#else
-XXX    (ct->ct_cf->cardbus_mem_open)(cc, 0, iob, iob + 0x40);
-#endif
-
        /* Enable the device. */
        csr = Cardbus_conf_read(ct, ca->ca_tag, PCI_COMMAND_STATUS_REG);
        Cardbus_conf_write(ct, ca->ca_tag, PCI_COMMAND_STATUS_REG,
@@ -169,7 +164,7 @@
        DPRINTF(("%s: offs=%d\n", devname, sc->sc.sc_offs));
        EOWRITE2(&sc->sc, EHCI_USBINTR, 0);
 
-       sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline,
+       sc->sc_ih = Cardbus_intr_establish(ct, ca->ca_intrline,
                                           IPL_USB, ehci_intr, sc);
        if (sc->sc_ih == NULL) {
                printf("%s: couldn't establish interrupt\n", devname);
@@ -206,7 +201,7 @@
                printf("%s: init failed, error=%d\n", devname, r);
 
                /* Avoid spurious interrupts. */
-               cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih);
+               Cardbus_intr_disestablish(ct, sc->sc_ih);
                sc->sc_ih = NULL;
 
                return;
@@ -231,7 +226,7 @@
        if (rv)
                return (rv);
        if (sc->sc_ih != NULL) {
-               cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih);
+               Cardbus_intr_disestablish(ct, sc->sc_ih);
                sc->sc_ih = NULL;
        }
        if (sc->sc.sc_size) {
diff -r 45b9606edc55 -r f4d86eb6d708 sys/dev/cardbus/if_tlp_cardbus.c
--- a/sys/dev/cardbus/if_tlp_cardbus.c  Tue Mar 09 23:17:12 2010 +0000
+++ b/sys/dev/cardbus/if_tlp_cardbus.c  Wed Mar 10 00:21:10 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tlp_cardbus.c,v 1.66 2010/02/26 00:57:02 dyoung Exp $       */
+/*     $NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $       */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_cardbus.c,v 1.66 2010/02/26 00:57:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $");
 
 #include "opt_inet.h"
 
@@ -307,20 +307,12 @@
        if (Cardbus_mapreg_map(ct, TULIP_PCI_MMBA,
            PCI_MAPREG_TYPE_MEM, 0, &sc->sc_st, &sc->sc_sh, &adr,
            &csc->sc_mapsize) == 0) {
-#if rbus
-#else
-               (*ct->ct_cf->cardbus_mem_open)(cc, 0, adr, adr+csc->sc_mapsize);
-#endif
                csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
                csc->sc_bar_reg = TULIP_PCI_MMBA;
                csc->sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
        } else if (Cardbus_mapreg_map(ct, TULIP_PCI_IOBA,
            PCI_MAPREG_TYPE_IO, 0, &sc->sc_st, &sc->sc_sh, &adr,
            &csc->sc_mapsize) == 0) {
-#if rbus
-#else
-               (*ct->ct_cf->cardbus_io_open)(cc, 0, adr, adr+csc->sc_mapsize);
-#endif
                csc->sc_csr |= PCI_COMMAND_IO_ENABLE;
                csc->sc_bar_reg = TULIP_PCI_IOBA;
                csc->sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
@@ -472,7 +464,7 @@
         * Unhook the interrupt handler.
         */
        if (csc->sc_ih != NULL)
-               cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->sc_ih);
+               Cardbus_intr_disestablish(ct, csc->sc_ih);
 
        /*
         * Release bus space and close window.
@@ -489,8 +481,6 @@
 {
        struct tulip_cardbus_softc *csc = (void *) sc;
        cardbus_devfunc_t ct = csc->sc_ct;
-       cardbus_chipset_tag_t cc = ct->ct_cc;
-       cardbus_function_tag_t cf = ct->ct_cf;
 
        /*
         * Power on the socket.
@@ -505,7 +495,7 @@
        /*
         * Map and establish the interrupt.
         */
-       csc->sc_ih = cardbus_intr_establish(cc, cf, csc->sc_intrline, IPL_NET,
+       csc->sc_ih = Cardbus_intr_establish(ct, csc->sc_intrline, IPL_NET,
            tlp_intr, sc);
        if (csc->sc_ih == NULL) {
                aprint_error_dev(sc->sc_dev,
@@ -521,11 +511,9 @@
 {
        struct tulip_cardbus_softc *csc = (void *) sc;
        cardbus_devfunc_t ct = csc->sc_ct;
-       cardbus_chipset_tag_t cc = ct->ct_cc;
-       cardbus_function_tag_t cf = ct->ct_cf;
 
        /* Unhook the interrupt handler. */
-       cardbus_intr_disestablish(cc, cf, csc->sc_ih);
+       Cardbus_intr_disestablish(ct, csc->sc_ih);
        csc->sc_ih = NULL;
 
        /* Power down the socket. */
diff -r 45b9606edc55 -r f4d86eb6d708 sys/dev/cardbus/ohci_cardbus.c
--- a/sys/dev/cardbus/ohci_cardbus.c    Tue Mar 09 23:17:12 2010 +0000
+++ b/sys/dev/cardbus/ohci_cardbus.c    Wed Mar 10 00:21:10 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci_cardbus.c,v 1.35 2010/02/26 00:57:02 dyoung Exp $ */
+/*     $NetBSD: ohci_cardbus.c,v 1.36 2010/03/10 00:21:10 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci_cardbus.c,v 1.35 2010/02/26 00:57:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci_cardbus.c,v 1.36 2010/03/10 00:21:10 dyoung Exp $");
 
 #include "ehci_cardbus.h"
 
@@ -131,11 +131,6 @@
        sc->sc_ct = ct;
        sc->sc.sc_bus.dmatag = ca->ca_dmat;
 
-#if rbus
-#else
-XXX    (ct->ct_cf->cardbus_mem_open)(cc, 0, iob, iob + 0x40);
-#endif
-
        /* Enable the device. */
        csr = Cardbus_conf_read(ct, ca->ca_tag,
                                PCI_COMMAND_STATUS_REG);
@@ -147,7 +142,7 @@
        bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE,
                          OHCI_ALL_INTRS);
 
-       sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline,
+       sc->sc_ih = Cardbus_intr_establish(ct, ca->ca_intrline,
                                           IPL_USB, ohci_intr, sc);
        if (sc->sc_ih == NULL) {
                printf("%s: couldn't establish interrupt\n", devname);
@@ -168,7 +163,7 @@
                printf("%s: init failed, error=%d\n", devname, r);
 
                /* Avoid spurious interrupts. */
-               cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih);
+               Cardbus_intr_disestablish(ct, sc->sc_ih);
                sc->sc_ih = 0;
 
                return;
@@ -197,7 +192,7 @@
        if (rv)
                return (rv);
        if (sc->sc_ih != NULL) {
-               cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih);
+               Cardbus_intr_disestablish(ct, sc->sc_ih);
                sc->sc_ih = NULL;
        }
        if (sc->sc.sc_size) {



Home | Main Index | Thread Index | Old Index