diff options
| author | Warner Losh <imp@FreeBSD.org> | 2005-02-08 05:45:35 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2005-02-08 05:45:35 +0000 |
| commit | 9d512034e36a103319e6e870cccc2bf4ec31bbf7 (patch) | |
| tree | 37cc39199a86704ae89359f1c5fc272b93ca8187 /sys/dev/ed | |
| parent | 442b6e9e8c3d1bfbdaff5fc6d9a9af72ec1c66f5 (diff) | |
Notes
Diffstat (limited to 'sys/dev/ed')
| -rw-r--r-- | sys/dev/ed/if_ed.c | 20 | ||||
| -rw-r--r-- | sys/dev/ed/if_ed_cbus.c | 1 | ||||
| -rw-r--r-- | sys/dev/ed/if_ed_isa.c | 1 | ||||
| -rw-r--r-- | sys/dev/ed/if_ed_pccard.c | 23 | ||||
| -rw-r--r-- | sys/dev/ed/if_ed_pci.c | 1 | ||||
| -rw-r--r-- | sys/dev/ed/if_edvar.h | 1 |
6 files changed, 25 insertions, 22 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 132975377a11..10385f4b2708 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -1779,6 +1779,26 @@ ed_attach(dev) } /* + * Detach the driver from the hardware and other systems in the kernel. + */ +int +ed_detach(device_t dev) +{ + struct ed_softc *sc = device_get_softc(dev); + struct ifnet *ifp = &sc->arpcom.ac_if; + + if (sc->gone) + return (0); + ed_stop(sc); + ifp->if_flags &= ~IFF_RUNNING; + ether_ifdetach(ifp); + sc->gone = 1; + bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); + ed_release_resources(dev); + return (0); +} + +/* * Reset interface. */ static void diff --git a/sys/dev/ed/if_ed_cbus.c b/sys/dev/ed/if_ed_cbus.c index 1f8424355c1f..328c50ee1bb9 100644 --- a/sys/dev/ed/if_ed_cbus.c +++ b/sys/dev/ed/if_ed_cbus.c @@ -1743,6 +1743,7 @@ static device_method_t ed_isa_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ed_isa_probe), DEVMETHOD(device_attach, ed_isa_attach), + DEVMETHOD(device_attach, ed_detach), { 0, 0 } }; diff --git a/sys/dev/ed/if_ed_isa.c b/sys/dev/ed/if_ed_isa.c index 3a5804c8dcdd..bf2c40fb7f74 100644 --- a/sys/dev/ed/if_ed_isa.c +++ b/sys/dev/ed/if_ed_isa.c @@ -148,6 +148,7 @@ static device_method_t ed_isa_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ed_isa_probe), DEVMETHOD(device_attach, ed_isa_attach), + DEVMETHOD(device_detach, ed_detach), { 0, 0 } }; diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c index b1994c311cbc..ad548e2e882b 100644 --- a/sys/dev/ed/if_ed_pccard.c +++ b/sys/dev/ed/if_ed_pccard.c @@ -75,7 +75,6 @@ MODULE_DEPEND(ed, ether, 1, 1, 1); static int ed_pccard_match(device_t); static int ed_pccard_probe(device_t); static int ed_pccard_attach(device_t); -static int ed_pccard_detach(device_t); static int ed_pccard_ax88190(device_t dev); @@ -89,26 +88,6 @@ static void ed_pccard_dlink_mii_writebits(struct ed_softc *sc, u_int val, #endif static int ed_pccard_Linksys(device_t dev); -/* - * ed_pccard_detach - unload the driver and clear the table. - */ -static int -ed_pccard_detach(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - struct ifnet *ifp = &sc->arpcom.ac_if; - - if (sc->gone) - return (0); - ed_stop(sc); - ifp->if_flags &= ~IFF_RUNNING; - ether_ifdetach(ifp); - sc->gone = 1; - bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); - ed_release_resources(dev); - return (0); -} - static const struct ed_product { struct pccard_product prod; int flags; @@ -508,7 +487,7 @@ static device_method_t ed_pccard_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pccard_compat_probe), DEVMETHOD(device_attach, pccard_compat_attach), - DEVMETHOD(device_detach, ed_pccard_detach), + DEVMETHOD(device_detach, ed_detach), #ifndef ED_NO_MIIBUS /* Bus interface */ diff --git a/sys/dev/ed/if_ed_pci.c b/sys/dev/ed/if_ed_pci.c index e8d12b84fabd..71fe49940cfa 100644 --- a/sys/dev/ed/if_ed_pci.c +++ b/sys/dev/ed/if_ed_pci.c @@ -109,6 +109,7 @@ static device_method_t ed_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ed_pci_probe), DEVMETHOD(device_attach, ed_pci_attach), + DEVMETHOD(device_attach, ed_detach), { 0, 0 } }; diff --git a/sys/dev/ed/if_edvar.h b/sys/dev/ed/if_edvar.h index 2bbec486ffa0..ff693f403f99 100644 --- a/sys/dev/ed/if_edvar.h +++ b/sys/dev/ed/if_edvar.h @@ -205,6 +205,7 @@ int ed_probe_Novell_generic(device_t, int); int ed_probe_HP_pclanp(device_t, int, int); int ed_attach(device_t); +int ed_detach(device_t); void ed_stop(struct ed_softc *); void ed_pio_readmem(struct ed_softc *, long, unsigned char *, unsigned short); void ed_pio_writemem(struct ed_softc *, char *, unsigned short, unsigned short); |
