aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ed
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2009-04-18 03:10:28 +0000
committerWarner Losh <imp@FreeBSD.org>2009-04-18 03:10:28 +0000
commit74677fb82b415bb4f1c81d5fa4a9b2704f682201 (patch)
tree3072d3eb02a44a13a41b884b04a608d1fdf0104f /sys/dev/ed
parent77a6714a6dd46b49b14a0eccf3b73c0ac21eeb79 (diff)
downloadsrc-74677fb82b415bb4f1c81d5fa4a9b2704f682201.tar.gz
src-74677fb82b415bb4f1c81d5fa4a9b2704f682201.zip
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....
Notes
Notes: svn path=/head/; revision=191234
Diffstat (limited to 'sys/dev/ed')
-rw-r--r--sys/dev/ed/if_ed_cbus.c13
-rw-r--r--sys/dev/ed/if_ed_isa.c13
-rw-r--r--sys/dev/ed/if_ed_pccard.c15
-rw-r--r--sys/dev/ed/if_ed_pci.c10
4 files changed, 29 insertions, 22 deletions
diff --git a/sys/dev/ed/if_ed_cbus.c b/sys/dev/ed/if_ed_cbus.c
index bcc0d85b7cf5..73026198bf51 100644
--- a/sys/dev/ed/if_ed_cbus.c
+++ b/sys/dev/ed/if_ed_cbus.c
@@ -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);
}
/*
diff --git a/sys/dev/ed/if_ed_isa.c b/sys/dev/ed/if_ed_isa.c
index 1beac2720bd3..c3fd8f695425 100644
--- a/sys/dev/ed/if_ed_isa.c
+++ b/sys/dev/ed/if_ed_isa.c
@@ -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[] = {
diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c
index 647c301a971f..7fb9e50bb2a3 100644
--- a/sys/dev/ed/if_ed_pccard.c
+++ b/sys/dev/ed/if_ed_pccard.c
@@ -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);
diff --git a/sys/dev/ed/if_ed_pci.c b/sys/dev/ed/if_ed_pci.c
index 1b2e17d8a6ab..21ddb741ae8d 100644
--- a/sys/dev/ed/if_ed_pci.c
+++ b/sys/dev/ed/if_ed_pci.c
@@ -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);