Changeset b5f813c in mainline for uspace/drv/bus/usb/ohci/main.c
- Timestamp:
- 2015-07-04T03:28:02Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 55346870
- Parents:
- 2dbfe44
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/main.c
r2dbfe44 rb5f813c 46 46 47 47 #define NAME "ohci" 48 static int ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 49 static void ohci_driver_fini(hcd_t *); 50 51 static const ddf_hc_driver_t ohci_hc_driver = { 52 .hc_speed = USB_SPEED_FULL, 53 .irq_code_gen = ohci_hc_gen_irq_code, 54 .init = ohci_driver_init, 55 .fini = ohci_driver_fini, 56 .name = "OHCI", 57 .ops = { 58 .schedule = ohci_hc_schedule, 59 .ep_add_hook = ohci_endpoint_init, 60 .ep_remove_hook = ohci_endpoint_fini, 61 .irq_hook = ohci_hc_interrupt, 62 .status_hook = ohci_hc_status, 63 }, 64 }; 65 48 66 49 67 static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq) 50 68 { 51 69 assert(hcd); 52 assert(hcd ->driver.data== NULL);70 assert(hcd_get_driver_data(hcd) == NULL); 53 71 54 72 hc_t *instance = malloc(sizeof(hc_t)); … … 58 76 const int ret = hc_init(instance, res, irq); 59 77 if (ret == EOK) 60 hcd_set_implementation(hcd, instance, ohci_hc_schedule, 61 ohci_endpoint_init, ohci_endpoint_fini, ohci_hc_interrupt, 62 ohci_hc_status); 78 hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops); 63 79 return ret; 64 80 } … … 67 83 { 68 84 assert(hcd); 69 if (hcd->driver.data) 70 hc_fini(hcd->driver.data); 85 hc_t *hc = hcd_get_driver_data(hcd); 86 if (hc) 87 hc_fini(hc); 71 88 72 free(hcd->driver.data);73 hcd_set_implementation(hcd, NULL, NULL, NULL, NULL, NULL, NULL);89 hcd_set_implementation(hcd, NULL, NULL); 90 free(hc); 74 91 } 75 76 static const ddf_hc_driver_t ohci_hc_driver = {77 .hc_speed = USB_SPEED_FULL,78 .irq_code_gen = ohci_hc_gen_irq_code,79 .init = ohci_driver_init,80 .fini = ohci_driver_fini,81 .name = "OHCI"82 };83 92 84 93 /** Initializes a new ddf driver instance of OHCI hcd.
Note:
See TracChangeset
for help on using the changeset viewer.