Changeset 05a119b in mainline


Ignore:
Timestamp:
2011-10-13T20:28:32Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
359d96f
Parents:
22a2b763
Message:

usbflbk: Implement device_gone.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbflbk/main.c

    r22a2b763 r05a119b  
    6464        }
    6565
     66        dev->driver_data = ctl_fun;
     67
    6668        usb_log_info("Pretending to control %s `%s'" \
    6769            " (node `%s', handle %" PRIun ").\n",
     
    7274}
    7375
     76/** Callback when new device is removed and recognized as gone by DDF.
     77 *
     78 * @param dev Representation of a generic DDF device.
     79 * @return Error code.
     80 */
     81static int usbfallback_device_gone(usb_device_t *dev)
     82{
     83        assert(dev);
     84        ddf_fun_t *ctl_fun = dev->driver_data;
     85        const int ret = ddf_fun_unbind(ctl_fun);
     86        if (ret != EOK) {
     87                usb_log_error("Failed to unbind %s.\n", ctl_fun->name);
     88                return ret;
     89        }
     90        ddf_fun_destroy(ctl_fun);
     91        dev->driver_data = NULL;
     92
     93        return EOK;
     94}
    7495/** USB fallback driver ops. */
    7596static usb_driver_ops_t usbfallback_driver_ops = {
    7697        .device_add = usbfallback_device_add,
     98        .device_gone = usbfallback_device_gone,
    7799};
    78100
Note: See TracChangeset for help on using the changeset viewer.