Changeset 0892663a in mainline for uspace/drv/bus/usb/uhci/hc.c
- Timestamp:
- 2018-01-11T04:14:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9848c77
- Parents:
- bad4a05
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-11 03:59:03)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-11 04:14:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
rbad4a05 r0892663a 321 321 } 322 322 323 static int device_online(device_t *device) 324 { 325 int err; 326 hc_t *instance = bus_to_hc(device->bus); 327 assert(instance); 328 329 /* Allow creation of new endpoints and transfers. */ 330 usb_log_info("Device(%d): Going online.", device->address); 331 fibril_mutex_lock(&device->guard); 332 device->online = true; 333 fibril_mutex_unlock(&device->guard); 334 335 if ((err = ddf_fun_online(device->fun))) { 336 return err; 337 } 338 339 return EOK; 340 } 341 342 static int device_offline(device_t *device) 343 { 344 int err; 345 hc_t *instance = bus_to_hc(device->bus); 346 assert(instance); 347 348 /* Tear down all drivers working with the device. */ 349 if ((err = ddf_fun_offline(device->fun))) { 350 return err; 351 } 352 353 /* At this point, all drivers are assumed to have already terminated 354 * in a consistent way. The following code just cleans up hanging 355 * transfers if there are any. */ 356 357 /* Block creation of new endpoints and transfers. */ 358 usb_log_info("Device(%d): Going offline.", device->address); 359 fibril_mutex_lock(&device->guard); 360 device->online = false; 361 fibril_mutex_unlock(&device->guard); 362 363 /* Abort all transfers to all endpoints. */ 364 transfer_list_abort_device(&instance->transfers_interrupt, device->address); 365 transfer_list_abort_device(&instance->transfers_control_slow, device->address); 366 transfer_list_abort_device(&instance->transfers_control_full, device->address); 367 transfer_list_abort_device(&instance->transfers_bulk_full, device->address); 368 369 return EOK; 323 static void endpoint_unregister(endpoint_t *ep) 324 { 325 usb2_bus_ops.endpoint_unregister(ep); 326 327 fibril_mutex_lock(&ep->guard); 328 if (ep->active_batch) { 329 uhci_transfer_batch_t *ub = uhci_transfer_batch_get(ep->active_batch); 330 uhci_transfer_batch_abort(ub); 331 332 assert(ep->active_batch == NULL); 333 } 334 fibril_mutex_unlock(&ep->guard); 370 335 } 371 336 … … 379 344 .status = hc_status, 380 345 346 .endpoint_unregister = endpoint_unregister, 381 347 .endpoint_count_bw = bandwidth_count_usb11, 348 382 349 .batch_create = create_transfer_batch, 383 350 .batch_schedule = hc_schedule, 384 351 .batch_destroy = destroy_transfer_batch, 385 386 .device_online = device_online,387 .device_offline = device_offline,388 352 }; 389 353 … … 522 486 static int hc_schedule(usb_transfer_batch_t *batch) 523 487 { 488 assert(batch); 524 489 hc_t *instance = bus_to_hc(endpoint_get_bus(batch->ep)); 525 assert(batch);526 490 527 491 if (batch->target.address == uhci_rh_get_address(&instance->rh))
Note:
See TracChangeset
for help on using the changeset viewer.