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