Changeset 2f87aa6 in mainline
- Timestamp:
- 2012-12-14T20:57:39Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f29931c
- Parents:
- 5df69cb
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci.c
r5df69cb r2f87aa6 34 34 */ 35 35 36 /* XXX Fix this */37 #define _DDF_DATA_IMPLANT38 39 36 #include <errno.h> 40 37 #include <str_error.h> … … 52 49 ddf_fun_t *hc_fun; 53 50 ddf_fun_t *rh_fun; 54 55 hc_t hc;56 51 } ohci_t; 57 52 … … 60 55 return ddf_dev_data_get(dev); 61 56 } 57 62 58 /** IRQ handling callback, identifies device 63 59 * … … 75 71 return; 76 72 } 73 hc_t *hc = ddf_fun_data_get(ohci->hc_fun); 74 assert(hc); 75 77 76 const uint16_t status = IPC_GET_ARG1(*call); 78 hc_interrupt( &ohci->hc, status);77 hc_interrupt(hc, status); 79 78 } 80 79 … … 90 89 91 90 if (address != NULL) { 92 *address = dev_to_ohci(ddf_fun_get_dev(fun))->hc.rh.address; 91 hc_t *hc = 92 ddf_fun_data_get(dev_to_ohci(ddf_fun_get_dev(fun))->hc_fun); 93 assert(hc); 94 *address = hc->rh.address; 93 95 } 94 96 … … 102 104 * @return Error code. 103 105 */ 104 static int rh_get_hc_handle( 105 ddf_fun_t *fun, devman_handle_t *handle) 106 static int rh_get_hc_handle(ddf_fun_t *fun, devman_handle_t *handle) 106 107 { 107 108 assert(fun); 108 ddf_fun_t *hc_fun = dev_to_ohci(ddf_fun_get_dev(fun))->hc_fun; 109 assert(hc_fun);110 111 if (handle != NULL)109 110 if (handle != NULL) { 111 ddf_fun_t *hc_fun = dev_to_ohci(ddf_fun_get_dev(fun))->hc_fun; 112 assert(hc_fun); 112 113 *handle = ddf_fun_get_handle(hc_fun); 114 } 113 115 return EOK; 114 116 } … … 146 148 return EBADMEM; 147 149 148 ohci_t *instance = ddf_dev_data_alloc(device, sizeof(ohci_t));150 ohci_t *instance = ddf_dev_data_alloc(device, sizeof(ohci_t)); 149 151 if (instance == NULL) { 150 152 usb_log_error("Failed to allocate OHCI driver.\n"); … … 169 171 "Failed to create OHCI HC function: %s.\n", str_error(ret)); 170 172 ddf_fun_set_ops(instance->hc_fun, &hc_ops); 171 ddf_fun_data_implant(instance->hc_fun, &instance->hc); 173 hc_t *hc = ddf_fun_data_alloc(instance->hc_fun, sizeof(hc_t)); 174 ret = hc ? EOK : ENOMEM; 175 CHECK_RET_DEST_FREE_RETURN(ret, 176 "Failed to allocate HCD structure: %s.\n", str_error(ret)); 172 177 173 178 instance->rh_fun = ddf_fun_create(device, fun_inner, "ohci_rh"); … … 223 228 } 224 229 225 ret = hc_init( &instance->hc, reg_base, reg_size, interrupts);230 ret = hc_init(hc, reg_base, reg_size, interrupts); 226 231 CHECK_RET_DEST_FREE_RETURN(ret, 227 232 "Failed to init ohci_hcd: %s.\n", str_error(ret)); … … 229 234 #define CHECK_RET_FINI_RETURN(ret, message...) \ 230 235 if (ret != EOK) { \ 231 hc_fini( &instance->hc); \236 hc_fini(hc); \ 232 237 unregister_interrupt_handler(device, irq); \ 233 238 CHECK_RET_DEST_FREE_RETURN(ret, message); \ … … 243 248 "Failed to add OHCI to HC class: %s.\n", str_error(ret)); 244 249 245 ret = hc_register_hub( &instance->hc, instance->rh_fun);250 ret = hc_register_hub(hc, instance->rh_fun); 246 251 CHECK_RET_FINI_RETURN(ret, 247 252 "Failed to register OHCI root hub: %s.\n", str_error(ret)); -
uspace/drv/bus/usb/ohci/ohci.h
r5df69cb r2f87aa6 34 34 #ifndef DRV_OHCI_OHCI_H 35 35 #define DRV_OHCI_OHCI_H 36 #include <ddi.h>37 36 #include <ddf/driver.h> 38 37
Note:
See TracChangeset
for help on using the changeset viewer.