Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/cardbus Don't use the cardbus_softc. Compile-tested...



details:   https://anonhg.NetBSD.org/src/rev/5474ce14dee4
branches:  trunk
changeset: 752430:5474ce14dee4
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Thu Feb 25 22:31:51 2010 +0000

description:
Don't use the cardbus_softc.  Compile-tested, only.

diffstat:

 sys/dev/cardbus/com_cardbus.c    |  30 +++++++++++++++---------------
 sys/dev/cardbus/if_fxp_cardbus.c |  24 ++++++++++++------------
 2 files changed, 27 insertions(+), 27 deletions(-)

diffs (174 lines):

diff -r d225ce7cf4bd -r 5474ce14dee4 sys/dev/cardbus/com_cardbus.c
--- a/sys/dev/cardbus/com_cardbus.c     Thu Feb 25 22:20:03 2010 +0000
+++ b/sys/dev/cardbus/com_cardbus.c     Thu Feb 25 22:31:51 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com_cardbus.c,v 1.25 2010/02/25 20:36:31 dyoung Exp $ */
+/* $NetBSD: com_cardbus.c,v 1.26 2010/02/25 22:31:51 dyoung Exp $ */
 
 /*
  * Copyright (c) 2000 Johan Danielsson
@@ -40,7 +40,7 @@
    updated below.  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com_cardbus.c,v 1.25 2010/02/25 20:36:31 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_cardbus.c,v 1.26 2010/02/25 22:31:51 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -57,6 +57,7 @@
 
 struct com_cardbus_softc {
        struct com_softc        cc_com;
+       cardbus_intr_line_t     cc_intrline;
        void                    *cc_ih;
        cardbus_devfunc_t       cc_ct;
        bus_addr_t              cc_addr;
@@ -211,6 +212,7 @@
        bus_space_tag_t         iot;
 
        sc->sc_dev = self;
+       csc->cc_intrline = ca->ca_intrline;
        csc->cc_ct = ca->ca_ct;
        csc->cc_tag = ca->ca_tag;
 
@@ -297,17 +299,16 @@
 com_cardbus_enable(struct com_softc *sc)
 {
        struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
-       struct cardbus_softc *psc =
-               device_private(device_parent(sc->sc_dev));
-       cardbus_chipset_tag_t cc = psc->sc_cc;
-       cardbus_function_tag_t cf = psc->sc_cf;
+       cardbus_devfunc_t ct = csc->cc_ct;
+       cardbus_chipset_tag_t cc = ct->ct_cc;
+       cardbus_function_tag_t cf = ct->ct_cf;
 
-       Cardbus_function_enable(csc->cc_ct);
+       Cardbus_function_enable(ct);
 
        com_cardbus_setup(csc);
 
        /* establish the interrupt. */
