diff options
author | hselasky <hselasky@FreeBSD.org> | 2011-11-19 10:11:50 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2011-11-19 10:11:50 +0000 |
commit | 3bcdb8772aed66918259718d05cb24d56914ab89 (patch) | |
tree | d8ce224aa83a7409b55f7416386eadc3d984598d /sys/dev/ahci/ahci.c | |
parent | 57eff55b88ea3dc6a4a8cc80becb3dc21dcbf80c (diff) | |
download | FreeBSD-src-3bcdb8772aed66918259718d05cb24d56914ab89.zip FreeBSD-src-3bcdb8772aed66918259718d05cb24d56914ab89.tar.gz |
Move the device_delete_all_children() function from usb_util.c
to kern/subr_bus.c. Simplify this function so that it no longer
depends on malloc() to execute. Identify a few other places where
it makes sense to use device_delete_all_children().
MFC after: 1 week
Diffstat (limited to 'sys/dev/ahci/ahci.c')
-rw-r--r-- | sys/dev/ahci/ahci.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index 4de14c9..6aa131c 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -515,15 +515,11 @@ static int ahci_detach(device_t dev) { struct ahci_controller *ctlr = device_get_softc(dev); - device_t *children; - int nchildren, i; + int i; /* Detach & delete all children */ - if (!device_get_children(dev, &children, &nchildren)) { - for (i = 0; i < nchildren; i++) - device_delete_child(dev, children[i]); - free(children, M_TEMP); - } + device_delete_all_children(dev); + /* Free interrupts. */ for (i = 0; i < ctlr->numirqs; i++) { if (ctlr->irqs[i].r_irq) { |