Changeset bd575647 in mainline for uspace/lib/usbdev/src/devdrv.c


Ignore:
Timestamp:
2011-12-11T16:30:42Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d5ef94
Parents:
2c202c5
Message:

libusbdev: Use shared hc_connection for pipes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/devdrv.c

    r2c202c5 rbd575647  
    373373        }
    374374
    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 
    387375        for (i = 0; i < pipe_count; i++) {
    388376                if (pipes[i].present) {
    389377                        rc = usb_pipe_register(&pipes[i].pipe,
    390                             pipes[i].descriptor->poll_interval, &hc_conn);
     378                            pipes[i].descriptor->poll_interval);
    391379                        if (rc != EOK) {
    392380                                goto rollback_unregister_endpoints;
     
    394382                }
    395383        }
    396 
    397         if (usb_hc_connection_close(&hc_conn) != EOK)
    398                 usb_log_warning("%s: Failed to close connection.\n",
    399                     __FUNCTION__);
    400384
    401385        *pipes_ptr = pipes;
     
    415399        for (i = 0; i < pipe_count; i++) {
    416400                if (pipes[i].present) {
    417                         usb_pipe_unregister(&pipes[i].pipe, &hc_conn);
     401                        usb_pipe_unregister(&pipes[i].pipe);
    418402                }
    419403        }
    420 
    421         if (usb_hc_connection_close(&hc_conn) != EOK)
    422                 usb_log_warning("usb_device_create_pipes(): "
    423                     "Failed to close connection.\n");
    424404
    425405        /*
     
    470450                    i, pipes[i].present ? "" : "not ");
    471451                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");
     452                        usb_pipe_unregister(&pipes[i].pipe);
     453        }
    478454
    479455        free(pipes);
     
    505481        usb_dev->pipes = NULL;
    506482
     483        usb_hc_connection_initialize_from_device(&usb_dev->hc_conn, ddf_dev);
     484        const usb_address_t address =
     485            usb_get_address_by_handle(ddf_dev->handle);
    507486        /* Initialize backing wire and control pipe. */
    508         int rc = usb_device_connection_initialize_from_device(
    509             &usb_dev->wire, ddf_dev);
     487        int rc = usb_device_connection_initialize(
     488            &usb_dev->wire, &usb_dev->hc_conn, address);
    510489        if (rc != EOK) {
    511490                *errstr_ptr = "device connection initialization";
Note: See TracChangeset for help on using the changeset viewer.