From 6d37025002122638a66a27e17552d5b208e4f78f Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 31 Mar 2002 07:19:03 +0000 Subject: [PATCH] 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. --- sys/dev/pcmcia/wdc_pcmcia.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sys/dev/pcmcia/wdc_pcmcia.c b/sys/dev/pcmcia/wdc_pcmcia.c index cdc94dfcb8a0..9199ab542e46 100644 --- a/sys/dev/pcmcia/wdc_pcmcia.c +++ b/sys/dev/pcmcia/wdc_pcmcia.c @@ -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 -__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 #include @@ -452,18 +452,18 @@ wdc_pcmcia_enable(self, onoff) 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 @@ wdc_pcmcia_enable(self, onoff) } } 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);