Changeset 5dfb70c9 in mainline for uspace/drv/bus/usb/uhci/hc.c


Ignore:
Timestamp:
2017-12-29T12:10:56Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5c75456
Parents:
415c5116
Message:

uhci: moved offline call from usbhost, terminating hanging transfers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/hc.c

    r415c5116 r5dfb70c9  
    321321}
    322322
     323static int device_online(device_t *device)
     324{
     325        // FIXME: Implement me!
     326
     327        return ENOTSUP;
     328}
     329
     330static int device_offline(device_t *device)
     331{
     332        hc_t *instance = bus_to_hc(device->bus);
     333        assert(instance);
     334
     335        int err;
     336        /* Tear down all drivers working with the device. */
     337        if ((err = ddf_fun_offline(device->fun))) {
     338                return err;
     339        }
     340
     341        /* At this point, all drivers are assumed to have already terminated
     342         * in a consistent way. The following code just cleans up hanging
     343         * transfers if there are any. */
     344
     345        /* Block creation of new endpoints and transfers. */
     346        usb_log_info("Device(%d): Going offline.", device->address);
     347        fibril_mutex_lock(&device->guard);
     348        device->online = false;
     349        fibril_mutex_unlock(&device->guard);
     350
     351        /* Abort all transfers to all endpoints. */
     352        transfer_list_abort_device(&instance->transfers_interrupt, device->address);
     353        transfer_list_abort_device(&instance->transfers_control_slow, device->address);
     354        transfer_list_abort_device(&instance->transfers_control_full, device->address);
     355        transfer_list_abort_device(&instance->transfers_bulk_full, device->address);
     356
     357        return EOK;
     358}
     359
    323360static int hc_status(bus_t *, uint32_t *);
    324361static int hc_schedule(usb_transfer_batch_t *);
     
    334371        .batch_schedule = hc_schedule,
    335372        .batch_destroy = destroy_transfer_batch,
     373
     374        .device_online = device_online,
     375        .device_offline = device_offline,
    336376};
    337377
Note: See TracChangeset for help on using the changeset viewer.