Changes in uspace/drv/bus/usb/ohci/main.c [58563585:366e9b6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/main.c
r58563585 r366e9b6 45 45 46 46 #include "hc.h" 47 #include "ohci_bus.h" 47 48 48 49 #define NAME "ohci" 49 static int ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 50 static int ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *); 51 static int ohci_driver_start(hcd_t *, bool); 52 static int ohci_driver_claim(hcd_t *, ddf_dev_t *); 50 53 static void ohci_driver_fini(hcd_t *); 51 54 52 55 static const ddf_hc_driver_t ohci_hc_driver = { 53 .hc_speed = USB_SPEED_FULL,54 56 .irq_code_gen = ohci_hc_gen_irq_code, 55 57 .init = ohci_driver_init, 58 .claim = ohci_driver_claim, 59 .start = ohci_driver_start, 60 .setup_root_hub = hcd_setup_virtual_root_hub, 56 61 .fini = ohci_driver_fini, 57 62 .name = "OHCI", 58 63 .ops = { 59 64 .schedule = ohci_hc_schedule, 60 .ep_add_hook = ohci_endpoint_init,61 .ep_remove_hook = ohci_endpoint_fini,62 65 .irq_hook = ohci_hc_interrupt, 63 66 .status_hook = ohci_hc_status, … … 66 69 67 70 68 static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res , bool irq)71 static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res) 69 72 { 73 int err; 74 70 75 assert(hcd); 71 76 assert(hcd_get_driver_data(hcd) == NULL); … … 75 80 return ENOMEM; 76 81 77 const int ret = hc_init(instance, res, irq); 78 if (ret == EOK) { 79 hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops); 80 } else { 81 free(instance); 82 } 83 return ret; 82 if ((err = hc_init(instance, res)) != EOK) 83 goto err; 84 85 if ((err = ohci_bus_init(&instance->bus, instance))) 86 goto err; 87 88 hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops, &instance->bus.base.base); 89 90 return EOK; 91 92 err: 93 free(instance); 94 return err; 95 } 96 97 static int ohci_driver_claim(hcd_t *hcd, ddf_dev_t *dev) 98 { 99 hc_t *hc = hcd_get_driver_data(hcd); 100 assert(hc); 101 102 hc_gain_control(hc); 103 104 return EOK; 105 } 106 107 static int ohci_driver_start(hcd_t *hcd, bool interrupts) 108 { 109 hc_t *hc = hcd_get_driver_data(hcd); 110 assert(hc); 111 112 hc->hw_interrupts = interrupts; 113 hc_start(hc); 114 return EOK; 84 115 } 85 116 … … 91 122 hc_fini(hc); 92 123 93 hcd_set_implementation(hcd, NULL, NULL );124 hcd_set_implementation(hcd, NULL, NULL, NULL); 94 125 free(hc); 95 126 }
Note:
See TracChangeset
for help on using the changeset viewer.