Changeset e6b9182 in mainline for uspace/drv/bus/usb/ohci/main.c


Ignore:
Timestamp:
2017-10-13T08:49:29Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
741bcdeb
Parents:
0a5833d7
Message:

WIP usbhost refactoring: ohci completed

Along with that we noticed hcd_t in bus_t is superfluous and it complicates initialization (and breaks isolation), so we removed it. Also, type of the toggle has changed to bool in the functions.

File:
1 edited

Legend:

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

    r0a5833d7 re6b9182  
    4545
    4646#include "hc.h"
     47#include "ohci_bus.h"
    4748
    4849#define NAME "ohci"
     
    5354
    5455static const ddf_hc_driver_t ohci_hc_driver = {
    55         .hc_speed = USB_SPEED_FULL,
    5656        .irq_code_gen = ohci_hc_gen_irq_code,
    5757        .init = ohci_driver_init,
     
    6262        .ops = {
    6363                .schedule       = ohci_hc_schedule,
    64                 .ep_add_hook    = ohci_endpoint_init,
    65                 .ep_remove_hook = ohci_endpoint_fini,
    6664                .irq_hook       = ohci_hc_interrupt,
    6765                .status_hook    = ohci_hc_status,
     
    7270static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res)
    7371{
     72        int err;
     73
    7474        assert(hcd);
    7575        assert(hcd_get_driver_data(hcd) == NULL);
     
    7979                return ENOMEM;
    8080
    81         const int ret = hc_init(instance, res);
    82         if (ret == EOK) {
    83                 hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops);
    84         } else {
    85                 free(instance);
    86         }
    87         return ret;
     81        if ((err = hc_init(instance, res)) != EOK)
     82                goto err;
     83
     84        if ((err = ohci_bus_init(&instance->bus, instance)))
     85                goto err;
     86
     87        hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops, &instance->bus.base.base);
     88
     89        return EOK;
     90
     91err:
     92        free(instance);
     93        return err;
    8894}
    8995
     
    115121                hc_fini(hc);
    116122
    117         hcd_set_implementation(hcd, NULL, NULL);
     123        hcd_set_implementation(hcd, NULL, NULL, NULL);
    118124        free(hc);
    119125}
Note: See TracChangeset for help on using the changeset viewer.