Changeset d33dc780 in mainline for uspace/drv/bus/usb/xhci/rh.c


Ignore:
Timestamp:
2017-10-29T10:56:02Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef1a3a8
Parents:
9620a54
Message:

Refactoring. Renamed device array to better reflect its indexing.

File:
1 edited

Legend:

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

    r9620a54 rd33dc780  
    6868        rh->hc = hc;
    6969        rh->max_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS);
    70         rh->devices = (xhci_device_t **) calloc(rh->max_ports, sizeof(xhci_device_t *));
     70        rh->devices_by_port = (xhci_device_t **) calloc(rh->max_ports, sizeof(xhci_device_t *));
    7171        rh->hc_device = device;
    7272
     
    9090        assert(rh->hc_device);
    9191
    92         assert(rh->devices[port_id - 1] == NULL);
     92        assert(rh->devices_by_port[port_id - 1] == NULL);
    9393
    9494        xhci_bus_t *bus = &rh->hc->bus;
     
    126126        fibril_mutex_lock(&rh->device.base.guard);
    127127        list_append(&dev->link, &rh->device.base.devices);
    128         rh->devices[port_id - 1] = xhci_dev;
     128        rh->devices_by_port[port_id - 1] = xhci_dev;
    129129        fibril_mutex_unlock(&rh->device.base.guard);
    130130
     
    180180
    181181        /* Find XHCI device by the port. */
    182         xhci_device_t *dev = rh->devices[port_id - 1];
     182        xhci_device_t *dev = rh->devices_by_port[port_id - 1];
    183183        if (!dev) {
    184184                /* Must be extraneous call. */
     
    192192        fibril_mutex_lock(&rh->device.base.guard);
    193193        list_remove(&dev->base.link);
    194         rh->devices[port_id - 1] = NULL;
     194        rh->devices_by_port[port_id - 1] = NULL;
    195195        fibril_mutex_unlock(&rh->device.base.guard);
    196196
     
    358358        usb_log_debug2("Called xhci_rh_fini().");
    359359
    360         free(rh->devices);
     360        free(rh->devices_by_port);
    361361
    362362        return EOK;
Note: See TracChangeset for help on using the changeset viewer.