MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_bus_add_driver

Function rt_bus_add_driver

components/drivers/core/bus.c:253–268  ·  view source on GitHub ↗

* @brief This function add a driver to the drv_list of a specific bus * * @param bus the bus to add * * @param drv the driver to be added * * @return the error code, RT_EOK on added successfully. */

Source from the content-addressed store, hash-verified

251 * @return the error code, RT_EOK on added successfully.
252 */
253rt_err_t rt_bus_add_driver(rt_bus_t bus, rt_driver_t drv)
254{
255 RT_ASSERT(bus != RT_NULL);
256 RT_ASSERT(drv != RT_NULL);
257
258 drv->bus = bus;
259 rt_list_init(&drv->node);
260
261 _dm_bus_lock(&bus->drv_lock);
262 rt_list_insert_before(&bus->drv_list, &drv->node);
263 _dm_bus_unlock(&bus->drv_lock);
264
265 rt_bus_for_each_dev(bus, drv, bus_probe_driver);
266
267 return RT_EOK;
268}
269
270/**
271 * @brief This function add a device to the dev_list of a specific bus

Callers 1

rt_driver_registerFunction · 0.85

Calls 5

rt_list_initFunction · 0.85
_dm_bus_lockFunction · 0.85
rt_list_insert_beforeFunction · 0.85
_dm_bus_unlockFunction · 0.85
rt_bus_for_each_devFunction · 0.85

Tested by

no test coverage detected