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

Function devclass_driver_added

freebsd/kern/subr_bus.c:1065–1093  ·  view source on GitHub ↗

* @brief Register that a device driver has been added to a devclass * * Register that a device driver has been added to a devclass. This * is called by devclass_add_driver to accomplish the recursive * notification of all the children classes of dc, as well as dc. * Each layer will have BUS_DRIVER_ADDED() called for all instances of * the devclass. * * We do a full search here of the devc

Source from the content-addressed store, hash-verified

1063 * @param driver the driver that was just added
1064 */
1065static void
1066devclass_driver_added(devclass_t dc, driver_t *driver)
1067{
1068 devclass_t parent;
1069 int i;
1070
1071 /*
1072 * Call BUS_DRIVER_ADDED for any existing buses in this class.
1073 */
1074 for (i = 0; i < dc->maxunit; i++)
1075 if (dc->devices[i] && device_is_attached(dc->devices[i]))
1076 BUS_DRIVER_ADDED(dc->devices[i], driver);
1077
1078 /*
1079 * Walk through the children classes. Since we only keep a
1080 * single parent pointer around, we walk the entire list of
1081 * devclasses looking for children. We set the
1082 * DC_HAS_CHILDREN flag when a child devclass is created on
1083 * the parent, so we only walk the list for those devclasses
1084 * that have children.
1085 */
1086 if (!(dc->flags & DC_HAS_CHILDREN))
1087 return;
1088 parent = dc;
1089 TAILQ_FOREACH(dc, &devclasses, link) {
1090 if (dc->parent == parent)
1091 devclass_driver_added(dc, driver);
1092 }
1093}
1094
1095/**
1096 * @brief Add a device driver to a device class

Callers 2

devclass_add_driverFunction · 0.85

Calls 1

device_is_attachedFunction · 0.85

Tested by

no test coverage detected