| 146 | } |
| 147 | |
| 148 | error_t driver_unbind(Driver* driver, Device* device) { |
| 149 | error_t error = ERROR_NONE; |
| 150 | if (driver->internal->destroying || !device_is_added(device)) { |
| 151 | error = ERROR_INVALID_STATE; |
| 152 | goto error; |
| 153 | } |
| 154 | |
| 155 | if (driver->stop_device != nullptr) { |
| 156 | error = driver->stop_device(device); |
| 157 | if (error != ERROR_NONE) { |
| 158 | goto error; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | driver->internal->use_count--; |
| 163 | |
| 164 | LOG_I(TAG, "unbound %s from %s", driver->name, device->name); |
| 165 | |
| 166 | return ERROR_NONE; |
| 167 | |
| 168 | error: |
| 169 | return error; |
| 170 | } |
| 171 | |
| 172 | const struct DeviceType* driver_get_device_type(struct Driver* driver) { |
| 173 | return driver->device_type; |
no test coverage detected