Changeset 296d22fc in mainline for uspace/lib/usbhost/src/bus.c
- Timestamp:
- 2018-01-25T02:05:57Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fa4b12d5
- Parents:
- d369b3b
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-25 02:03:48)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-25 02:05:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/bus.c
rd369b3b r296d22fc 129 129 assert(dev); 130 130 131 const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_enumerate); 132 if (!ops) 131 if (!dev->bus->ops->device_enumerate) 133 132 return ENOTSUP; 134 133 … … 138 137 device_setup_tt(dev); 139 138 140 const int r = ops->device_enumerate(dev);139 const int r = dev->bus->ops->device_enumerate(dev); 141 140 if (r) 142 141 return r; … … 208 207 assert(dev->fun != NULL); 209 208 210 const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_gone); 211 const bus_ops_t *ep_ops = BUS_OPS_LOOKUP(dev->bus->ops, endpoint_unregister); 209 const bus_ops_t *ops = dev->bus->ops; 212 210 213 211 /* First, block new transfers and operations. */ … … 241 239 242 240 /* Tell the HC to release its resources. */ 243 if (ops )241 if (ops->device_gone) 244 242 ops->device_gone(dev); 245 243 246 244 /* Check whether the driver didn't forgot EP0 */ 247 245 if (dev->endpoints[0]) { 248 if ( ep_ops)249 ep_ops->endpoint_unregister(dev->endpoints[0]);246 if (ops->endpoint_unregister) 247 ops->endpoint_unregister(dev->endpoints[0]); 250 248 /* Release the EP0 bus reference */ 251 249 endpoint_del_ref(dev->endpoints[0]); … … 271 269 272 270 /* First, tell the HC driver. */ 273 const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_online);274 if (ops && (rc = ops->device_online(dev))) {271 const bus_ops_t *ops = dev->bus->ops; 272 if (ops->device_online && (rc = ops->device_online(dev))) { 275 273 usb_log_warning("Host controller failed to make device '%s' online: %s", 276 274 ddf_fun_get_name(dev->fun), str_error(rc)); … … 329 327 330 328 /* Tell also the HC driver. */ 331 const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_offline);332 if (ops )329 const bus_ops_t *ops = dev->bus->ops; 330 if (ops->device_offline) 333 331 ops->device_offline(dev); 334 332 … … 365 363 bus_t *bus = device->bus; 366 364 367 const bus_ops_t *register_ops = BUS_OPS_LOOKUP(bus->ops, endpoint_register); 368 if (!register_ops) 365 if (!bus->ops->endpoint_register) 369 366 return ENOTSUP; 370 367 371 const bus_ops_t *create_ops = BUS_OPS_LOOKUP(bus->ops, endpoint_create);372 368 endpoint_t *ep; 373 if ( create_ops) {374 ep = create_ops->endpoint_create(device, desc);369 if (bus->ops->endpoint_create) { 370 ep = bus->ops->endpoint_create(device, desc); 375 371 if (!ep) 376 372 return ENOMEM; … … 410 406 err = EEXIST; 411 407 } else { 412 err = register_ops->endpoint_register(ep);408 err = bus->ops->endpoint_register(ep); 413 409 if (!err) 414 410 device->endpoints[idx] = ep; … … 480 476 bus_t *bus = device->bus; 481 477 482 const bus_ops_t *ops = BUS_OPS_LOOKUP(bus->ops, endpoint_unregister); 483 if (!ops) 478 if (!bus->ops->endpoint_unregister) 484 479 return ENOTSUP; 485 480 … … 496 491 497 492 fibril_mutex_lock(&device->guard); 498 ops->endpoint_unregister(ep);493 bus->ops->endpoint_unregister(ep); 499 494 device->endpoints[idx] = NULL; 500 495 fibril_mutex_unlock(&device->guard);
Note:
See TracChangeset
for help on using the changeset viewer.