Changes in uspace/lib/usb/src/recognise.c [0f21c0c:3f0ef89d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/recognise.c
r0f21c0c r3f0ef89d 34 34 */ 35 35 #include <sys/types.h> 36 #include <fibril_synch.h> 36 37 #include <usb/pipes.h> 37 38 #include <usb/recognise.h> … … 41 42 #include <stdio.h> 42 43 #include <errno.h> 44 #include <assert.h> 43 45 44 46 static size_t device_name_index = 0; 45 47 static FIBRIL_MUTEX_INITIALIZE(device_name_index_mutex); 46 48 47 d evice_ops_t child_ops = {49 ddf_dev_ops_t child_ops = { 48 50 .interfaces[USB_DEV_IFACE] = &usb_iface_hub_child_impl 49 51 }; … … 308 310 } 309 311 310 /*311 * As a fallback, provide the simplest match id possible.312 */313 ADD_MATCHID_OR_RETURN(matches, 1, "usb&fallback");314 315 312 return EOK; 316 313 } … … 326 323 int usb_device_register_child_in_devman(usb_address_t address, 327 324 devman_handle_t hc_handle, 328 device_t *parent, devman_handle_t *child_handle) 325 ddf_dev_t *parent, devman_handle_t *child_handle, 326 ddf_dev_ops_t *dev_ops, void *dev_data, ddf_fun_t **child_fun) 329 327 { 330 328 size_t this_device_name_index; … … 335 333 fibril_mutex_unlock(&device_name_index_mutex); 336 334 337 d evice_t *child = NULL;335 ddf_fun_t *child = NULL; 338 336 char *child_name = NULL; 339 337 int rc; … … 352 350 } 353 351 354 child = create_device(); 352 /* 353 * TODO: Once the device driver framework support persistent 354 * naming etc., something more descriptive could be created. 355 */ 356 rc = asprintf(&child_name, "usbdev%02zu", this_device_name_index); 357 if (rc < 0) { 358 goto failure; 359 } 360 361 child = ddf_fun_create(parent, fun_inner, child_name); 355 362 if (child == NULL) { 356 363 rc = ENOMEM; … … 358 365 } 359 366 360 /* 361 * TODO: Once the device driver framework support persistent 362 * naming etc., something more descriptive could be created. 363 */ 364 rc = asprintf(&child_name, "usbdev%02zu", this_device_name_index); 365 if (rc < 0) { 366 goto failure; 367 } 368 child->parent = parent; 369 child->name = child_name; 370 child->ops = &child_ops; 367 if (dev_ops != NULL) { 368 child->ops = dev_ops; 369 } else { 370 child->ops = &child_ops; 371 } 372 373 child->driver_data = dev_data; 371 374 372 375 rc = usb_endpoint_pipe_start_session(&ctrl_pipe); … … 385 388 } 386 389 387 rc = child_device_register(child, parent);390 rc = ddf_fun_bind(child); 388 391 if (rc != EOK) { 389 392 goto failure; … … 392 395 if (child_handle != NULL) { 393 396 *child_handle = child->handle; 397 } 398 399 if (child_fun != NULL) { 400 *child_fun = child; 394 401 } 395 402 … … 400 407 child->name = NULL; 401 408 /* This takes care of match_id deallocation as well. */ 402 d elete_device(child);409 ddf_fun_destroy(child); 403 410 } 404 411 if (child_name != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.