* @brief Delete all children devices of the given device, if any. * * This function deletes all children devices of the given device, if * any, using the device_delete_child() function for each device it * finds. If a child device cannot be deleted, this function will * return an error code. * * @param dev the parent device * * @retval 0 success * @retval non-zero a device would not de
| 1979 | * @retval non-zero a device would not detach |
| 1980 | */ |
| 1981 | int |
| 1982 | device_delete_children(device_t dev) |
| 1983 | { |
| 1984 | device_t child; |
| 1985 | int error; |
| 1986 | |
| 1987 | PDEBUG(("Deleting all children of %s", DEVICENAME(dev))); |
| 1988 | |
| 1989 | error = 0; |
| 1990 | |
| 1991 | while ((child = TAILQ_FIRST(&dev->children)) != NULL) { |
| 1992 | error = device_delete_child(dev, child); |
| 1993 | if (error) { |
| 1994 | PDEBUG(("Failed deleting %s", DEVICENAME(child))); |
| 1995 | break; |
| 1996 | } |
| 1997 | } |
| 1998 | return (error); |
| 1999 | } |
| 2000 | |
| 2001 | /** |
| 2002 | * @brief Find a device given a unit number |
no test coverage detected