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

Function rt_driver_register

components/drivers/core/driver.c:19–37  ·  view source on GitHub ↗

* This function attach a driver to bus * * @param drv the driver to be attached */

Source from the content-addressed store, hash-verified

17 * @param drv the driver to be attached
18 */
19rt_err_t rt_driver_register(rt_driver_t drv)
20{
21 rt_err_t ret;
22 struct rt_bus *bus = RT_NULL;
23
24 RT_ASSERT(drv != RT_NULL);
25
26 if (drv->bus)
27 {
28 bus = drv->bus;
29 ret = rt_bus_add_driver(bus, drv);
30 }
31 else
32 {
33 ret = -RT_EINVAL;
34 }
35
36 return ret;
37}
38RTM_EXPORT(rt_driver_register);
39
40/**

Callers 5

rt_pci_driver_registerFunction · 0.85
rt_spi_driver_registerFunction · 0.85
rt_phy_driver_registerFunction · 0.85
rt_i2c_driver_registerFunction · 0.85

Calls 1

rt_bus_add_driverFunction · 0.85

Tested by

no test coverage detected