| 89 | } |
| 90 | |
| 91 | static rt_bool_t i2c_match(rt_driver_t drv, rt_device_t dev) |
| 92 | { |
| 93 | const struct rt_i2c_device_id *id; |
| 94 | struct rt_i2c_driver *driver = rt_container_of(drv, struct rt_i2c_driver, parent); |
| 95 | struct rt_i2c_client *client = rt_container_of(dev, struct rt_i2c_client, parent); |
| 96 | |
| 97 | if ((id = driver->ids)) |
| 98 | { |
| 99 | for (; id->name[0]; ++id) |
| 100 | { |
| 101 | if (!rt_strcmp(id->name, client->name)) |
| 102 | { |
| 103 | client->id = id; |
| 104 | client->ofw_id = RT_NULL; |
| 105 | |
| 106 | return RT_TRUE; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | #ifdef RT_USING_OFW |
| 112 | client->ofw_id = rt_ofw_node_match(client->parent.ofw_node, driver->ofw_ids); |
| 113 | |
| 114 | if (client->ofw_id) |
| 115 | { |
| 116 | client->id = RT_NULL; |
| 117 | |
| 118 | return RT_TRUE; |
| 119 | } |
| 120 | #endif |
| 121 | |
| 122 | return RT_FALSE; |
| 123 | } |
| 124 | |
| 125 | static rt_err_t i2c_probe(rt_device_t dev) |
| 126 | { |
nothing calls this directly
no test coverage detected