MCPcopy Create free account
hub / github.com/F-Stack/f-stack / device_add_child_ordered

Function device_add_child_ordered

freebsd/kern/subr_bus.c:1885–1922  ·  view source on GitHub ↗

* @brief Create a new device * * This creates a new device and adds it as a child of an existing * parent device. The new device will be added after the last existing * child with the same order. * * @param dev the device which will be the parent of the * new child device * @param order a value which is used to partially sort the * children of @p dev - devices created using * low

Source from the content-addressed store, hash-verified

1883 * @returns the new device
1884 */
1885device_t
1886device_add_child_ordered(device_t dev, u_int order, const char *name, int unit)
1887{
1888 device_t child;
1889 device_t place;
1890
1891 PDEBUG(("%s at %s with order %u as unit %d",
1892 name, DEVICENAME(dev), order, unit));
1893 KASSERT(name != NULL || unit == -1,
1894 ("child device with wildcard name and specific unit number"));
1895
1896 child = make_device(dev, name, unit);
1897 if (child == NULL)
1898 return (child);
1899 child->order = order;
1900
1901 TAILQ_FOREACH(place, &dev->children, link) {
1902 if (place->order > order)
1903 break;
1904 }
1905
1906 if (place) {
1907 /*
1908 * The device 'place' is the first device whose order is
1909 * greater than the new child.
1910 */
1911 TAILQ_INSERT_BEFORE(place, child, link);
1912 } else {
1913 /*
1914 * The new child's order is greater or equal to the order of
1915 * any existing device. Add the child to the tail of the list.
1916 */
1917 TAILQ_INSERT_TAIL(&dev->children, child, link);
1918 }
1919
1920 bus_data_generation_update();
1921 return (child);
1922}
1923
1924/**
1925 * @brief Delete a device

Callers 11

apb_add_childFunction · 0.85
apb_add_childFunction · 0.85
nexus_add_childFunction · 0.85
nexus_add_childFunction · 0.85
nexus_add_childFunction · 0.85
mv_pcib_ctrl_add_childFunction · 0.85
device_add_childFunction · 0.85
bus_generic_add_childFunction · 0.85
legacy_add_childFunction · 0.85
cpu_add_childFunction · 0.85
nexus_add_childFunction · 0.85

Calls 2

make_deviceFunction · 0.85

Tested by

no test coverage detected