subr_bus.c (226175) | subr_bus.c (227701) |
---|---|
1/*- 2 * Copyright (c) 1997,1998,2003 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997,1998,2003 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/kern/subr_bus.c 226175 2011-10-09 21:21:37Z marius $"); | 28__FBSDID("$FreeBSD: head/sys/kern/subr_bus.c 227701 2011-11-19 10:11:50Z hselasky $"); |
29 30#include "opt_bus.h" 31 32#include <sys/param.h> 33#include <sys/conf.h> 34#include <sys/filio.h> 35#include <sys/lock.h> 36#include <sys/kernel.h> --- 1839 unchanged lines hidden (view full) --- 1876 TAILQ_REMOVE(&bus_data_devices, child, devlink); 1877 kobj_delete((kobj_t) child, M_BUS); 1878 1879 bus_data_generation_update(); 1880 return (0); 1881} 1882 1883/** | 29 30#include "opt_bus.h" 31 32#include <sys/param.h> 33#include <sys/conf.h> 34#include <sys/filio.h> 35#include <sys/lock.h> 36#include <sys/kernel.h> --- 1839 unchanged lines hidden (view full) --- 1876 TAILQ_REMOVE(&bus_data_devices, child, devlink); 1877 kobj_delete((kobj_t) child, M_BUS); 1878 1879 bus_data_generation_update(); 1880 return (0); 1881} 1882 1883/** |
1884 * @brief Delete all children devices of the given device, if any. 1885 * 1886 * This function deletes all children devices of the given device, if 1887 * any, using the device_delete_child() function for each device it 1888 * finds. If a child device cannot be deleted, this function will 1889 * return an error code. 1890 * 1891 * @param dev the parent device 1892 * 1893 * @retval 0 success 1894 * @retval non-zero a device would not detach 1895 */ 1896int 1897device_delete_all_children(device_t dev) 1898{ 1899 device_t child; 1900 int error; 1901 1902 PDEBUG(("Deleting all children of %s", DEVICENAME(dev))); 1903 1904 error = 0; 1905 1906 while ( (child = TAILQ_FIRST(&dev->children)) ) { 1907 error = device_delete_child(dev, child); 1908 if (error) { 1909 PDEBUG(("Failed deleting %s", DEVICENAME(child))); 1910 break; 1911 } 1912 } 1913 return (error); 1914} 1915 1916/** |
|
1884 * @brief Find a device given a unit number 1885 * 1886 * This is similar to devclass_get_devices() but only searches for 1887 * devices which have @p dev as a parent. 1888 * 1889 * @param dev the parent device to search 1890 * @param unit the unit number to search for. If the unit is -1, 1891 * return the first child of @p dev which has name --- 2856 unchanged lines hidden --- | 1917 * @brief Find a device given a unit number 1918 * 1919 * This is similar to devclass_get_devices() but only searches for 1920 * devices which have @p dev as a parent. 1921 * 1922 * @param dev the parent device to search 1923 * @param unit the unit number to search for. If the unit is -1, 1924 * return the first child of @p dev which has name --- 2856 unchanged lines hidden --- |