subr_bus.c (70d8f36aa445e4556ead4de32f9b7b4687d95098) | subr_bus.c (11bcf702f4200a351f06b549e14bc9ea4fc76dcc) |
---|---|
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 --- 1867 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/** | 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 --- 1867 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 --- 791 unchanged lines hidden (view full) --- 2683 2684 device_sysctl_init(dev); 2685 if (!device_is_quiet(dev)) 2686 device_print_child(dev->parent, dev); 2687 if ((error = DEVICE_ATTACH(dev)) != 0) { 2688 printf("device_attach: %s%d attach returned %d\n", 2689 dev->driver->name, dev->unit, error); 2690 /* Unset the class; set in device_probe_child */ | 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 --- 791 unchanged lines hidden (view full) --- 2716 2717 device_sysctl_init(dev); 2718 if (!device_is_quiet(dev)) 2719 device_print_child(dev->parent, dev); 2720 if ((error = DEVICE_ATTACH(dev)) != 0) { 2721 printf("device_attach: %s%d attach returned %d\n", 2722 dev->driver->name, dev->unit, error); 2723 /* Unset the class; set in device_probe_child */ |
2691 if ((dev->flags & DF_FIXEDCLASS) == 0) | 2724 if (dev->devclass == NULL) |
2692 device_set_devclass(dev, NULL); 2693 device_set_driver(dev, NULL); 2694 device_sysctl_fini(dev); 2695 dev->state = DS_NOTPRESENT; 2696 return (error); 2697 } 2698 device_sysctl_update(dev); 2699 dev->state = DS_ATTACHED; --- 2048 unchanged lines hidden --- | 2725 device_set_devclass(dev, NULL); 2726 device_set_driver(dev, NULL); 2727 device_sysctl_fini(dev); 2728 dev->state = DS_NOTPRESENT; 2729 return (error); 2730 } 2731 device_sysctl_update(dev); 2732 dev->state = DS_ATTACHED; --- 2048 unchanged lines hidden --- |