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

Function platform_match

components/drivers/core/platform.c:77–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77static rt_bool_t platform_match(rt_driver_t drv, rt_device_t dev)
78{
79 struct rt_platform_driver *pdrv = rt_container_of(drv, struct rt_platform_driver, parent);
80 struct rt_platform_device *pdev = rt_container_of(dev, struct rt_platform_device, parent);
81 struct rt_ofw_node *np = dev->ofw_node;
82
83 /* 1、match with ofw node */
84 if (np)
85 {
86 #ifdef RT_USING_OFW
87 pdev->id = rt_ofw_node_match(np, pdrv->ids);
88 #else
89 pdev->id = RT_NULL;
90 #endif
91 if (pdev->id)
92 {
93 return RT_TRUE;
94 }
95 }
96
97 /* 2、match with name */
98 if (pdev->name && pdrv->name)
99 {
100 if (pdev->name == pdrv->name)
101 {
102 return RT_TRUE;
103 }
104 else
105 {
106 return !rt_strcmp(pdrv->name, pdev->name);
107 }
108 }
109
110 return RT_FALSE;
111}
112
113static rt_err_t platform_probe(rt_device_t dev)
114{

Callers

nothing calls this directly

Calls 2

rt_ofw_node_matchFunction · 0.85
rt_strcmpFunction · 0.85

Tested by

no test coverage detected