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