Changeset 8148ee3a in mainline for uspace/drv/ohci/hc.c


Ignore:
Timestamp:
2011-04-12T10:52:05Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a81736d5
Parents:
f324635
Message:

Root hub does not need ddf device pointer

Use endpoint manager registration wrapper

File:
1 edited

Legend:

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

    rf324635 r8148ee3a  
    5555        assert(hub_fun);
    5656
     57        int ret;
     58
    5759        usb_address_t hub_address =
    5860            device_keeper_get_free_address(&instance->manager, USB_SPEED_FULL);
     61        if (hub_address <= 0) {
     62                usb_log_error("Failed to get OHCI root hub address.\n");
     63                return hub_address;
     64        }
    5965        instance->rh.address = hub_address;
    6066        usb_device_keeper_bind(
    6167            &instance->manager, hub_address, hub_fun->handle);
    6268
    63         endpoint_t *ep = malloc(sizeof(endpoint_t));
    64         assert(ep);
    65         int ret = endpoint_init(ep, hub_address, 0, USB_DIRECTION_BOTH,
    66             USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64);
    67         assert(ret == EOK);
    68         ret = usb_endpoint_manager_register_ep(&instance->ep_manager, ep, 0);
    69         assert(ret == EOK);
     69        ret = usb_endpoint_manager_add_ep(&instance->ep_manager,
     70            hub_address, 0, USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL,
     71            USB_SPEED_FULL, 64, 0);
     72        if (ret != EOK) {
     73                usb_log_error("Failed to add OHCI rh endpoint 0.\n");
     74                usb_device_keeper_release(&instance->manager, hub_address);
     75                return ret;
     76        }
    7077
    7178        char *match_str = NULL;
     79        /* DDF needs heap allocated string */
    7280        ret = asprintf(&match_str, "usb&class=hub");
    73 //      ret = (match_str == NULL) ? ret : EOK;
    7481        if (ret < 0) {
    7582                usb_log_error(
    7683                    "Failed(%d) to create root hub match-id string.\n", ret);
     84                usb_device_keeper_release(&instance->manager, hub_address);
    7785                return ret;
    7886        }
     
    8088        ret = ddf_fun_add_match_id(hub_fun, match_str, 100);
    8189        if (ret != EOK) {
    82                 usb_log_error("Failed add create root hub match-id.\n");
     90                usb_log_error("Failed add root hub match-id.\n");
    8391        }
    8492        return ret;
     
    115123        fibril_mutex_initialize(&instance->guard);
    116124
    117         rh_init(&instance->rh, dev, instance->registers);
     125        rh_init(&instance->rh, instance->registers);
    118126
    119127        if (!interrupts) {
Note: See TracChangeset for help on using the changeset viewer.