Changes in uspace/drv/bus/usb/ohci/main.c [366e9b6:58563585] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/main.c
r366e9b6 r58563585 45 45 46 46 #include "hc.h" 47 #include "ohci_bus.h"48 47 49 48 #define NAME "ohci" 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 *); 49 static int ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 53 50 static void ohci_driver_fini(hcd_t *); 54 51 55 52 static const ddf_hc_driver_t ohci_hc_driver = { 53 .hc_speed = USB_SPEED_FULL, 56 54 .irq_code_gen = ohci_hc_gen_irq_code, 57 55 .init = ohci_driver_init, 58 .claim = ohci_driver_claim,59 .start = ohci_driver_start,60 .setup_root_hub = hcd_setup_virtual_root_hub,61 56 .fini = ohci_driver_fini, 62 57 .name = "OHCI", 63 58 .ops = { 64 59 .schedule = ohci_hc_schedule, 60 .ep_add_hook = ohci_endpoint_init, 61 .ep_remove_hook = ohci_endpoint_fini, 65 62 .irq_hook = ohci_hc_interrupt, 66 63 .status_hook = ohci_hc_status, … … 69 66 70 67 71 static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res )68 static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq) 72 69 { 73 int err;74 75 70 assert(hcd); 76 71 assert(hcd_get_driver_data(hcd) == NULL); … … 80 75 return ENOMEM; 81 76 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; 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; 115 84 } 116 85 … … 122 91 hc_fini(hc); 123 92 124 hcd_set_implementation(hcd, NULL, NULL , NULL);93 hcd_set_implementation(hcd, NULL, NULL); 125 94 free(hc); 126 95 }
Note:
See TracChangeset
for help on using the changeset viewer.