summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-03-29 22:27:41 +0000
committermdodd <mdodd@FreeBSD.org>2003-03-29 22:27:41 +0000
commit446c24ca7a6af68dfed415abc309c05b74ba2e28 (patch)
treebe62e62d30921bff99da6055e80e0cf3a53f379b /sys/dev
parentcdc67e7072fb97bd41f4db2549ff13b3366ae34d (diff)
downloadFreeBSD-src-446c24ca7a6af68dfed415abc309c05b74ba2e28.zip
FreeBSD-src-446c24ca7a6af68dfed415abc309c05b74ba2e28.tar.gz
- Free interrupt handler in ep_free().
- Move ep_pccard_detach() to if_ep.c and rename to ep_detach() - Specify detach methods for all bus frontends.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ep/if_ep.c27
-rw-r--r--sys/dev/ep/if_ep_eisa.c1
-rw-r--r--sys/dev/ep/if_ep_isa.c1
-rw-r--r--sys/dev/ep/if_ep_mca.c1
-rw-r--r--sys/dev/ep/if_ep_pccard.c19
-rw-r--r--sys/dev/ep/if_epvar.h1
6 files changed, 32 insertions, 18 deletions
diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c
index 7d49e76..fd3d90a 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 ac6738a..afae389 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 c47f1d8..1bef908 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 26f3bca..b3a0506 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 a4be882..ca30515 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 f32a801..b9d4107 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 *);
OpenPOWER on IntegriCloud