summaryrefslogtreecommitdiff
path: root/sys/dev/pcmcia/aic_pcmcia.c
diff options
context:
space:
mode:
authorMartin Reindl <martin@cvs.openbsd.org>2006-06-03 01:51:55 +0000
committerMartin Reindl <martin@cvs.openbsd.org>2006-06-03 01:51:55 +0000
commitdc6c763056c86017636eaf1e517e04bc4021028a (patch)
treeb78f01ea2740abda1d5b65335a566d758fd23aef /sys/dev/pcmcia/aic_pcmcia.c
parent3ed81cc35202943b15b616655050eb149b5e5d7c (diff)
make detachable, inspired by netbsd
Diffstat (limited to 'sys/dev/pcmcia/aic_pcmcia.c')
-rw-r--r--sys/dev/pcmcia/aic_pcmcia.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/dev/pcmcia/aic_pcmcia.c b/sys/dev/pcmcia/aic_pcmcia.c
index af33de81eeb..2a56ef686c1 100644
--- a/sys/dev/pcmcia/aic_pcmcia.c
+++ b/sys/dev/pcmcia/aic_pcmcia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic_pcmcia.c,v 1.14 2006/06/02 06:26:15 martin Exp $ */
+/* $OpenBSD: aic_pcmcia.c,v 1.15 2006/06/03 01:51:54 martin Exp $ */
/* $NetBSD: aic_pcmcia.c,v 1.6 1998/07/19 17:28:15 christos Exp $ */
/*
@@ -50,6 +50,7 @@
int aic_pcmcia_match(struct device *, void *, void *);
void aic_pcmcia_attach(struct device *, struct device *, void *);
+int aic_pcmcia_detach(struct device *, int);
struct aic_pcmcia_softc {
struct aic_softc sc_aic; /* real "aic" softc */
@@ -62,7 +63,8 @@ struct aic_pcmcia_softc {
};
struct cfattach aic_pcmcia_ca = {
- sizeof(struct aic_pcmcia_softc), aic_pcmcia_match, aic_pcmcia_attach
+ sizeof(struct aic_pcmcia_softc), aic_pcmcia_match, aic_pcmcia_attach,
+ aic_pcmcia_detach
};
struct aic_pcmcia_product {
@@ -170,3 +172,22 @@ aic_pcmcia_attach(parent, self, aux)
aicattach(sc);
}
+
+int
+aic_pcmcia_detach(self, flags)
+ struct device *self;
+ int flags;
+{
+ struct aic_pcmcia_softc *sc= (void *)self;
+ int error;
+
+ error = aic_detach(self, flags);
+ if (error)
+ return (error);
+
+ /* Unmap our i/o window and i/o space. */
+ pcmcia_io_unmap(sc->sc_pf, sc->sc_io_window);
+ pcmcia_io_free(sc->sc_pf, &sc->sc_pcioh);
+
+ return (0);
+}