Changeset bd7acda in mainline for uspace/lib


Ignore:
Timestamp:
2011-05-28T23:01:20Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
95067954, 98e15b1
Parents:
a066122c (diff), a2a3763 (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:

Fix various leakages

Add function for destroying whole usb device.

Hackingly fixed phone leakage in console.

Location:
uspace/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/include/usbhc_iface.h

    ra066122c rbd7acda  
    212212/** USB host controller communication interface. */
    213213typedef struct {
    214         int (*reserve_default_address)(ddf_fun_t *, usb_speed_t);
    215         int (*release_default_address)(ddf_fun_t *);
    216214        int (*request_address)(ddf_fun_t *, usb_speed_t, usb_address_t *);
    217215        int (*bind_address)(ddf_fun_t *, usb_address_t, devman_handle_t);
  • uspace/lib/usbdev/include/usb/dev/driver.h

    ra066122c rbd7acda  
    168168int usb_device_destroy_pipes(ddf_dev_t *, usb_endpoint_mapping_t *, size_t);
    169169int usb_device_create(ddf_dev_t *, usb_endpoint_description_t **, usb_device_t **, const char **);
     170void usb_device_destroy(usb_device_t *);
    170171
    171172size_t usb_interface_count_alternates(uint8_t *, size_t, uint8_t);
  • uspace/lib/usbdev/src/devdrv.c

    ra066122c rbd7acda  
    533533}
    534534
     535/** Destroy instance of a USB device.
     536 *
     537 * @param dev Device to be destroyed.
     538 */
     539void usb_device_destroy(usb_device_t *dev)
     540{
     541        if (dev == NULL) {
     542                return;
     543        }
     544
     545        /* Ignore errors and hope for the best. */
     546        usb_device_destroy_pipes(dev->ddf_dev, dev->pipes, dev->pipes_count);
     547        if (dev->descriptors.configuration != NULL) {
     548                free(dev->descriptors.configuration);
     549        }
     550
     551        if (dev->alternate_interfaces != NULL) {
     552                if (dev->alternate_interfaces->alternatives != NULL) {
     553                        free(dev->alternate_interfaces->alternatives);
     554                }
     555                free(dev->alternate_interfaces);
     556        }
     557
     558        free(dev);
     559}
     560
    535561/**
    536562 * @}
Note: See TracChangeset for help on using the changeset viewer.