Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia Establish/disestablish the interrupt handler ...



details:   https://anonhg.NetBSD.org/src/rev/2d290c0305d9
branches:  trunk
changeset: 524818:2d290c0305d9
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Mar 31 07:19:03 2002 +0000

description:
Establish/disestablish the interrupt handler when enabling/disabling the
controller - no matter if we are called from attach or not.
This makes my FreeCOM CD drive work at first attach (PR 13480).

Something is wrong with the detach code; it won't work on second attach
and will panic on second detach - but that has to wait until the kids
took care of some easter eggs.

diffstat:

 sys/dev/pcmcia/wdc_pcmcia.c |  27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diffs (57 lines):

diff -r baa0055d683a -r 2d290c0305d9 sys/dev/pcmcia/wdc_pcmcia.c
--- a/sys/dev/pcmcia/wdc_pcmcia.c       Sun Mar 31 07:11:35 2002 +0000
+++ b/sys/dev/pcmcia/wdc_pcmcia.c       Sun Mar 31 07:19:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_pcmcia.c,v 1.46 2002/01/29 00:31:55 simonb Exp $ */
+/*     $NetBSD: wdc_pcmcia.c,v 1.47 2002/03/31 07:19:03 martin Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.46 2002/01/29 00:31:55 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.47 2002/03/31 07:19:03 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -452,18 +452,18 @@
        struct wdc_pcmcia_softc *sc = (void *)self;
 
        if (onoff) {
+               /* Establish the interrupt handler. */
+               sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
+                   wdcintr, &sc->wdc_channel);
+               if (sc->sc_ih == NULL) {
+                       printf("%s: "
+                           "couldn't establish interrupt handler\n",
+                           sc->sc_wdcdev.sc_dev.dv_xname);
+                       return (EIO);
+               }
+
                /* See the comment in aic_pcmcia_enable */
                if ((sc->sc_flags & WDC_PCMCIA_ATTACH) == 0) {
-                       /* Establish the interrupt handler. */
-                       sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
-                           wdcintr, &sc->wdc_channel);
-                       if (sc->sc_ih == NULL) {
-                               printf("%s: "
-                                   "couldn't establish interrupt handler\n",
-                                   sc->sc_wdcdev.sc_dev.dv_xname);
-                               return (EIO);
-                       }
-
                        if (pcmcia_function_enable(sc->sc_pf)) {
                                printf("%s: couldn't enable PCMCIA function\n",
                                    sc->sc_wdcdev.sc_dev.dv_xname);
@@ -474,8 +474,7 @@
                }
        } else {
                pcmcia_function_disable(sc->sc_pf);
-               if ((sc->sc_flags & WDC_PCMCIA_ATTACH) == 0)
-                       pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
+               pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
        }
 
        return (0);



Home | Main Index | Thread Index | Old Index