Changeset b5f813c in mainline for uspace/drv/bus/usb/uhci/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/uhci/main.c
r2dbfe44 rb5f813c 48 48 #define NAME "uhci" 49 49 50 static int uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 51 static void uhci_driver_fini(hcd_t *); 52 static int disable_legacy(ddf_dev_t *); 53 54 static const ddf_hc_driver_t uhci_hc_driver = { 55 .claim = disable_legacy, 56 .hc_speed = USB_SPEED_FULL, 57 .irq_code_gen = uhci_hc_gen_irq_code, 58 .init = uhci_driver_init, 59 .fini = uhci_driver_fini, 60 .name = "UHCI", 61 .ops = { 62 .schedule = uhci_hc_schedule, 63 .irq_hook = uhci_hc_interrupt, 64 .status_hook = uhci_hc_status, 65 }, 66 }; 67 50 68 static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq) 51 69 { 52 70 assert(hcd); 53 assert(hcd ->driver.data== NULL);71 assert(hcd_get_driver_data(hcd) == NULL); 54 72 55 73 hc_t *instance = malloc(sizeof(hc_t)); … … 59 77 const int ret = hc_init(instance, res, irq); 60 78 if (ret == EOK) 61 hcd_set_implementation(hcd, instance, uhci_hc_schedule, NULL, 62 NULL, uhci_hc_interrupt, uhci_hc_status); 79 hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops); 63 80 return ret; 64 81 } … … 67 84 { 68 85 assert(hcd); 69 if (hcd->driver.data) 70 hc_fini(hcd->driver.data); 86 hc_t *hc = hcd_get_driver_data(hcd); 87 if (hc) 88 hc_fini(hc); 71 89 72 free(hcd->driver.data);73 hcd_set_implementation(hcd, NULL, NULL, NULL, NULL, NULL, NULL);90 hcd_set_implementation(hcd, NULL, NULL); 91 free(hc); 74 92 } 75 76 static int uhci_dev_add(ddf_dev_t *device);77 78 static const driver_ops_t uhci_driver_ops = {79 .dev_add = uhci_dev_add,80 };81 82 static const driver_t uhci_driver = {83 .name = NAME,84 .driver_ops = &uhci_driver_ops85 };86 93 87 94 /** Call the PCI driver with a request to clear legacy support register … … 106 113 return rc; 107 114 } 108 static const ddf_hc_driver_t uhci_hc_driver = {109 .claim = disable_legacy,110 .hc_speed = USB_SPEED_FULL,111 .irq_code_gen = uhci_hc_gen_irq_code,112 .init = uhci_driver_init,113 .fini = uhci_driver_fini,114 .name = "UHCI"115 };116 117 115 118 116 /** Initialize a new ddf driver instance for uhci hc and hub. … … 121 119 * @return Error code. 122 120 */ 123 int uhci_dev_add(ddf_dev_t *device)121 static int uhci_dev_add(ddf_dev_t *device) 124 122 { 125 123 usb_log_debug2("uhci_dev_add() called\n"); … … 127 125 return hcd_ddf_add_hc(device, &uhci_hc_driver); 128 126 } 127 128 static const driver_ops_t uhci_driver_ops = { 129 .dev_add = uhci_dev_add, 130 }; 131 132 static const driver_t uhci_driver = { 133 .name = NAME, 134 .driver_ops = &uhci_driver_ops 135 }; 136 129 137 130 138 /** Initialize global driver structures (NONE).
Note:
See TracChangeset
for help on using the changeset viewer.