Changes in uspace/drv/bus/usb/uhcirh/main.c [89e061d:5203e256] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhcirh/main.c
r89e061d r5203e256 36 36 #include <ddf/driver.h> 37 37 #include <devman.h> 38 #include <device/hw_res _parsed.h>38 #include <device/hw_res.h> 39 39 #include <errno.h> 40 40 #include <str_error.h> … … 51 51 uintptr_t *io_reg_address, size_t *io_reg_size); 52 52 53 static int uhci_rh_ dev_add(ddf_dev_t *device);53 static int uhci_rh_add_device(ddf_dev_t *device); 54 54 55 55 static driver_ops_t uhci_rh_driver_ops = { 56 . dev_add = uhci_rh_dev_add,56 .add_device = uhci_rh_add_device, 57 57 }; 58 58 … … 82 82 * @return Error code. 83 83 */ 84 static int uhci_rh_ dev_add(ddf_dev_t *device)84 static int uhci_rh_add_device(ddf_dev_t *device) 85 85 { 86 86 if (!device) 87 87 return EINVAL; 88 88 89 usb_log_debug2("uhci_rh_ dev_add(handle=%" PRIun ")\n",89 usb_log_debug2("uhci_rh_add_device(handle=%" PRIun ")\n", 90 90 device->handle); 91 91 … … 136 136 { 137 137 assert(dev); 138 138 139 139 async_sess_t *parent_sess = 140 140 devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle, … … 142 142 if (!parent_sess) 143 143 return ENOMEM; 144 145 hw_res_list_parsed_t hw_res; 146 hw_res_list_parsed_init(&hw_res); 147 const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0); 148 async_hangup(parent_sess); 144 145 hw_resource_list_t hw_resources; 146 const int ret = hw_res_get_resource_list(parent_sess, &hw_resources); 149 147 if (ret != EOK) { 148 async_hangup(parent_sess); 150 149 return ret; 151 150 } 152 153 if (hw_res.io_ranges.count != 1) { 154 hw_res_list_parsed_clean(&hw_res); 155 return EINVAL; 151 152 uintptr_t io_address = 0; 153 size_t io_size = 0; 154 bool io_found = false; 155 156 size_t i = 0; 157 for (; i < hw_resources.count; i++) { 158 hw_resource_t *res = &hw_resources.resources[i]; 159 if (res->type == IO_RANGE) { 160 io_address = res->res.io_range.address; 161 io_size = res->res.io_range.size; 162 io_found = true; 163 } 164 156 165 } 157 166 async_hangup(parent_sess); 167 168 if (!io_found) 169 return ENOENT; 170 158 171 if (io_reg_address != NULL) 159 *io_reg_address = hw_res.io_ranges.ranges[0].address;160 172 *io_reg_address = io_address; 173 161 174 if (io_reg_size != NULL) 162 *io_reg_size = hw_res.io_ranges.ranges[0].size; 163 164 hw_res_list_parsed_clean(&hw_res); 175 *io_reg_size = io_size; 176 165 177 return EOK; 166 178 }
Note:
See TracChangeset
for help on using the changeset viewer.