Changeset 4db49344 in mainline for uspace/drv/bus/usb/ehci
- Timestamp:
- 2018-01-23T21:52:28Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3dd80f8
- Parents:
- a6afb4c
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-23 20:49:35)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-23 21:52:28)
- Location:
- uspace/drv/bus/usb/ehci
- Files:
-
- 2 edited
-
ehci_bus.c (modified) (2 diffs)
-
hc.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_bus.c
ra6afb4c r4db49344 107 107 qh_init(ehci_ep->qh, ep); 108 108 hc_enqueue_endpoint(bus->hc, ep); 109 109 endpoint_set_online(ep, &bus->hc->guard); 110 110 return EOK; 111 111 } … … 121 121 usb2_bus_ops.endpoint_unregister(ep); 122 122 hc_dequeue_endpoint(hc, ep); 123 /* 124 * Now we can be sure the active transfer will not be completed, 125 * as it's out of the schedule, and HC acknowledged it. 126 */ 123 127 124 128 ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep); 125 129 126 /*127 * Now we can be sure the active transfer will not be completed. But first,128 * make sure that the handling fibril won't use its link in pending list.129 */130 130 fibril_mutex_lock(&hc->guard); 131 if (link_in_use(&ehci_ep->pending_link)) 132 /* pending list reference */ 133 endpoint_del_ref(ep); 131 endpoint_set_offline_locked(ep); 134 132 list_remove(&ehci_ep->pending_link); 135 fibril_mutex_unlock(&hc->guard);136 137 /*138 * Finally, the endpoint shall not be used anywhere else. Finish the139 * pending batch.140 */141 fibril_mutex_lock(&ep->guard);142 133 usb_transfer_batch_t * const batch = ep->active_batch; 143 134 endpoint_deactivate_locked(ep); 144 fibril_mutex_unlock(& ep->guard);135 fibril_mutex_unlock(&hc->guard); 145 136 146 137 if (batch) { -
uspace/drv/bus/usb/ehci/hc.c
ra6afb4c r4db49344 302 302 endpoint_t * const ep = batch->ep; 303 303 ehci_endpoint_t * const ehci_ep = ehci_endpoint_get(ep); 304 305 /* creating local reference */306 endpoint_add_ref(ep);307 308 fibril_mutex_lock(&ep->guard);309 endpoint_activate_locked(ep, batch);310 311 304 ehci_transfer_batch_t *ehci_batch = ehci_transfer_batch_get(batch); 312 const int err = ehci_transfer_batch_prepare(ehci_batch); 313 if (err) { 314 endpoint_deactivate_locked(ep); 315 fibril_mutex_unlock(&ep->guard); 316 /* dropping local reference */ 317 endpoint_del_ref(ep); 305 306 int err; 307 308 if ((err = ehci_transfer_batch_prepare(ehci_batch))) 309 return err; 310 311 fibril_mutex_lock(&hc->guard); 312 313 if ((err = endpoint_activate_locked(ep, batch))) { 314 fibril_mutex_unlock(&hc->guard); 318 315 return err; 319 316 } … … 321 318 usb_log_debug("HC(%p): Committing BATCH(%p)", hc, batch); 322 319 ehci_transfer_batch_commit(ehci_batch); 323 fibril_mutex_unlock(&ep->guard);324 320 325 321 /* Enqueue endpoint to the checked list */ 326 fibril_mutex_lock(&hc->guard);327 322 usb_log_debug2("HC(%p): Appending BATCH(%p)", hc, batch); 328 329 /* local reference -> pending list reference */330 323 list_append(&ehci_ep->pending_link, &hc->pending_endpoints); 324 331 325 fibril_mutex_unlock(&hc->guard); 332 333 326 return EOK; 334 327 } … … 368 361 = list_get_instance(current, ehci_endpoint_t, pending_link); 369 362 370 fibril_mutex_lock(&ep->base.guard);371 363 ehci_transfer_batch_t *batch 372 364 = ehci_transfer_batch_get(ep->base.active_batch); … … 376 368 endpoint_deactivate_locked(&ep->base); 377 369 list_remove(current); 378 endpoint_del_ref(&ep->base);379 370 hc_reset_toggles(&batch->base, &ehci_ep_toggle_reset); 380 371 usb_transfer_batch_finish(&batch->base); 381 372 } 382 fibril_mutex_unlock(&ep->base.guard);383 373 } 384 374 fibril_mutex_unlock(&hc->guard);
Note:
See TracChangeset
for help on using the changeset viewer.
