Changes in uspace/drv/bus/usb/uhcirh/main.c [89e061d:c53007f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhcirh/main.c
r89e061d rc53007f 48 48 #define NAME "uhcirh" 49 49 50 static int hc_get_my_registers( constddf_dev_t *dev,50 static int hc_get_my_registers(ddf_dev_t *dev, 51 51 uintptr_t *io_reg_address, size_t *io_reg_size); 52 52 … … 73 73 { 74 74 printf(NAME ": HelenOS UHCI root hub driver.\n"); 75 usb_log_enable(USB_LOG_LEVEL_DEFAULT,NAME);75 log_init(NAME); 76 76 return ddf_driver_main(&uhci_rh_driver); 77 77 } … … 88 88 89 89 usb_log_debug2("uhci_rh_dev_add(handle=%" PRIun ")\n", 90 d evice->handle);90 ddf_dev_get_handle(device)); 91 91 92 92 uintptr_t io_regs = 0; 93 93 size_t io_size = 0; 94 94 uhci_root_hub_t *rh = NULL; 95 int r et = EOK;95 int rc; 96 96 97 #define CHECK_RET_FREE_RH_RETURN(ret, message...) \ 98 if (ret != EOK) { \ 99 usb_log_error(message); \ 100 if (rh) \ 101 free(rh); \ 102 return ret; \ 103 } else (void)0 97 rc = hc_get_my_registers(device, &io_regs, &io_size); 98 if (rc != EOK) { 99 usb_log_error( "Failed to get registers from HC: %s.\n", 100 str_error(rc)); 101 return rc; 102 } 104 103 105 ret = hc_get_my_registers(device, &io_regs, &io_size);106 CHECK_RET_FREE_RH_RETURN(ret,107 "Failed to get registers from HC: %s.\n", str_error(ret));108 104 usb_log_debug("I/O regs at %p (size %zuB).\n", 109 105 (void *) io_regs, io_size); 110 106 111 rh = malloc(sizeof(uhci_root_hub_t)); 112 ret = (rh == NULL) ? ENOMEM : EOK; 113 CHECK_RET_FREE_RH_RETURN(ret, 114 "Failed to allocate rh driver instance.\n"); 107 rh = ddf_dev_data_alloc(device, sizeof(uhci_root_hub_t)); 108 if (rh == NULL) { 109 usb_log_error("Failed to allocate rh driver instance.\n"); 110 return ENOMEM; 111 } 115 112 116 ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device); 117 CHECK_RET_FREE_RH_RETURN(ret, 118 "Failed(%d) to initialize rh driver instance: %s.\n", 119 ret, str_error(ret)); 113 rc = uhci_root_hub_init(rh, (void*)io_regs, io_size, device); 114 if (rc != EOK) { 115 usb_log_error("Failed(%d) to initialize rh driver instance: " 116 "%s.\n", rc, str_error(rc)); 117 return rc; 118 } 120 119 121 device->driver_data = rh;122 120 usb_log_info("Controlling root hub '%s' (%" PRIun ").\n", 123 device->name, device->handle); 121 ddf_dev_get_name(device), ddf_dev_get_handle(device)); 122 124 123 return EOK; 125 124 } … … 133 132 */ 134 133 int hc_get_my_registers( 135 constddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)134 ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size) 136 135 { 137 assert(dev);138 139 136 async_sess_t *parent_sess = 140 devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle,141 IPC_FLAG_BLOCKING);137 devman_parent_device_connect(EXCHANGE_SERIALIZE, 138 ddf_dev_get_handle(dev), IPC_FLAG_BLOCKING); 142 139 if (!parent_sess) 143 140 return ENOMEM;
Note:
See TracChangeset
for help on using the changeset viewer.