| 111 | } |
| 112 | |
| 113 | static rt_err_t platform_probe(rt_device_t dev) |
| 114 | { |
| 115 | rt_err_t err; |
| 116 | struct rt_platform_driver *pdrv = rt_container_of(dev->drv, struct rt_platform_driver, parent); |
| 117 | struct rt_platform_device *pdev = rt_container_of(dev, struct rt_platform_device, parent); |
| 118 | #ifdef RT_USING_OFW |
| 119 | struct rt_ofw_node *np = dev->ofw_node; |
| 120 | #endif |
| 121 | |
| 122 | err = rt_dm_power_domain_attach(dev, RT_TRUE); |
| 123 | |
| 124 | if (err && err != -RT_EEMPTY) |
| 125 | { |
| 126 | LOG_E("Attach power domain error = %s in device %s", rt_strerror(err), |
| 127 | #ifdef RT_USING_OFW |
| 128 | (pdev->name && pdev->name[0]) ? pdev->name : rt_ofw_node_full_name(np) |
| 129 | #else |
| 130 | pdev->name |
| 131 | #endif |
| 132 | ); |
| 133 | |
| 134 | return err; |
| 135 | } |
| 136 | |
| 137 | err = pdrv->probe(pdev); |
| 138 | |
| 139 | if (!err) |
| 140 | { |
| 141 | #ifdef RT_USING_OFW |
| 142 | if (np) |
| 143 | { |
| 144 | rt_ofw_node_set_flag(np, RT_OFW_F_READLY); |
| 145 | } |
| 146 | #endif |
| 147 | } |
| 148 | else |
| 149 | { |
| 150 | if (err == -RT_ENOMEM) |
| 151 | { |
| 152 | LOG_W("System not memory in driver %s", pdrv->name); |
| 153 | } |
| 154 | |
| 155 | rt_dm_power_domain_detach(dev, RT_TRUE); |
| 156 | } |
| 157 | |
| 158 | return err; |
| 159 | } |
| 160 | |
| 161 | static rt_err_t platform_remove(rt_device_t dev) |
| 162 | { |
nothing calls this directly
no test coverage detected