Changes in uspace/drv/bus/usb/uhci/main.c [53a309e:c910ecf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/main.c
r53a309e rc910ecf 49 49 #define NAME "uhci" 50 50 51 static int uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 51 static int uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, ddf_dev_t *); 52 static int uhci_driver_start(hcd_t *, bool); 52 53 static void uhci_driver_fini(hcd_t *); 53 static int disable_legacy( ddf_dev_t *);54 static int disable_legacy(hcd_t *, ddf_dev_t *); 54 55 55 56 static const ddf_hc_driver_t uhci_hc_driver = { 56 57 .claim = disable_legacy, 57 .hc_speed = USB_SPEED_FULL,58 58 .irq_code_gen = uhci_hc_gen_irq_code, 59 59 .init = uhci_driver_init, 60 .start = uhci_driver_start, 61 .setup_root_hub = hcd_setup_virtual_root_hub, 60 62 .fini = uhci_driver_fini, 61 63 .name = "UHCI", … … 67 69 }; 68 70 69 static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)71 static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, ddf_dev_t *device) 70 72 { 73 int err; 74 71 75 assert(hcd); 72 76 assert(hcd_get_driver_data(hcd) == NULL); … … 76 80 return ENOMEM; 77 81 78 const int ret = hc_init(instance, res, irq); 79 if (ret == EOK) { 80 hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops); 81 } else { 82 free(instance); 83 } 84 return ret; 82 if ((err = hc_init(instance, res)) != EOK) 83 goto err; 84 85 hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops, &instance->bus.base); 86 87 return EOK; 88 89 err: 90 free(instance); 91 return err; 92 } 93 94 static int uhci_driver_start(hcd_t *hcd, bool interrupts) 95 { 96 assert(hcd); 97 hc_t *hc = hcd_get_driver_data(hcd); 98 99 hc->hw_interrupts = interrupts; 100 hc_start(hc); 101 return EOK; 85 102 } 86 103 … … 92 109 hc_fini(hc); 93 110 94 hcd_set_implementation(hcd, NULL, NULL );111 hcd_set_implementation(hcd, NULL, NULL, NULL); 95 112 free(hc); 96 113 } … … 101 118 * @return Error code. 102 119 */ 103 static int disable_legacy( ddf_dev_t *device)120 static int disable_legacy(hcd_t *hcd, ddf_dev_t *device) 104 121 { 105 122 assert(device); … … 126 143 } 127 144 145 static int uhci_fun_online(ddf_fun_t *fun) 146 { 147 return hcd_ddf_device_online(fun); 148 } 149 150 static int uhci_fun_offline(ddf_fun_t *fun) 151 { 152 return hcd_ddf_device_offline(fun); 153 } 154 128 155 static const driver_ops_t uhci_driver_ops = { 129 156 .dev_add = uhci_dev_add, 157 .fun_online = uhci_fun_online, 158 .fun_offline = uhci_fun_offline 130 159 }; 131 160 … … 148 177 printf(NAME ": HelenOS UHCI driver.\n"); 149 178 log_init(NAME); 150 logctl_set_log_level(NAME, LVL_ NOTE);179 logctl_set_log_level(NAME, LVL_DEBUG2); 151 180 return ddf_driver_main(&uhci_driver); 152 181 }
Note:
See TracChangeset
for help on using the changeset viewer.