Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/hc.c

    r7de1988c rb5111c46  
    193193        instance->rh.address = 1;
    194194        rc = usb_device_manager_request_address(
    195             &instance->generic.dev_manager, &instance->rh.address, false,
     195            &instance->generic->dev_manager, &instance->rh.address, false,
    196196            USB_SPEED_FULL);
    197197        if (rc != EOK) {
     
    204204
    205205        rc = usb_endpoint_manager_add_ep(
    206             &instance->generic.ep_manager, instance->rh.address, 0,
     206            &instance->generic->ep_manager, instance->rh.address, 0,
    207207            USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64,
    208208            0, NULL, NULL);
     
    231231        fun_bound = true;
    232232
    233         rc = usb_device_manager_bind_address(&instance->generic.dev_manager,
     233        rc = usb_device_manager_bind_address(&instance->generic->dev_manager,
    234234            instance->rh.address, ddf_fun_get_handle(hub_fun));
    235235        if (rc != EOK) {
     
    244244        if (ep_added) {
    245245                usb_endpoint_manager_remove_ep(
    246                     &instance->generic.ep_manager, instance->rh.address, 0,
     246                    &instance->generic->ep_manager, instance->rh.address, 0,
    247247                    USB_DIRECTION_BOTH, NULL, NULL);
    248248        }
    249249        if (addr_reqd) {
    250250                usb_device_manager_release_address(
    251                     &instance->generic.dev_manager, instance->rh.address);
     251                    &instance->generic->dev_manager, instance->rh.address);
    252252        }
    253253        return rc;
     
    257257 *
    258258 * @param[in] instance Memory place for the structure.
     259 * @param[in] HC function node
    259260 * @param[in] regs Device's I/O registers range.
    260261 * @param[in] interrupts True if w interrupts should be used
    261262 * @return Error code
    262263 */
    263 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts)
     264int hc_init(hc_t *instance, ddf_fun_t *fun, addr_range_t *regs, bool interrupts)
    264265{
    265266        assert(instance);
     
    274275        list_initialize(&instance->pending_batches);
    275276
    276         hcd_init(&instance->generic, USB_SPEED_FULL,
     277        instance->generic = ddf_fun_data_alloc(fun, sizeof(hcd_t));
     278        if (instance->generic == NULL) {
     279                usb_log_error("Out of memory.\n");
     280                return ENOMEM;
     281        }
     282
     283        hcd_init(instance->generic, USB_SPEED_FULL,
    277284            BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);
    278         instance->generic.private_data = instance;
    279         instance->generic.schedule = hc_schedule;
    280         instance->generic.ep_add_hook = ohci_endpoint_init;
    281         instance->generic.ep_remove_hook = ohci_endpoint_fini;
     285        instance->generic->private_data = instance;
     286        instance->generic->schedule = hc_schedule;
     287        instance->generic->ep_add_hook = ohci_endpoint_init;
     288        instance->generic->ep_remove_hook = ohci_endpoint_fini;
    282289
    283290        rc = hc_init_memory(instance);
Note: See TracChangeset for help on using the changeset viewer.