Changeset 2cf28b9 in mainline for uspace/drv/bus/usb/xhci/rh.c
- Timestamp:
- 2017-10-25T15:22:45Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
- Children:
- 62558202
- Parents:
- f668d60
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/rh.c
rf668d60 r2cf28b9 69 69 rh->max_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS); 70 70 rh->devices = (xhci_device_t **) calloc(rh->max_ports, sizeof(xhci_device_t *)); 71 hc->rh.hc_device = device; 72 73 return device_init(&hc->rh.device); 71 rh->hc_device = device; 72 73 const int err = device_init(&rh->device.base); 74 if (err) 75 return err; 76 77 /* Initialize route string */ 78 rh->device.route_str = 0; 79 rh->device.tier = 0; 80 81 return EOK; 74 82 } 75 83 … … 81 89 assert(rh); 82 90 assert(rh->hc_device); 91 92 assert(rh->devices[port_id - 1] == NULL); 83 93 84 94 xhci_bus_t *bus = &rh->hc->bus; … … 94 104 xhci_dev->hc = rh->hc; 95 105 xhci_dev->usb3 = port_speed->major == 3; 96 97 dev->hub = &rh->device; 106 xhci_dev->rh_port = port_id; 107 108 dev->hub = &rh->device.base; 98 109 dev->port = port_id; 99 110 dev->speed = port_speed->usb_speed; … … 113 124 } 114 125 115 fibril_mutex_lock(&rh->device.guard); 116 list_append(&dev->link, &rh->device.devices); 117 if (!rh->devices[port_id - 1]) { 118 /* Only save the device if it's the first one connected to this port. */ 119 rh->devices[port_id - 1] = xhci_dev; 120 } 121 fibril_mutex_unlock(&rh->device.guard); 126 fibril_mutex_lock(&rh->device.base.guard); 127 list_append(&dev->link, &rh->device.base.devices); 128 rh->devices[port_id - 1] = xhci_dev; 129 fibril_mutex_unlock(&rh->device.base.guard); 122 130 123 131 return EOK; … … 185 193 fibril_mutex_unlock(&dev->base.guard); 186 194 187 fibril_mutex_lock(&rh->device. guard);195 fibril_mutex_lock(&rh->device.base.guard); 188 196 list_remove(&dev->base.link); 189 fibril_mutex_unlock(&rh->device.guard);190 191 197 rh->devices[port_id - 1] = NULL; 198 fibril_mutex_unlock(&rh->device.base.guard); 199 192 200 usb_log_debug2("Aborting all active transfers to '%s'.", ddf_fun_get_name(dev->base.fun)); 193 201
Note:
See TracChangeset
for help on using the changeset viewer.