summaryrefslogtreecommitdiffstats
path: root/sys/dev/mvs
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2011-11-19 10:11:50 +0000
committerhselasky <hselasky@FreeBSD.org>2011-11-19 10:11:50 +0000
commit3bcdb8772aed66918259718d05cb24d56914ab89 (patch)
treed8ce224aa83a7409b55f7416386eadc3d984598d /sys/dev/mvs
parent57eff55b88ea3dc6a4a8cc80becb3dc21dcbf80c (diff)
downloadFreeBSD-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/mvs')
-rw-r--r--sys/dev/mvs/mvs_pci.c9
-rw-r--r--sys/dev/mvs/mvs_soc.c9
2 files changed, 4 insertions, 14 deletions
diff --git a/sys/dev/mvs/mvs_pci.c b/sys/dev/mvs/mvs_pci.c
index e2e37da..36dd93d 100644
--- a/sys/dev/mvs/mvs_pci.c
+++ b/sys/dev/mvs/mvs_pci.c
@@ -177,15 +177,10 @@ static int
mvs_detach(device_t dev)
{
struct mvs_controller *ctlr = device_get_softc(dev);
- device_t *children;
- int nchildren, 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 interrupt. */
if (ctlr->irq.r_irq) {
bus_teardown_intr(dev, ctlr->irq.r_irq,
diff --git a/sys/dev/mvs/mvs_soc.c b/sys/dev/mvs/mvs_soc.c
index 5c1116c..670bfec 100644
--- a/sys/dev/mvs/mvs_soc.c
+++ b/sys/dev/mvs/mvs_soc.c
@@ -173,15 +173,10 @@ static int
mvs_detach(device_t dev)
{
struct mvs_controller *ctlr = device_get_softc(dev);
- device_t *children;
- int nchildren, 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 interrupt. */
if (ctlr->irq.r_irq) {
bus_teardown_intr(dev, ctlr->irq.r_irq,
OpenPOWER on IntegriCloud