diff options
author | Martin Reindl <martin@cvs.openbsd.org> | 2006-06-03 01:51:55 +0000 |
---|---|---|
committer | Martin Reindl <martin@cvs.openbsd.org> | 2006-06-03 01:51:55 +0000 |
commit | dc6c763056c86017636eaf1e517e04bc4021028a (patch) | |
tree | b78f01ea2740abda1d5b65335a566d758fd23aef /sys/dev | |
parent | 3ed81cc35202943b15b616655050eb149b5e5d7c (diff) |
make detachable, inspired by netbsd
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/aic6360.c | 13 | ||||
-rw-r--r-- | sys/dev/ic/aic6360var.h | 3 | ||||
-rw-r--r-- | sys/dev/pcmcia/aic_pcmcia.c | 25 |
3 files changed, 37 insertions, 4 deletions
diff --git a/sys/dev/ic/aic6360.c b/sys/dev/ic/aic6360.c index 881b2a79ce7..b2d185cd9b8 100644 --- a/sys/dev/ic/aic6360.c +++ b/sys/dev/ic/aic6360.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic6360.c,v 1.11 2006/05/23 20:42:21 miod Exp $ */ +/* $OpenBSD: aic6360.c,v 1.12 2006/06/03 01:51:54 martin Exp $ */ /* $NetBSD: aic6360.c,v 1.52 1996/12/10 21:27:51 thorpej Exp $ */ #ifdef DDB @@ -296,6 +296,17 @@ aicattach(sc) config_found(&sc->sc_dev, &sc->sc_link, scsiprint); } +int +aic_detach(struct device *self, int flags) +{ + struct aic_softc *sc = (struct aic_softc *) self; + int rv = 0; + + rv = config_detach_children(&sc->sc_dev, flags); + + return (rv); +} + /* Initialize AIC6360 chip itself * The following conditions should hold: * aicprobe should have succeeded, i.e. the ioh handle in aic_softc must diff --git a/sys/dev/ic/aic6360var.h b/sys/dev/ic/aic6360var.h index 7522c88cfdc..07a53c9bf85 100644 --- a/sys/dev/ic/aic6360var.h +++ b/sys/dev/ic/aic6360var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: aic6360var.h,v 1.5 2006/06/02 06:26:15 martin Exp $ */ +/* $OpenBSD: aic6360var.h,v 1.6 2006/06/03 01:51:54 martin Exp $ */ /* $NetBSD: aic6360.c,v 1.52 1996/12/10 21:27:51 thorpej Exp $ */ /* @@ -214,5 +214,6 @@ struct aic_softc { #define AIC_START(s) AIC_PRINT(AIC_SHOWSTART, s) void aicattach(struct aic_softc *); +int aic_detach(struct device *, int); int aicintr(void *); int aic_find(bus_space_tag_t, bus_space_handle_t); 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); +} |