Changeset 844f4ef in mainline


Ignore:
Timestamp:
2011-10-12T18:27:05Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9636bad
Parents:
7be3638
Message:

libusbdev: Implement generic gone and remove callbacks.

File:
1 edited

Legend:

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

    r7be3638 r844f4ef  
    151151                return rc;
    152152        }
     153        gen_dev->driver_data = dev;
    153154
    154155        return driver->ops->device_add(dev);
     
    161162        if (driver->ops->device_rem == NULL)
    162163                return ENOTSUP;
    163 
    164         return ENOTSUP;
     164        /* Just tell the driver to stop whatever it is doing, keep structures */
     165        return driver->ops->device_rem(gen_dev->driver_data);
    165166}
    166167/*----------------------------------------------------------------------------*/
     
    169170        assert(driver);
    170171        assert(driver->ops);
    171         assert(driver->ops->device_gone);
    172 
    173         return ENOTSUP;
     172        if (driver->ops->device_gone == NULL)
     173                return ENOTSUP;
     174        const int ret = driver->ops->device_gone(gen_dev->driver_data);
     175        if (ret == EOK)
     176                usb_device_destroy(gen_dev->driver_data);
     177
     178        return ret;
    174179}
    175180/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.