diff options
| author | Matthew N. Dodd <mdodd@FreeBSD.org> | 2003-03-29 22:27:41 +0000 |
|---|---|---|
| committer | Matthew N. Dodd <mdodd@FreeBSD.org> | 2003-03-29 22:27:41 +0000 |
| commit | 672fc9ebf62c50f4d95bcb81251c8b41f33761eb (patch) | |
| tree | be62e62d30921bff99da6055e80e0cf3a53f379b /sys/dev/ep | |
| parent | 29c331bfaacacee69d3ab8a74d525dfb2dfe352a (diff) | |
Notes
Diffstat (limited to 'sys/dev/ep')
| -rw-r--r-- | sys/dev/ep/if_ep.c | 27 | ||||
| -rw-r--r-- | sys/dev/ep/if_ep_eisa.c | 1 | ||||
| -rw-r--r-- | sys/dev/ep/if_ep_isa.c | 1 | ||||
| -rw-r--r-- | sys/dev/ep/if_ep_mca.c | 1 | ||||
| -rw-r--r-- | sys/dev/ep/if_ep_pccard.c | 19 | ||||
| -rw-r--r-- | sys/dev/ep/if_epvar.h | 1 |
6 files changed, 32 insertions, 18 deletions
diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index 7d49e7610401..fd3d90ad2fa5 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -263,6 +263,8 @@ ep_free(device_t dev) { struct ep_softc * sc = device_get_softc(dev); + if (sc->ep_intrhand) + bus_teardown_intr(dev, sc->irq, sc->ep_intrhand); if (sc->iobase) bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->iobase); if (sc->irq) @@ -351,6 +353,31 @@ ep_attach(sc) return 0; } +int +ep_detach(device_t dev) +{ + struct ep_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + ifp = &sc->arpcom.ac_if; + + if (sc->gone) { + device_printf(dev, "already unloaded\n"); + return (0); + } + + epstop(sc); + + ifp->if_flags &= ~IFF_RUNNING; + ether_ifdetach(ifp); + + sc->gone = 1; + ep_free(dev); + + return (0); +} + /* * The order in here seems important. Otherwise we may not receive * interrupts. ?! diff --git a/sys/dev/ep/if_ep_eisa.c b/sys/dev/ep/if_ep_eisa.c index ac6738a8efd9..afae38955ac1 100644 --- a/sys/dev/ep/if_ep_eisa.c +++ b/sys/dev/ep/if_ep_eisa.c @@ -250,6 +250,7 @@ static device_method_t ep_eisa_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ep_eisa_probe), DEVMETHOD(device_attach, ep_eisa_attach), + DEVMETHOD(device_detach, ep_detach), { 0, 0 } }; diff --git a/sys/dev/ep/if_ep_isa.c b/sys/dev/ep/if_ep_isa.c index c47f1d827ef0..1bef9080868c 100644 --- a/sys/dev/ep/if_ep_isa.c +++ b/sys/dev/ep/if_ep_isa.c @@ -405,6 +405,7 @@ static device_method_t ep_isa_methods[] = { #endif DEVMETHOD(device_probe, ep_isa_probe), DEVMETHOD(device_attach, ep_isa_attach), + DEVMETHOD(device_detach, ep_detach), { 0, 0 } }; diff --git a/sys/dev/ep/if_ep_mca.c b/sys/dev/ep/if_ep_mca.c index 26f3bcaa3551..b3a05067697e 100644 --- a/sys/dev/ep/if_ep_mca.c +++ b/sys/dev/ep/if_ep_mca.c @@ -149,6 +149,7 @@ static device_method_t ep_mca_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ep_mca_probe), DEVMETHOD(device_attach, ep_mca_attach), + DEVMETHOD(device_detach, ep_detach), { 0, 0 } }; diff --git a/sys/dev/ep/if_ep_pccard.c b/sys/dev/ep/if_ep_pccard.c index a4be882455fc..ca30515a24ad 100644 --- a/sys/dev/ep/if_ep_pccard.c +++ b/sys/dev/ep/if_ep_pccard.c @@ -236,23 +236,6 @@ bad: return (error); } -static int -ep_pccard_detach(device_t dev) -{ - struct ep_softc *sc = device_get_softc(dev); - - if (sc->gone) { - device_printf(dev, "already unloaded\n"); - return (0); - } - sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING; - ether_ifdetach(&sc->arpcom.ac_if); - sc->gone = 1; - bus_teardown_intr(dev, sc->irq, sc->ep_intrhand); - ep_free(dev); - return (0); -} - static const struct pccard_product ep_pccard_products[] = { PCMCIA_CARD(3COM, 3C1, 0), PCMCIA_CARD(3COM, 3C562, 0), @@ -281,7 +264,7 @@ static device_method_t ep_pccard_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pccard_compat_probe), DEVMETHOD(device_attach, pccard_compat_attach), - DEVMETHOD(device_detach, ep_pccard_detach), + DEVMETHOD(device_detach, ep_detach), /* Card interface */ DEVMETHOD(card_compat_match, ep_pccard_match), diff --git a/sys/dev/ep/if_epvar.h b/sys/dev/ep/if_epvar.h index f32a8013ba36..b9d410783bdd 100644 --- a/sys/dev/ep/if_epvar.h +++ b/sys/dev/ep/if_epvar.h @@ -76,6 +76,7 @@ struct ep_softc { int ep_alloc (device_t); void ep_free (device_t); +int ep_detach (device_t); void ep_get_media (struct ep_softc *); int ep_attach (struct ep_softc *); void ep_intr (void *); |
