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


Ignore:
Timestamp:
2013-01-26T18:59:37Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f4138ac
Parents:
b208b3b
Message:

libusbdev: Make pipes_destroy a member function.

File:
1 edited

Legend:

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

    rb208b3b r2dc5a9f  
    5454}
    5555
    56 /** Destroy existing pipes of a USB device.
    57  *
    58  * @param dev Device where to destroy the pipes.
    59  */
    60 static void destroy_current_pipes(usb_device_t *dev)
    61 {
    62         usb_device_destroy_pipes(dev->pipes, dev->pipes_count);
    63         dev->pipes = NULL;
    64         dev->pipes_count = 0;
    65 }
    66 
    6756/** Change interface setting of a device.
    6857 * This function selects new alternate setting of an interface by issuing
     
    9584
    9685        /* Destroy existing pipes. */
    97         destroy_current_pipes(dev);
     86        usb_device_destroy_pipes(dev);
    9887
    9988        /* Change the interface itself. */
     
    257246/** Destroy pipes previously created by usb_device_create_pipes.
    258247 *
    259  * @param[in] pipes Endpoint mapping to be destroyed.
    260  * @param[in] pipes_count Number of endpoints.
    261  */
    262 void usb_device_destroy_pipes(usb_endpoint_mapping_t *pipes, size_t pipes_count)
    263 {
     248 * @param[in] usb_dev USB device.
     249 */
     250void usb_device_destroy_pipes(usb_device_t *usb_dev)
     251{
     252        assert(usb_dev);
     253        assert(usb_dev->pipes || usb_dev->pipes_count == 0);
    264254        /* Destroy the pipes. */
    265         for (size_t i = 0; i < pipes_count; ++i) {
    266                 assert(pipes);
     255        for (size_t i = 0; i < usb_dev->pipes_count; ++i) {
    267256                usb_log_debug2("Unregistering pipe %zu: %spresent.\n",
    268                     i, pipes[i].present ? "" : "not ");
    269                 if (pipes[i].present)
    270                         usb_pipe_unregister(&pipes[i].pipe);
    271         }
    272         free(pipes);
     257                    i, usb_dev->pipes[i].present ? "" : "not ");
     258                if (usb_dev->pipes[i].present)
     259                        usb_pipe_unregister(&usb_dev->pipes[i].pipe);
     260        }
     261        free(usb_dev->pipes);
     262        usb_dev->pipes = NULL;
     263        usb_dev->pipes_count = 0;
    273264}
    274265
     
    424415                usb_dev_session_close(dev->bus_session);
    425416                /* Destroy existing pipes. */
    426                 destroy_current_pipes(dev);
     417                usb_device_destroy_pipes(dev);
    427418                /* Ignore errors and hope for the best. */
    428419                usb_hc_connection_deinitialize(&dev->hc_conn);
Note: See TracChangeset for help on using the changeset viewer.