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