Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d33dc78 in mainline


Ignore:
Timestamp:
2017-10-29T10:56:02Z (3 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
master
Children:
ef1a3a8
Parents:
9620a54
Message:

Refactoring. Renamed device array to better reflect its indexing.

Location:
uspace/drv/bus/usb/xhci
Files:
2 edited

Legend:

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

    r9620a54 rd33dc78  
    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;
  • uspace/drv/bus/usb/xhci/rh.h

    r9620a54 rd33dc78  
    7777
    7878        /* Device pointers connected to RH ports or NULL. (size is `max_ports`) */
    79         xhci_device_t **devices;
     79        xhci_device_t **devices_by_port;
    8080} xhci_rh_t;
    8181
Note: See TracChangeset for help on using the changeset viewer.