Ignore:
File:
1 edited

Legend:

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

    r3ddbd38 r277ff98  
    349349        fibril_mutex_initialize(&pipe->guard);
    350350        pipe->wire = connection;
    351         pipe->hc_sess = NULL;
    352         fibril_mutex_initialize(&pipe->hc_sess_mutex);
    353351        pipe->endpoint_no = endpoint_no;
    354352        pipe->transfer_type = transfer_type;
    355353        pipe->max_packet_size = max_packet_size;
    356354        pipe->direction = direction;
    357         pipe->refcount = 0;
    358         pipe->refcount_soft = 0;
    359355        pipe->auto_reset_halt = false;
    360356
     
    375371        assert(connection);
    376372
    377         int rc = usb_pipe_initialize(pipe, connection,
    378             0, USB_TRANSFER_CONTROL, CTRL_PIPE_MIN_PACKET_SIZE,
    379             USB_DIRECTION_BOTH);
     373        int rc = usb_pipe_initialize(pipe, connection, 0, USB_TRANSFER_CONTROL,
     374            CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH);
    380375
    381376        pipe->auto_reset_halt = true;
     
    442437 * @return Error code.
    443438 */
    444 int usb_pipe_register(usb_pipe_t *pipe, unsigned interval,
    445     usb_hc_connection_t *hc_connection)
     439int usb_pipe_register(usb_pipe_t *pipe, unsigned interval)
    446440{
    447441        assert(pipe);
    448442        assert(pipe->wire);
    449         assert(hc_connection);
    450 
    451         if (!usb_hc_connection_is_opened(hc_connection))
    452                 return EBADF;
    453         async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess);
    454         if (!exch)
    455                 return ENOMEM;
    456         const int ret = usbhc_register_endpoint(exch,
    457             pipe->wire->address, pipe->endpoint_no, pipe->transfer_type,
    458             pipe->direction, pipe->max_packet_size, interval);
    459 
    460         async_exchange_end(exch);
    461         return ret;
     443        assert(pipe->wire->hc_connection);
     444
     445        return usb_hc_register_endpoint(pipe->wire->hc_connection,
     446           pipe->wire->address, pipe->endpoint_no, pipe->transfer_type,
     447           pipe->direction, pipe->max_packet_size, interval);
    462448}
    463449
     
    468454 * @return Error code.
    469455 */
    470 int usb_pipe_unregister(usb_pipe_t *pipe,
    471     usb_hc_connection_t *hc_connection)
     456int usb_pipe_unregister(usb_pipe_t *pipe)
    472457{
    473458        assert(pipe);
    474459        assert(pipe->wire);
    475         assert(hc_connection);
    476 
    477         if (!usb_hc_connection_is_opened(hc_connection))
    478                 return EBADF;
    479 
    480         async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess);
    481         if (!exch)
    482                 return ENOMEM;
    483         const int ret = usbhc_unregister_endpoint(exch,
     460        assert(pipe->wire->hc_connection);
     461
     462        return usb_hc_unregister_endpoint(pipe->wire->hc_connection,
    484463            pipe->wire->address, pipe->endpoint_no, pipe->direction);
    485         async_exchange_end(exch);
    486 
    487         return ret;
    488464}
    489465
Note: See TracChangeset for help on using the changeset viewer.