From 3bcdb8772aed66918259718d05cb24d56914ab89 Mon Sep 17 00:00:00 2001 From: hselasky 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/usb/usb_util.c | 25 ------------------------- sys/dev/usb/usb_util.h | 1 - 2 files changed, 26 deletions(-) (limited to 'sys/dev/usb') diff --git a/sys/dev/usb/usb_util.c b/sys/dev/usb/usb_util.c index 1c357a3..a9b1d6f 100644 --- a/sys/dev/usb/usb_util.c +++ b/sys/dev/usb/usb_util.c @@ -58,31 +58,6 @@ #include /*------------------------------------------------------------------------* - * device_delete_all_children - delete all children of a device - *------------------------------------------------------------------------*/ -#ifndef device_delete_all_children -int -device_delete_all_children(device_t dev) -{ - device_t *devlist; - int devcount; - int error; - - error = device_get_children(dev, &devlist, &devcount); - if (error == 0) { - while (devcount-- > 0) { - error = device_delete_child(dev, devlist[devcount]); - if (error) { - break; - } - } - free(devlist, M_TEMP); - } - return (error); -} -#endif - -/*------------------------------------------------------------------------* * device_set_usb_desc * * This function can be called at probe or attach to set the USB diff --git a/sys/dev/usb/usb_util.h b/sys/dev/usb/usb_util.h index 35abedd..7e52404 100644 --- a/sys/dev/usb/usb_util.h +++ b/sys/dev/usb/usb_util.h @@ -27,7 +27,6 @@ #ifndef _USB_UTIL_H_ #define _USB_UTIL_H_ -int device_delete_all_children(device_t dev); uint8_t usb_make_str_desc(void *ptr, uint16_t max_len, const char *s); void usb_printbcd(char *p, uint16_t p_len, uint16_t bcd); void usb_trim_spaces(char *p); -- cgit v1.1