diff options
| author | Nate Lawson <njl@FreeBSD.org> | 2007-03-23 19:45:53 +0000 |
|---|---|---|
| committer | Nate Lawson <njl@FreeBSD.org> | 2007-03-23 19:45:53 +0000 |
| commit | 241808c81e80599215f8e277dc6d53520ce405df (patch) | |
| tree | 90848d98f57bba7e62d582d85c63b6267c10f216 /sys/dev/ppbus | |
| parent | 17c6d188934bbf401b02197c86fc81b0a7e65d52 (diff) | |
Notes
Diffstat (limited to 'sys/dev/ppbus')
| -rw-r--r-- | sys/dev/ppbus/lpt.c | 16 | ||||
| -rw-r--r-- | sys/dev/ppbus/ppbconf.c | 18 |
2 files changed, 34 insertions, 0 deletions
diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index dec1084eca97..2a17969058c0 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -409,6 +409,21 @@ lpt_attach(device_t dev) return (0); } +static int +lpt_detach(device_t dev) +{ + struct lpt_data *sc = DEVTOSOFTC(dev); + + lpt_release_ppbus(dev); + if (sc->intr_resource != 0) { + BUS_TEARDOWN_INTR(device_get_parent(dev), dev, + sc->intr_resource, sc->intr_cookie); + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->intr_resource); + } + + return (0); +} + static void lptout(void *arg) { @@ -954,6 +969,7 @@ static device_method_t lpt_methods[] = { DEVMETHOD(device_identify, lpt_identify), DEVMETHOD(device_probe, lpt_probe), DEVMETHOD(device_attach, lpt_attach), + DEVMETHOD(device_detach, lpt_detach), { 0, 0 } }; diff --git a/sys/dev/ppbus/ppbconf.c b/sys/dev/ppbus/ppbconf.c index 1ad27f8febd3..53421a22c29b 100644 --- a/sys/dev/ppbus/ppbconf.c +++ b/sys/dev/ppbus/ppbconf.c @@ -399,6 +399,23 @@ ppbus_attach(device_t dev) } static int +ppbus_detach(device_t dev) +{ + device_t *children; + int nchildren, i; + + /* detach & delete all children */ + if (!device_get_children(dev, &children, &nchildren)) { + for (i = 0; i < nchildren; i++) + if (children[i]) + device_delete_child(dev, children[i]); + free(children, M_TEMP); + } + + return (0); +} + +static int ppbus_setup_intr(device_t bus, device_t child, struct resource *r, int flags, void (*ihand)(void *), void *arg, void **cookiep) { @@ -539,6 +556,7 @@ static device_method_t ppbus_methods[] = { /* device interface */ DEVMETHOD(device_probe, ppbus_probe), DEVMETHOD(device_attach, ppbus_attach), + DEVMETHOD(device_detach, ppbus_detach), /* bus interface */ DEVMETHOD(bus_add_child, ppbus_add_child), |
