Ignore:
File:
1 edited

Legend:

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

    r7711296 r2179cf95  
    7676{
    7777        CHECK_CONNECTION(connection);
    78 
     78       
    7979        async_exch_t *exch = async_exchange_begin(connection->hc_sess);
    80         if (!exch)
    81                 return (usb_address_t)ENOMEM;
    82 
    83         usb_address_t address = preferred;
    84         const int ret = usbhc_request_address(exch, &address, strict, speed);
    85 
     80       
     81        sysarg_t address;
     82        int rc = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     83            IPC_M_USBHC_REQUEST_ADDRESS, preferred, strict, speed, &address);
     84       
    8685        async_exchange_end(exch);
    87         return ret == EOK ? address : ret;
     86       
     87        if (rc != EOK)
     88                return (usb_address_t) rc;
     89       
     90        return (usb_address_t) address;
    8891}
    8992
     
    9497 * @return Error code.
    9598 */
    96 int usb_hc_register_device(usb_hc_connection_t *connection,
     99int usb_hc_register_device(usb_hc_connection_t * connection,
    97100    const usb_hub_attached_device_t *attached_device)
    98101{
    99102        CHECK_CONNECTION(connection);
    100         if (attached_device == NULL || attached_device->fun == NULL)
    101                 return EINVAL;
    102 
     103       
     104        if (attached_device == NULL)
     105                return EBADMEM;
     106       
    103107        async_exch_t *exch = async_exchange_begin(connection->hc_sess);
    104         if (!exch)
    105                 return ENOMEM;
    106         const int ret = usbhc_bind_address(exch,
     108        int rc = async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     109            IPC_M_USBHC_BIND_ADDRESS,
    107110            attached_device->address, attached_device->fun->handle);
    108111        async_exchange_end(exch);
    109 
    110         return ret;
     112       
     113        return rc;
    111114}
    112115
     
    121124{
    122125        CHECK_CONNECTION(connection);
    123 
     126       
    124127        async_exch_t *exch = async_exchange_begin(connection->hc_sess);
    125         if (!exch)
    126                 return ENOMEM;
    127         const int ret = usbhc_release_address(exch, address);
     128        int rc = async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     129            IPC_M_USBHC_RELEASE_ADDRESS, address);
    128130        async_exchange_end(exch);
    129 
    130         return ret;
     131       
     132        return rc;
    131133}
    132134
     
    219221 *      request or requests for descriptors when creating match ids).
    220222 */
    221 int usb_hc_new_device_wrapper(ddf_dev_t *parent,
    222     usb_hc_connection_t *connection, usb_speed_t dev_speed,
     223int usb_hc_new_device_wrapper(ddf_dev_t *parent, usb_hc_connection_t *connection,
     224    usb_speed_t dev_speed,
    223225    int (*enable_port)(void *arg), void *arg, usb_address_t *assigned_address,
    224226    ddf_dev_ops_t *dev_ops, void *new_dev_data, ddf_fun_t **new_fun)
     
    227229                return EINVAL;
    228230
     231        // FIXME: this is awful, we are accessing directly the structure.
    229232        // TODO: Why not use provided connection?
    230         usb_hc_connection_t hc_conn;
    231         usb_hc_connection_initialize(&hc_conn, connection->hc_handle);
     233        usb_hc_connection_t hc_conn = {
     234                .hc_handle = connection->hc_handle,
     235                .hc_sess = NULL
     236        };
    232237
    233238        int rc;
Note: See TracChangeset for help on using the changeset viewer.