| 75 | } |
| 76 | |
| 77 | static 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 | |
| 113 | static rt_err_t platform_probe(rt_device_t dev) |
| 114 | { |
nothing calls this directly
no test coverage detected