Changes in uspace/drv/bus/usb/ohci/ohci.c [56fd7cf:44c1a48] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci.c
r56fd7cf r44c1a48 33 33 * @brief OHCI driver 34 34 */ 35 36 /* XXX Fix this */37 #define _DDF_DATA_IMPLANT38 39 35 #include <errno.h> 40 36 #include <str_error.h> … … 56 52 } ohci_t; 57 53 58 static inline ohci_t *dev_to_ohci(ddf_dev_t *dev) 59 { 60 return ddf_dev_data_get(dev); 54 static inline ohci_t * dev_to_ohci(ddf_dev_t *dev) 55 { 56 assert(dev); 57 return dev->driver_data; 61 58 } 62 59 /** IRQ handling callback, identifies device … … 78 75 hc_interrupt(&ohci->hc, status); 79 76 } 80 77 /*----------------------------------------------------------------------------*/ 81 78 /** Get USB address assigned to root hub. 82 79 * … … 90 87 91 88 if (address != NULL) { 92 *address = dev_to_ohci( ddf_fun_get_dev(fun))->hc.rh.address;89 *address = dev_to_ohci(fun->dev)->hc.rh.address; 93 90 } 94 91 95 92 return EOK; 96 93 } 97 94 /*----------------------------------------------------------------------------*/ 98 95 /** Gets handle of the respective hc (this device, hc function). 99 96 * … … 106 103 { 107 104 assert(fun); 108 ddf_fun_t *hc_fun = dev_to_ohci( ddf_fun_get_dev(fun))->hc_fun;105 ddf_fun_t *hc_fun = dev_to_ohci(fun->dev)->hc_fun; 109 106 assert(hc_fun); 110 107 111 108 if (handle != NULL) 112 *handle = ddf_fun_get_handle(hc_fun);109 *handle = hc_fun->handle; 113 110 return EOK; 114 111 } 115 112 /*----------------------------------------------------------------------------*/ 116 113 /** Root hub USB interface */ 117 114 static usb_iface_t usb_iface = { … … 119 116 .get_my_address = rh_get_my_address, 120 117 }; 121 118 /*----------------------------------------------------------------------------*/ 122 119 /** Standard USB HC options (HC interface) */ 123 120 static ddf_dev_ops_t hc_ops = { 124 121 .interfaces[USBHC_DEV_IFACE] = &hcd_iface, 125 122 }; 126 123 /*----------------------------------------------------------------------------*/ 127 124 /** Standard USB RH options (RH interface) */ 128 125 static ddf_dev_ops_t rh_ops = { 129 126 .interfaces[USB_DEV_IFACE] = &usb_iface, 130 127 }; 131 128 /*----------------------------------------------------------------------------*/ 132 129 /** Initialize hc and rh ddf structures and their respective drivers. 133 130 * … … 155 152 if (ret != EOK) { \ 156 153 if (instance->hc_fun) { \ 154 instance->hc_fun->driver_data = NULL; \ 157 155 ddf_fun_destroy(instance->hc_fun); \ 158 156 } \ 159 157 if (instance->rh_fun) { \ 158 instance->rh_fun->driver_data = NULL; \ 160 159 ddf_fun_destroy(instance->rh_fun); \ 161 160 } \ … … 168 167 CHECK_RET_DEST_FREE_RETURN(ret, 169 168 "Failed to create OHCI HC function: %s.\n", str_error(ret)); 170 ddf_fun_set_ops(instance->hc_fun, &hc_ops);171 ddf_fun_data_implant(instance->hc_fun, &instance->hc);169 instance->hc_fun->ops = &hc_ops; 170 instance->hc_fun->driver_data = &instance->hc; 172 171 173 172 instance->rh_fun = ddf_fun_create(device, fun_inner, "ohci_rh"); … … 175 174 CHECK_RET_DEST_FREE_RETURN(ret, 176 175 "Failed to create OHCI RH function: %s.\n", str_error(ret)); 177 ddf_fun_set_ops(instance->rh_fun, &rh_ops);176 instance->rh_fun->ops = &rh_ops; 178 177 179 178 uintptr_t reg_base = 0; … … 184 183 CHECK_RET_DEST_FREE_RETURN(ret, 185 184 "Failed to get register memory addresses for %" PRIun ": %s.\n", 186 d df_dev_get_handle(device), str_error(ret));185 device->handle, str_error(ret)); 187 186 usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n", 188 187 (void *) reg_base, reg_size, irq);
Note:
See TracChangeset
for help on using the changeset viewer.