Establish the interrupt handler AFTER we successfully attach. We need

to do this in case we have a shared interrupt that fires during the
attach process....
This commit is contained in:
Warner Losh 2009-04-18 03:10:28 +00:00
parent 77a6714a6d
commit 74677fb82b
4 changed files with 29 additions and 22 deletions

View File

@ -242,15 +242,18 @@ ed_cbus_attach(dev)
ed_alloc_irq(dev, sc->irq_rid, 0);
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
NULL, edintr, sc, &sc->irq_handle);
if (sc->sc_media_ioctl == NULL)
ed_gen_ifmedia_init(sc);
error = ed_attach(dev);
if (error) {
ed_release_resources(dev);
return (error);
}
if (sc->sc_media_ioctl == NULL)
ed_gen_ifmedia_init(sc);
return ed_attach(dev);
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
NULL, edintr, sc, &sc->irq_handle);
if (error)
ed_release_resources(dev);
return (error);
}
/*

View File

@ -169,15 +169,18 @@ ed_isa_attach(device_t dev)
ed_alloc_irq(dev, sc->irq_rid, 0);
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
NULL, edintr, sc, &sc->irq_handle);
if (sc->sc_media_ioctl == NULL)
ed_gen_ifmedia_init(sc);
error = ed_attach(dev);
if (error) {
ed_release_resources(dev);
return (error);
}
if (sc->sc_media_ioctl == NULL)
ed_gen_ifmedia_init(sc);
return ed_attach(dev);
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
NULL, edintr, sc, &sc->irq_handle);
if (error)
ed_release_resources(dev);
return (error);
}
static device_method_t ed_isa_methods[] = {

View File

@ -495,13 +495,6 @@ ed_pccard_attach(device_t dev)
if (error)
goto bad;
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
NULL, edintr, sc, &sc->irq_handle);
if (error) {
device_printf(dev, "setup intr failed %d \n", error);
goto bad;
}
/*
* There are several ways to get the MAC address for the card.
* Some of the above probe routines can fill in the enaddr. If
@ -589,6 +582,14 @@ ed_pccard_attach(device_t dev)
}
if (sc->modem_rid != -1)
ed_pccard_add_modem(dev);
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
NULL, edintr, sc, &sc->irq_handle);
if (error) {
device_printf(dev, "setup intr failed %d \n", error);
goto bad;
}
return (0);
bad:
ed_detach(dev);

View File

@ -110,15 +110,15 @@ ed_pci_attach(device_t dev)
ed_release_resources(dev);
return (error);
}
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
NULL, edintr, sc, &sc->irq_handle);
if (sc->sc_media_ioctl == NULL)
ed_gen_ifmedia_init(sc);
error = ed_attach(dev);
if (error) {
ed_release_resources(dev);
return (error);
}
if (sc->sc_media_ioctl == NULL)
ed_gen_ifmedia_init(sc);
error = ed_attach(dev);
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
NULL, edintr, sc, &sc->irq_handle);
if (error)
ed_release_resources(dev);
return (error);