summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-01-27 04:51:44 +0000
committerimp <imp@FreeBSD.org>2005-01-27 04:51:44 +0000
commite8b751aa121c53b1fb1405c12d37288a8b19eeb5 (patch)
treefbafcf5be882bfacebecf9d49426a05b2a944467
parent2b6ce5da9ae2cd14984cd591ccb22338eb83f624 (diff)
downloadFreeBSD-src-e8b751aa121c53b1fb1405c12d37288a8b19eeb5.zip
FreeBSD-src-e8b751aa121c53b1fb1405c12d37288a8b19eeb5.tar.gz
Write cs_detach() and use it. This resolves the twin problems of the
cs1 interface linger on card eject, as well as the warnings about the card still using resources. Ooops.
-rw-r--r--sys/dev/cs/if_cs.c16
-rw-r--r--sys/dev/cs/if_cs_pccard.c2
-rw-r--r--sys/dev/cs/if_csvar.h1
3 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c
index a8f0580..01f4d7b 100644
--- a/sys/dev/cs/if_cs.c
+++ b/sys/dev/cs/if_cs.c
@@ -689,6 +689,22 @@ cs_attach(device_t dev)
return (0);
}
+int
+cs_detach(device_t dev)
+{
+ struct cs_softc *sc;
+ struct ifnet *ifp;
+
+ sc = device_get_softc(dev);
+ ifp = &sc->arpcom.ac_if;
+
+ cs_stop(sc);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ether_ifdetach(ifp);
+ cs_release_resources(dev);
+ return (0);
+}
+
/*
* Initialize the board
*/
diff --git a/sys/dev/cs/if_cs_pccard.c b/sys/dev/cs/if_cs_pccard.c
index c7b3eca5..29c6d7a 100644
--- a/sys/dev/cs/if_cs_pccard.c
+++ b/sys/dev/cs/if_cs_pccard.c
@@ -114,9 +114,7 @@ static device_method_t cs_pccard_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, pccard_compat_probe),
DEVMETHOD(device_attach, pccard_compat_attach),
-#ifdef CS_HAS_DETACH
DEVMETHOD(device_detach, cs_detach),
-#endif
/* Card interface */
DEVMETHOD(card_compat_match, cs_pccard_match),
diff --git a/sys/dev/cs/if_csvar.h b/sys/dev/cs/if_csvar.h
index 0222841..2e2991a 100644
--- a/sys/dev/cs/if_csvar.h
+++ b/sys/dev/cs/if_csvar.h
@@ -72,6 +72,7 @@ int cs_alloc_memory(device_t dev, int rid, int size);
int cs_alloc_irq(device_t dev, int rid, int flags);
int cs_attach(device_t dev);
int cs_cs89x0_probe(device_t dev);
+int cs_detach(device_t dev);
void cs_release_resources(device_t dev);
driver_intr_t csintr;
OpenPOWER on IntegriCloud