Changes in uspace/lib/usbdev/src/devdrv.c [c0fdc0e:0c0f823b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/devdrv.c
rc0fdc0e r0c0f823b 170 170 return ENOTSUP; 171 171 /* Just tell the driver to stop whatever it is doing, keep structures */ 172 const int ret = driver->ops->device_rem(gen_dev->driver_data); 173 if (ret != EOK) 174 return ret; 175 return ENOTSUP; 172 return driver->ops->device_rem(gen_dev->driver_data); 176 173 } 177 174 /*----------------------------------------------------------------------------*/ … … 376 373 } 377 374 375 /* Register the endpoints with HC. */ 376 usb_hc_connection_t hc_conn; 377 rc = usb_hc_connection_initialize_from_device(&hc_conn, dev); 378 if (rc != EOK) { 379 goto rollback_free_only; 380 } 381 382 rc = usb_hc_connection_open(&hc_conn); 383 if (rc != EOK) { 384 goto rollback_free_only; 385 } 386 378 387 for (i = 0; i < pipe_count; i++) { 379 388 if (pipes[i].present) { 380 389 rc = usb_pipe_register(&pipes[i].pipe, 381 pipes[i].descriptor->poll_interval );390 pipes[i].descriptor->poll_interval, &hc_conn); 382 391 if (rc != EOK) { 383 392 goto rollback_unregister_endpoints; … … 385 394 } 386 395 } 396 397 if (usb_hc_connection_close(&hc_conn) != EOK) 398 usb_log_warning("%s: Failed to close connection.\n", 399 __FUNCTION__); 387 400 388 401 *pipes_ptr = pipes; … … 402 415 for (i = 0; i < pipe_count; i++) { 403 416 if (pipes[i].present) { 404 usb_pipe_unregister(&pipes[i].pipe );417 usb_pipe_unregister(&pipes[i].pipe, &hc_conn); 405 418 } 406 419 } 420 421 if (usb_hc_connection_close(&hc_conn) != EOK) 422 usb_log_warning("usb_device_create_pipes(): " 423 "Failed to close connection.\n"); 407 424 408 425 /* … … 453 470 i, pipes[i].present ? "" : "not "); 454 471 if (pipes[i].present) 455 usb_pipe_unregister(&pipes[i].pipe); 456 } 472 usb_pipe_unregister(&pipes[i].pipe, &hc_conn); 473 } 474 475 if (usb_hc_connection_close(&hc_conn) != EOK) 476 usb_log_warning("usb_device_destroy_pipes(): " 477 "Failed to close connection.\n"); 457 478 458 479 free(pipes); … … 484 505 usb_dev->pipes = NULL; 485 506 486 /* Initialize hc connection. */487 usb_hc_connection_initialize_from_device(&usb_dev->hc_conn, ddf_dev);488 const usb_address_t address =489 usb_get_address_by_handle(ddf_dev->handle);490 491 507 /* Initialize backing wire and control pipe. */ 492 int rc = usb_device_connection_initialize (493 &usb_dev->wire, &usb_dev->hc_conn, address);508 int rc = usb_device_connection_initialize_from_device( 509 &usb_dev->wire, ddf_dev); 494 510 if (rc != EOK) { 495 511 *errstr_ptr = "device connection initialization"; … … 499 515 /* This pipe was registered by the hub driver, 500 516 * during device initialization. */ 501 rc = usb_pipe_initialize_default_control( 502 &usb_dev-> ctrl_pipe, &usb_dev->wire);517 rc = usb_pipe_initialize_default_control(&usb_dev->ctrl_pipe, 518 &usb_dev->wire); 503 519 if (rc != EOK) { 504 520 *errstr_ptr = "default control pipe initialization"; 505 return rc;506 }507 508 rc = usb_hc_connection_open(&usb_dev->hc_conn);509 if (rc != EOK) {510 *errstr_ptr = "hc connection open";511 521 return rc; 512 522 } … … 514 524 /* Get our interface. */ 515 525 usb_dev->interface_no = usb_device_get_assigned_interface(ddf_dev); 526 516 527 /* Retrieve standard descriptors. */ 517 rc = usb_device_retrieve_descriptors( 518 &usb_dev-> ctrl_pipe, &usb_dev->descriptors);528 rc = usb_device_retrieve_descriptors(&usb_dev->ctrl_pipe, 529 &usb_dev->descriptors); 519 530 if (rc != EOK) { 520 531 *errstr_ptr = "descriptor retrieval"; 521 usb_hc_connection_close(&usb_dev->hc_conn);522 532 return rc; 523 533 } … … 536 546 rc = initialize_other_pipes(endpoints, usb_dev, alternate_iface); 537 547 if (rc != EOK) { 538 usb_hc_connection_close(&usb_dev->hc_conn);539 548 /* Full configuration descriptor is allocated. */ 540 549 usb_device_release_descriptors(&usb_dev->descriptors); … … 545 554 } 546 555 547 usb_hc_connection_close(&usb_dev->hc_conn);548 556 return EOK; 549 557 }
Note:
See TracChangeset
for help on using the changeset viewer.