Changeset 4db49344 in mainline for uspace/drv/bus/usb/ohci
- 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/ohci
- Files:
-
- 2 edited
-
hc.c (modified) (4 diffs)
-
ohci_bus.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
ra6afb4c r4db49344 297 297 return ohci_rh_schedule(&hc->rh, batch); 298 298 } 299 ohci_transfer_batch_t *ohci_batch = ohci_transfer_batch_get(batch);300 if (!ohci_batch)301 return ENOMEM;302 303 const int err = ohci_transfer_batch_prepare(ohci_batch);304 if (err)305 return err;306 299 307 300 endpoint_t *ep = batch->ep; 308 301 ohci_endpoint_t * const ohci_ep = ohci_endpoint_get(ep); 309 310 /* creating local reference */ 311 endpoint_add_ref(ep); 312 313 fibril_mutex_lock(&ep->guard); 314 endpoint_activate_locked(ep, batch); 302 ohci_transfer_batch_t *ohci_batch = ohci_transfer_batch_get(batch); 303 304 int err; 305 if ((err = ohci_transfer_batch_prepare(ohci_batch))) 306 return err; 307 308 fibril_mutex_lock(&hc->guard); 309 if ((err = endpoint_activate_locked(ep, batch))) { 310 fibril_mutex_unlock(&hc->guard); 311 return err; 312 } 313 315 314 ohci_transfer_batch_commit(ohci_batch); 316 fibril_mutex_unlock(&ep->guard); 315 list_append(&ohci_ep->pending_link, &hc->pending_endpoints); 316 fibril_mutex_unlock(&hc->guard); 317 317 318 318 /* Control and bulk schedules need a kick to start working */ … … 328 328 break; 329 329 } 330 331 fibril_mutex_lock(&hc->guard);332 list_append(&ohci_ep->pending_link, &hc->pending_endpoints);333 fibril_mutex_unlock(&hc->guard);334 330 335 331 return EOK; … … 369 365 = list_get_instance(current, ohci_endpoint_t, pending_link); 370 366 371 fibril_mutex_lock(&ep->base.guard);372 367 ohci_transfer_batch_t *batch 373 368 = ohci_transfer_batch_get(ep->base.active_batch); … … 377 372 endpoint_deactivate_locked(&ep->base); 378 373 list_remove(current); 379 endpoint_del_ref(&ep->base);380 374 hc_reset_toggles(&batch->base, &ohci_ep_toggle_reset); 381 375 usb_transfer_batch_finish(&batch->base); 382 376 } 383 fibril_mutex_unlock(&ep->base.guard);384 377 } 385 378 fibril_mutex_unlock(&hc->guard); -
uspace/drv/bus/usb/ohci/ohci_bus.c
ra6afb4c r4db49344 115 115 ed_init(ohci_ep->ed, ep, ohci_ep->td); 116 116 hc_enqueue_endpoint(bus->hc, ep); 117 endpoint_set_online(ep, &bus->hc->guard); 117 118 118 119 return EOK; … … 128 129 hc_dequeue_endpoint(bus->hc, ep); 129 130 130 ohci_endpoint_t * const ohci_ep = ohci_endpoint_get(ep); 131 /* 132 * Now we can be sure the active transfer will not be completed, 133 * as it's out of the schedule, and HC acknowledged it. 134 */ 131 135 132 /* 133 * Now we can be sure the active transfer will not be completed. But first, 134 * make sure that the handling fibril won't use its link in pending list. 135 */ 136 ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep); 137 136 138 fibril_mutex_lock(&hc->guard); 137 if (link_in_use(&ohci_ep->pending_link)) 138 /* pending list reference */ 139 endpoint_del_ref(ep); 139 endpoint_set_offline_locked(ep); 140 140 list_remove(&ohci_ep->pending_link); 141 fibril_mutex_unlock(&hc->guard);142 143 /*144 * Finally, the endpoint shall not be used anywhere else. Finish the145 * pending batch.146 */147 fibril_mutex_lock(&ep->guard);148 141 usb_transfer_batch_t * const batch = ep->active_batch; 149 142 endpoint_deactivate_locked(ep); 150 fibril_mutex_unlock(& ep->guard);143 fibril_mutex_unlock(&hc->guard); 151 144 152 145 if (batch) {
Note:
See TracChangeset
for help on using the changeset viewer.