-       csc->cc_ih = cardbus_intr_establish(cc, cf, psc->sc_intrline,
+       csc->cc_ih = cardbus_intr_establish(cc, cf, csc->cc_intrline,
                                            IPL_SERIAL, comintr, sc);
        if (csc->cc_ih == NULL) {
                aprint_error_dev(DEVICET(csc),
@@ -322,15 +323,14 @@
 com_cardbus_disable(struct com_softc *sc)
 {
        struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
-       struct cardbus_softc *psc =
-               device_private(device_parent(sc->sc_dev));
-       cardbus_chipset_tag_t cc = psc->sc_cc;
-       cardbus_function_tag_t cf = psc->sc_cf;
+       cardbus_devfunc_t ct = csc->cc_ct;
+       cardbus_chipset_tag_t cc = ct->ct_cc;
+       cardbus_function_tag_t cf = ct->ct_cf;
 
        cardbus_intr_disestablish(cc, cf, csc->cc_ih);
        csc->cc_ih = NULL;
 
-       Cardbus_function_disable(csc->cc_ct);
+       Cardbus_function_disable(ct);
 }
 
 static int
@@ -338,14 +338,14 @@
 {
        struct com_cardbus_softc *csc = device_private(self);
        struct com_softc *sc = device_private(self);
-       struct cardbus_softc *psc = device_private(device_parent(self));
+       cardbus_devfunc_t ct = csc->cc_ct;
        int error;
 
        if ((error = com_detach(self, flags)) != 0)
                return error;
 
        if (csc->cc_ih != NULL)
-               cardbus_intr_disestablish(psc->sc_cc, psc->sc_cf, csc->cc_ih);
+               cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->cc_ih);
 
        Cardbus_mapreg_unmap(csc->cc_ct, csc->cc_reg, sc->sc_regs.cr_iot,
            sc->sc_regs.cr_ioh, csc->cc_size);
diff -r d225ce7cf4bd -r 5474ce14dee4 sys/dev/cardbus/if_fxp_cardbus.c
--- a/sys/dev/cardbus/if_fxp_cardbus.c  Thu Feb 25 22:20:03 2010 +0000
+++ b/sys/dev/cardbus/if_fxp_cardbus.c  Thu Feb 25 22:31:51 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_fxp_cardbus.c,v 1.43 2010/02/25 20:36:31 dyoung Exp $       */
+/*     $NetBSD: if_fxp_cardbus.c,v 1.44 2010/02/25 22:31:51 dyoung Exp $       */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.43 2010/02/25 20:36:31 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.44 2010/02/25 22:31:51 dyoung Exp $");
 
 #include "opt_inet.h"
 #include "rnd.h"
@@ -91,6 +91,7 @@
 struct fxp_cardbus_softc {
        struct fxp_softc sc;
        cardbus_devfunc_t ct;
+       cardbus_intr_line_t intrline;
        pcitag_t tag;
        pcireg_t base0_reg;
        pcireg_t base1_reg;
@@ -133,6 +134,7 @@
        bus_size_t size;
 
        sc->sc_dev = self;
+       csc->intrline = ca->ca_intrline;
        csc->ct = ca->ca_ct;
        csc->tag = ca->ca_tag;
 
@@ -190,9 +192,8 @@
 fxp_cardbus_setup(struct fxp_softc * sc)
 {
        struct fxp_cardbus_softc *csc = (struct fxp_cardbus_softc *)sc;
-       struct cardbus_softc *psc = device_private(device_parent(sc->sc_dev));
-       cardbus_chipset_tag_t cc = psc->sc_cc;
-       cardbus_function_tag_t cf = psc->sc_cf;
+       cardbus_chipset_tag_t cc = csc->ct->ct_cc;
+       cardbus_function_tag_t cf = csc->ct->ct_cf;
        pcireg_t command;
 
        pcitag_t tag = csc->tag;
@@ -222,9 +223,8 @@
 fxp_cardbus_enable(struct fxp_softc * sc)
 {
        struct fxp_cardbus_softc *csc = (struct fxp_cardbus_softc *)sc;
-       struct cardbus_softc *psc = device_private(device_parent(sc->sc_dev));
-       cardbus_chipset_tag_t cc = psc->sc_cc;
-       cardbus_function_tag_t cf = psc->sc_cf;
+       cardbus_chipset_tag_t cc = csc->ct->ct_cc;
+       cardbus_function_tag_t cf = csc->ct->ct_cf;
 
        Cardbus_function_enable(csc->ct);
 
@@ -232,7 +232,7 @@
 
        /* Map and establish the interrupt. */
 
-       sc->sc_ih = cardbus_intr_establish(cc, cf, psc->sc_intrline, IPL_NET,
+       sc->sc_ih = cardbus_intr_establish(cc, cf, csc->intrline, IPL_NET,
            fxp_intr, sc);
        if (NULL == sc->sc_ih) {
                aprint_error_dev(sc->sc_dev, "couldn't establish interrupt\n");
@@ -246,9 +246,9 @@
 fxp_cardbus_disable(struct fxp_softc * sc)
 {
        struct fxp_cardbus_softc *csc = (struct fxp_cardbus_softc *)sc;
-       struct cardbus_softc *psc = device_private(device_parent(sc->sc_dev));
-       cardbus_chipset_tag_t cc = psc->sc_cc;
-       cardbus_function_tag_t cf = psc->sc_cf;
+       struct cardbus_devfunc *ct = csc->ct;
+       cardbus_chipset_tag_t cc = ct->ct_cc;
+       cardbus_function_tag_t cf = ct->ct_cf;
 
        /* Remove interrupt handler. */
        cardbus_intr_disestablish(cc, cf, sc->sc_ih);



Home | Main Index | Thread Index | Old Index