Changeset 747ef72 in mainline for uspace/drv/bus/usb/vhc/connhost.c


Ignore:
Timestamp:
2011-11-10T11:29:10Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
54464f6a, c2245a3, c6f189f7
Parents:
2e1b9dc (diff), 2d1ba51 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge USB changes.

Interface changes:

  • GET_ADDRESS has been renamed to GET_MY_ADDRESS and the handle parameter was dropped. Tis call no longer cascades up to the root hub, but it is answered in the first place the information is available (nearest hub)
  • Reintroduced address reservation for USB_DEFAULT_ADDRESS. The interface now enables device drivers to request specific address on initialization and either insists on that address or accept any other if the address is not available. Note that it is not possible to get the default address if the driver does not insist.
  • Any endpoint registered is removed when address is released and a warning is produced if there were any such endpoints.
  • It is no longer necessary or possible to pass device speed information when registering endpoints.

Driver fixes: memory leaks and crashes (not only) in error paths.
Fixes or removes flaky device_remove implementation in device drivers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/vhc/connhost.c

    r2e1b9dc r747ef72  
    5757 * @return Error code.
    5858 */
    59 static int request_address(ddf_fun_t *fun, usb_speed_t speed,
    60     usb_address_t *address)
    61 {
    62         VHC_DATA(vhc, fun);
    63 
    64         usb_address_t addr = usb_device_manager_get_free_address(
    65             &vhc->dev_manager, USB_SPEED_HIGH);
    66         if (addr < 0) {
    67                 return addr;
    68         }
    69 
    70         if (address != NULL) {
    71                 *address = addr;
    72         }
    73 
    74         return EOK;
     59static int request_address(ddf_fun_t *fun, usb_address_t *address, bool strict,
     60    usb_speed_t speed)
     61{
     62        VHC_DATA(vhc, fun);
     63
     64        assert(address);
     65        return usb_device_manager_request_address(
     66            &vhc->dev_manager, address, strict, speed);
    7567}
    7668
     
    8880        usb_log_debug("Binding handle %" PRIun " to address %d.\n",
    8981            handle, address);
    90         usb_device_manager_bind(&vhc->dev_manager, address, handle);
     82        usb_device_manager_bind_address(&vhc->dev_manager, address, handle);
    9183
    9284        return EOK;
     
    118110        VHC_DATA(vhc, fun);
    119111        usb_log_debug("Releasing address %d...\n", address);
    120         usb_device_manager_release(&vhc->dev_manager, address);
     112        usb_device_manager_release_address(&vhc->dev_manager, address);
    121113
    122114        return ENOTSUP;
     
    136128 */
    137129static int register_endpoint(ddf_fun_t *fun,
    138     usb_address_t address, usb_speed_t speed, usb_endpoint_t endpoint,
     130    usb_address_t address, usb_endpoint_t endpoint,
    139131    usb_transfer_type_t transfer_type, usb_direction_t direction,
    140132    size_t max_packet_size, unsigned int interval)
     
    479471}
    480472
    481 static int tell_address(ddf_fun_t *fun, devman_handle_t handle,
    482     usb_address_t *address)
     473static int tell_address(ddf_fun_t *fun, usb_address_t *address)
    483474{
    484475        UNSUPPORTED("tell_address");
     
    497488}
    498489
    499 static int tell_address_rh(ddf_fun_t *root_hub_fun, devman_handle_t handle,
    500     usb_address_t *address)
     490static int tell_address_rh(ddf_fun_t *root_hub_fun, usb_address_t *address)
    501491{
    502492        VHC_DATA(vhc, root_hub_fun);
    503493
    504         if (handle == 0) {
    505                 handle = root_hub_fun->handle;
    506         }
     494        devman_handle_t handle = root_hub_fun->handle;
    507495
    508496        usb_log_debug("tell_address_rh(handle=%" PRIun ")\n", handle);
     
    532520usb_iface_t vhc_usb_iface = {
    533521        .get_hc_handle = usb_iface_get_hc_handle_hc_impl,
    534         .get_address = tell_address
     522        .get_my_address = tell_address
    535523};
    536524
    537525usb_iface_t rh_usb_iface = {
    538526        .get_hc_handle = usb_iface_get_hc_handle_rh_impl,
    539         .get_address = tell_address_rh
     527        .get_my_address = tell_address_rh
    540528};
    541529
Note: See TracChangeset for help on using the changeset viewer.