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


Ignore:
Timestamp:
2011-12-11T16:30:42Z (14 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/pipesinit.c

    r2c202c5 rbd575647  
    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
     
    442438 * @return Error code.
    443439 */
    444 int usb_pipe_register(usb_pipe_t *pipe, unsigned interval,
    445     usb_hc_connection_t *hc_connection)
     440int usb_pipe_register(usb_pipe_t *pipe, unsigned interval)
    446441{
    447442        assert(pipe);
    448443        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;
     444        assert(pipe->wire->hc_connection);
     445
     446        return usb_hc_register_endpoint(pipe->wire->hc_connection,
     447           pipe->wire->address, pipe->endpoint_no, pipe->transfer_type,
     448           pipe->direction, pipe->max_packet_size, interval);
    462449}
    463450
     
    468455 * @return Error code.
    469456 */
    470 int usb_pipe_unregister(usb_pipe_t *pipe,
    471     usb_hc_connection_t *hc_connection)
     457int usb_pipe_unregister(usb_pipe_t *pipe)
    472458{
    473459        assert(pipe);
    474460        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,
     461        assert(pipe->wire->hc_connection);
     462
     463        return usb_hc_unregister_endpoint(pipe->wire->hc_connection,
    484464            pipe->wire->address, pipe->endpoint_no, pipe->direction);
    485         async_exchange_end(exch);
    486 
    487         return ret;
    488465}
    489466
Note: See TracChangeset for help on using the changeset viewer.