Changeset 6832245 in mainline for uspace/lib/usbhost/src/usb_transfer_batch.c
- Timestamp:
- 2017-12-14T23:01:57Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 837d53d
- Parents:
- bd05140
- git-author:
- Ondřej Hlavatý <aearsis@…> (2017-12-14 23:01:54)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2017-12-14 23:01:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/usb_transfer_batch.c
rbd05140 r6832245 49 49 { 50 50 assert(ep); 51 assert(ep->bus);52 51 53 usb_transfer_batch_t *batch; 54 if (ep->bus->ops.create_batch) 55 batch = ep->bus->ops.create_batch(ep->bus, ep); 56 else 57 batch = calloc(1, sizeof(usb_transfer_batch_t)); 52 bus_t *bus = endpoint_get_bus(ep); 53 const bus_ops_t *ops = BUS_OPS_LOOKUP(bus->ops, batch_create); 58 54 59 return batch; 55 if (!ops) { 56 usb_transfer_batch_t *batch = calloc(1, sizeof(usb_transfer_batch_t)); 57 usb_transfer_batch_init(batch, ep); 58 return batch; 59 } 60 61 return ops->batch_create(ep); 60 62 } 61 63 … … 64 66 void usb_transfer_batch_init(usb_transfer_batch_t *batch, endpoint_t *ep) 65 67 { 68 assert(ep); 69 endpoint_add_ref(ep); 66 70 batch->ep = ep; 67 71 } … … 82 86 batch->toggle_reset_mode == RESET_ALL ? "all EPs toggle" : "EP toggle"); 83 87 84 return bus_reset_toggle( batch->ep->bus, batch->target, batch->toggle_reset_mode);88 return bus_reset_toggle(endpoint_get_bus(batch->ep), batch->target, batch->toggle_reset_mode); 85 89 } 86 90 … … 93 97 assert(batch); 94 98 assert(batch->ep); 95 assert(batch->ep->bus);96 99 97 bus_t *bus = batch->ep->bus; 98 if (bus->ops.destroy_batch) { 100 bus_t *bus = endpoint_get_bus(batch->ep); 101 const bus_ops_t *ops = BUS_OPS_LOOKUP(bus->ops, batch_destroy); 102 103 endpoint_del_ref(batch->ep); 104 105 if (ops) { 99 106 usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " destroying.\n", 100 107 batch, USB_TRANSFER_BATCH_ARGS(*batch)); 101 bus->ops.destroy_batch(batch);108 ops->batch_destroy(batch); 102 109 } 103 110 else {
Note:
See TracChangeset
for help on using the changeset viewer.