Changeset 7e5a12b in mainline for uspace/drv/bus/usb/xhci/bus.c


Ignore:
Timestamp:
2018-01-19T17:57:13Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
69b2dfee
Parents:
2833bb4
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-19 17:57:06)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-19 17:57:13)
Message:

xhci: make enable/disable slot symmetric

Previously, device slot context was allocated inside address_device,
complicating error paths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/bus.c

    r2833bb4 r7e5a12b  
    6969 * @return Error code.
    7070 */
    71 static int address_device(xhci_bus_t *bus, xhci_device_t *dev)
     71static int address_device(xhci_device_t *dev)
    7272{
    7373        int err;
    7474
    7575        /* Enable new slot. */
    76         if ((err = hc_enable_slot(bus->hc, &dev->slot_id)) != EOK)
     76        if ((err = hc_enable_slot(dev)) != EOK)
    7777                return err;
    7878        usb_log_debug2("Obtained slot ID: %u.", dev->slot_id);
     
    100100        dev->base.endpoints[0] = NULL;
    101101err_slot:
    102         hc_disable_slot(bus->hc, dev);
     102        hc_disable_slot(dev);
    103103        return err;
    104104}
     
    193193        do {
    194194                /* Assign an address to the device */
    195                 err = address_device(bus, xhci_dev);
     195                err = address_device(xhci_dev);
    196196        } while (err == ESTALL && --retries > 0);
    197197
     
    253253        /* Disable the slot, dropping all endpoints. */
    254254        const uint32_t slot_id = xhci_dev->slot_id;
    255         if ((err = hc_disable_slot(bus->hc, xhci_dev))) {
     255        if ((err = hc_disable_slot(xhci_dev))) {
    256256                usb_log_warning("Failed to disable slot of device " XHCI_DEV_FMT ": %s",
    257257                    XHCI_DEV_ARGS(*xhci_dev), str_error(err));
Note: See TracChangeset for help on using the changeset viewer.