Correct the intr_establish order here.

This commit is contained in:
mycroft 2004-08-09 18:51:32 +00:00
parent 7b96c587dc
commit f65dd54152
3 changed files with 31 additions and 34 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ray.c,v 1.46 2004/08/07 05:35:50 mycroft Exp $ */
/* $NetBSD: if_ray.c,v 1.47 2004/08/09 18:51:32 mycroft Exp $ */
/*
* Copyright (c) 2000 Christian E. Hopps
* All rights reserved.
@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.46 2004/08/07 05:35:50 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.47 2004/08/09 18:51:32 mycroft Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -707,14 +707,15 @@ ray_enable(sc)
RAY_DPRINTF(("%s: enable\n", sc->sc_xname));
if ((error = ray_init(sc)) == 0) {
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET,
ray_intr, sc);
if (sc->sc_ih == NULL) {
ray_stop(sc);
return (EIO);
}
}
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET,
ray_intr, sc);
if (sc->sc_ih == NULL)
return (EIO);
error = ray_init(sc);
if (error)
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
return (error);
}

View File

@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isic_pcmcia.c,v 1.23 2004/01/04 12:41:46 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: isic_pcmcia.c,v 1.24 2004/08/09 18:51:32 mycroft Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@ -205,7 +205,6 @@ isic_pcmcia_attach(parent, self, aux)
struct pcmcia_attach_args *pa = aux;
struct pcmcia_config_entry *cfe;
const struct isic_pcmcia_card_entry * cde;
int s;
psc->sc_pf = pa->pf;
cfe = SIMPLEQ_FIRST(&pa->pf->cfe_head);
@ -222,34 +221,28 @@ isic_pcmcia_attach(parent, self, aux)
/* Enable the card */
pcmcia_function_init(pa->pf, cfe);
psc->sc_ih = pcmcia_intr_establish(pa->pf, IPL_NET, isicintr, sc);
pcmcia_function_enable(pa->pf);
if (!cde->attach(psc, cfe, pa)) {
pcmcia_function_disable(psc->sc_pf);
printf("%s: attach failed, card-specific attach unsuccesful\n",
psc->sc_isic.sc_dev.dv_xname);
return;
goto fail;
}
/* XXX - we generate interrupts during card initialization.
Block them for now, until the handler is established. */
s = splhigh();
/* MI initilization */
sc->sc_cardtyp = cde->card_type;
if (isic_pcmcia_isdn_attach(sc, cde->name) == 0) {
/* setup interrupt */
psc->sc_ih = pcmcia_intr_establish(pa->pf, IPL_NET, isicintr, sc);
} else {
pcmcia_function_disable(psc->sc_pf);
splx(s);
printf("%s: attach failed, couldn't establish interrupt\n",
if (isic_pcmcia_isdn_attach(sc, cde->name)) {
printf("%s: attach failed, generic attach unsuccesful\n",
psc->sc_isic.sc_dev.dv_xname);
return;
goto fail;
}
splx(s);
return;
fail:
pcmcia_function_disable(psc->sc_pf);
pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih);
}
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcmcom.c,v 1.15 2004/08/08 23:17:13 mycroft Exp $ */
/* $NetBSD: pcmcom.c,v 1.16 2004/08/09 18:51:32 mycroft Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.15 2004/08/08 23:17:13 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.16 2004/08/09 18:51:32 mycroft Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -392,9 +392,9 @@ int
pcmcom_enable(sc)
struct pcmcom_softc *sc;
{
int error;
sc->sc_enabled_count++;
if (sc->sc_enabled_count > 1)
if (sc->sc_enabled_count++ != 0)
return (0);
/* Establish the interrupt. */
@ -406,7 +406,11 @@ pcmcom_enable(sc)
return (1);
}
return (pcmcia_function_enable(sc->sc_pf));
error = pcmcia_function_enable(sc->sc_pf);
if (error)
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
return (error);
}
void
@ -414,8 +418,7 @@ pcmcom_disable(sc)
struct pcmcom_softc *sc;
{
sc->sc_enabled_count--;
if (sc->sc_enabled_count != 0)
if (--sc->sc_enabled_count != 0)
return;
pcmcia_function_disable(sc->sc_pf);