Changeset 52eead3e in mainline
- Timestamp:
- 2011-09-02T21:25:38Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 563d9d0a
- Parents:
- 0f1586d0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci.c
r0f1586d0 r52eead3e 44 44 #include "pci.h" 45 45 #include "hc.h" 46 #include "root_hub.h"47 46 48 47 typedef struct ohci { … … 51 50 52 51 hc_t hc; 53 rh_t rh;54 52 } ohci_t; 55 53 … … 150 148 int device_setup_ohci(ddf_dev_t *device) 151 149 { 150 assert(device); 151 152 152 ohci_t *instance = malloc(sizeof(ohci_t)); 153 153 if (instance == NULL) { … … 155 155 return ENOMEM; 156 156 } 157 instance->rh_fun = NULL; 158 instance->hc_fun = NULL; 157 159 158 160 #define CHECK_RET_DEST_FREE_RETURN(ret, message...) \ 159 161 if (ret != EOK) { \ 160 162 if (instance->hc_fun) { \ 161 instance->hc_fun->ops = NULL; \162 instance->hc_fun->driver_data = NULL; \163 163 ddf_fun_destroy(instance->hc_fun); \ 164 164 } \ 165 165 if (instance->rh_fun) { \ 166 instance->rh_fun->ops = NULL; \167 instance->rh_fun->driver_data = NULL; \168 166 ddf_fun_destroy(instance->rh_fun); \ 169 167 } \ 170 168 free(instance); \ 171 device->driver_data = NULL; \172 169 usb_log_error(message); \ 173 170 return ret; \ 174 171 } else (void)0 175 172 176 instance->rh_fun = NULL;177 173 instance->hc_fun = ddf_fun_create(device, fun_exposed, "ohci_hc"); 178 174 int ret = instance->hc_fun ? EOK : ENOMEM; … … 194 190 ret = pci_get_my_registers(device, ®_base, ®_size, &irq); 195 191 CHECK_RET_DEST_FREE_RETURN(ret, 196 "Failed to get memory addresses for %" PRIun ": %s.\n",192 "Failed to get register memory addresses for %" PRIun ": %s.\n", 197 193 device->handle, str_error(ret)); 198 194 usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n", … … 201 197 const size_t cmd_count = hc_irq_cmd_count(); 202 198 irq_cmd_t irq_cmds[cmd_count]; 199 irq_code_t irq_code = { .cmdcount = cmd_count, .cmds = irq_cmds }; 200 203 201 ret = 204 202 hc_get_irq_commands(irq_cmds, sizeof(irq_cmds), reg_base, reg_size); … … 206 204 "Failed to generate IRQ commands: %s.\n", str_error(ret)); 207 205 208 irq_code_t irq_code = { .cmdcount = cmd_count, .cmds = irq_cmds };209 206 210 207 /* Register handler to avoid interrupt lockup */ … … 251 248 return EOK; 252 249 253 #undef CHECK_RET_DEST_FUN_RETURN254 250 #undef CHECK_RET_FINI_RETURN 255 251 }
Note:
See TracChangeset
for help on using the changeset viewer.