Changes in uspace/drv/bus/usb/uhcirh/main.c [c53007f:89e061d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhcirh/main.c
rc53007f r89e061d 48 48 #define NAME "uhcirh" 49 49 50 static int hc_get_my_registers( ddf_dev_t *dev,50 static int hc_get_my_registers(const 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 log_init(NAME);75 usb_log_enable(USB_LOG_LEVEL_DEFAULT, 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 df_dev_get_handle(device));90 device->handle); 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 c;95 int ret = EOK; 96 96 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 } 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 103 104 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)); 104 108 usb_log_debug("I/O regs at %p (size %zuB).\n", 105 109 (void *) io_regs, io_size); 106 110 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 } 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"); 112 115 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 } 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)); 119 120 121 device->driver_data = rh; 120 122 usb_log_info("Controlling root hub '%s' (%" PRIun ").\n", 121 ddf_dev_get_name(device), ddf_dev_get_handle(device)); 122 123 device->name, device->handle); 123 124 return EOK; 124 125 } … … 132 133 */ 133 134 int hc_get_my_registers( 134 ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)135 const ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size) 135 136 { 137 assert(dev); 138 136 139 async_sess_t *parent_sess = 137 devman_parent_device_connect(EXCHANGE_SERIALIZE, 138 ddf_dev_get_handle(dev),IPC_FLAG_BLOCKING);140 devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle, 141 IPC_FLAG_BLOCKING); 139 142 if (!parent_sess) 140 143 return ENOMEM;
Note:
See TracChangeset
for help on using the changeset viewer.