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

Function rt_bus_remove_driver

components/drivers/core/bus.c:303–330  ·  view source on GitHub ↗

* @brief This function remove a driver from bus * * @param drv the driver to be removed * * @return the error code, RT_EOK on added successfully. */

Source from the content-addressed store, hash-verified

301 * @return the error code, RT_EOK on added successfully.
302 */
303rt_err_t rt_bus_remove_driver(rt_driver_t drv)
304{
305 rt_err_t err;
306 rt_bus_t bus;
307
308 RT_ASSERT(drv != RT_NULL);
309 RT_ASSERT(drv->bus != RT_NULL);
310
311 bus = drv->bus;
312
313 LOG_D("Bus(%s) remove driver %s", bus->name, drv->parent.name);
314
315 _dm_bus_lock(&bus->drv_lock);
316
317 if (drv->ref_count)
318 {
319 err = -RT_EBUSY;
320 }
321 else
322 {
323 rt_list_remove(&drv->node);
324 err = RT_EOK;
325 }
326
327 _dm_bus_unlock(&bus->drv_lock);
328
329 return err;
330}
331
332/**
333 * @brief This function remove a device from bus

Callers 1

rt_driver_unregisterFunction · 0.85

Calls 3

_dm_bus_lockFunction · 0.85
rt_list_removeFunction · 0.85
_dm_bus_unlockFunction · 0.85

Tested by

no test coverage detected