Ignore:
File:
1 edited

Legend:

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

    rb7fd2a0 r5a6cc679  
    6262        errno_t rc = usb_device_create_ddf(gen_dev, driver->endpoints, &err_msg);
    6363        if (rc != EOK) {
    64                 usb_log_error("USB device `%s' init failed (%s): %s.\n",
     64                usb_log_error("USB device `%s' init failed (%s): %s.",
    6565                    ddf_dev_get_name(gen_dev), err_msg, str_error(rc));
    6666                return rc;
     
    8585        assert(driver);
    8686        assert(driver->ops);
    87         if (driver->ops->device_rem == NULL)
     87        if (driver->ops->device_remove == NULL)
    8888                return ENOTSUP;
     89
    8990        /* Just tell the driver to stop whatever it is doing */
    9091        usb_device_t *usb_dev = ddf_dev_data_get(gen_dev);
    91         const errno_t ret = driver->ops->device_rem(usb_dev);
     92        const errno_t ret = driver->ops->device_remove(usb_dev);
    9293        if (ret != EOK)
    9394                return ret;
     95
    9496        usb_device_destroy_ddf(gen_dev);
    9597        return EOK;
     
    117119}
    118120
     121/** Callback when the driver is asked to online a specific function.
     122 *
     123 * This callback is a wrapper for USB specific version of @c fun_online.
     124 *
     125 * @param gen_dev Device function structure as prepared by DDF.
     126 * @return Error code.
     127 */
     128static int generic_function_online(ddf_fun_t *fun)
     129{
     130        assert(driver);
     131        assert(driver->ops);
     132        if (driver->ops->function_online == NULL)
     133                return ENOTSUP;
     134        return driver->ops->function_online(fun);
     135}
     136
     137/** Callback when the driver is asked to offline a specific function.
     138 *
     139 * This callback is a wrapper for USB specific version of @c fun_offline.
     140 *
     141 * @param gen_dev Device function structure as prepared by DDF.
     142 * @return Error code.
     143 */
     144static int generic_function_offline(ddf_fun_t *fun)
     145{
     146        assert(driver);
     147        assert(driver->ops);
     148        if (driver->ops->function_offline == NULL)
     149                return ENOTSUP;
     150        return driver->ops->function_offline(fun);
     151}
     152
    119153static driver_ops_t generic_driver_ops = {
    120154        .dev_add = generic_device_add,
    121155        .dev_remove = generic_device_remove,
    122156        .dev_gone = generic_device_gone,
     157        .fun_online = generic_function_online,
     158        .fun_offline = generic_function_offline,
    123159};
    124160static driver_t generic_driver = {
Note: See TracChangeset for help on using the changeset viewer.