From 11bcf702f4200a351f06b549e14bc9ea4fc76dcc Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Sat, 19 Nov 2011 10:11:50 +0000 Subject: 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 --- sys/dev/ppc/ppc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'sys/dev/ppc') diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c index 1322a33a112d..ef505d87d7d6 100644 --- a/sys/dev/ppc/ppc.c +++ b/sys/dev/ppc/ppc.c @@ -1851,20 +1851,13 @@ int ppc_detach(device_t dev) { struct ppc_data *ppc = DEVTOSOFTC(dev); - device_t *children; - int nchildren, i; if (ppc->res_irq == 0) { return (ENXIO); } /* 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); - } + device_delete_all_children(dev); if (ppc->res_irq != 0) { bus_teardown_intr(dev, ppc->res_irq, ppc->intr_cookie); -- cgit v1.3