Changeset 54cbda2 in mainline


Ignore:
Timestamp:
2011-12-14T22:26:22Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4291215
Parents:
8e3742f9
Message:

libusbdev: Add support for dev_remove.

File:
1 edited

Legend:

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

    r8e3742f9 r54cbda2  
    102102        assert(driver->ops->device_add);
    103103
     104        /* Get place for driver data. */
    104105        usb_device_t *dev = ddf_dev_data_alloc(gen_dev, sizeof(usb_device_t));
    105106        if (dev == NULL) {
     
    108109                return ENOMEM;
    109110        }
     111
     112        /* Initialize generic USB driver data. */
    110113        const char *err_msg = NULL;
    111114        int rc = usb_device_init(dev, gen_dev, driver->endpoints, &err_msg);
     
    116119        }
    117120
     121        /* Start USB driver specific initialization. */
    118122        rc = driver->ops->device_add(dev);
    119123        if (rc != EOK)
     
    135139        if (driver->ops->device_rem == NULL)
    136140                return ENOTSUP;
    137         /* Just tell the driver to stop whatever it is doing, keep structures */
    138         const int ret = driver->ops->device_rem(gen_dev->driver_data);
     141        /* Just tell the driver to stop whatever it is doing */
     142        usb_device_t *usb_dev = gen_dev->driver_data;
     143        const int ret = driver->ops->device_rem(usb_dev);
    139144        if (ret != EOK)
    140145                return ret;
    141         return ENOTSUP;
     146        usb_device_deinit(usb_dev);
     147        return EOK;
    142148}
    143149/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.