Changeset aefa0d5 in mainline
- Timestamp:
- 2011-09-23T19:16:31Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a61c683
- Parents:
- 0212751
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port.c
r0212751 raefa0d5 50 50 struct add_device_phase1 { 51 51 usb_hub_info_t *hub; 52 size_tport;52 usb_hub_port_t *port; 53 53 usb_speed_t speed; 54 54 }; … … 60 60 static int enable_port_callback(int port_no, void *arg); 61 61 static int add_device_phase1_worker_fibril(void *arg); 62 static int create_add_device_fibril(usb_hub_ info_t *hub, size_t port,62 static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_info_t *hub, 63 63 usb_speed_t speed); 64 64 … … 157 157 158 158 if (connected) { 159 const int opResult = create_add_device_fibril( hub,160 port->port_number,usb_port_speed(status));159 const int opResult = create_add_device_fibril(port, hub, 160 usb_port_speed(status)); 161 161 if (opResult != EOK) { 162 162 usb_log_error( … … 398 398 const int rc = usb_hc_new_device_wrapper(data->hub->usb_device->ddf_dev, 399 399 &data->hub->connection, data->speed, 400 enable_port_callback, (int) data->port, 401 &data->hub->ports[data->port], 402 &new_address, &child_handle, 400 enable_port_callback, (int) data->port->port_number, 401 data->port, &new_address, &child_handle, 403 402 NULL, NULL, NULL); 404 403 405 404 if (rc != EOK) { 406 405 usb_log_error("Failed registering device on port %zu: %s.\n", 407 data->port , str_error(rc));406 data->port->port_number, str_error(rc)); 408 407 goto leave; 409 408 } 410 409 411 fibril_mutex_lock(&data-> hub->ports[data->port].mutex);412 data-> hub->ports[data->port].attached_device.handle = child_handle;413 data-> hub->ports[data->port].attached_device.address = new_address;414 fibril_mutex_unlock(&data-> hub->ports[data->port].mutex);410 fibril_mutex_lock(&data->port->mutex); 411 data->port->attached_device.handle = child_handle; 412 data->port->attached_device.address = new_address; 413 fibril_mutex_unlock(&data->port->mutex); 415 414 416 415 usb_log_info("Detected new device on `%s' (port %zu), " 417 416 "address %d (handle %" PRIun ").\n", 418 data->hub->usb_device->ddf_dev->name, data->port ,417 data->hub->usb_device->ddf_dev->name, data->port->port_number, 419 418 new_address, child_handle); 420 419 421 420 leave: 422 free(arg);423 424 421 fibril_mutex_lock(&data->hub->pending_ops_mutex); 425 422 assert(data->hub->pending_ops_count > 0); 426 data->hub->pending_ops_count--;423 --data->hub->pending_ops_count; 427 424 fibril_condvar_signal(&data->hub->pending_ops_cv); 428 425 fibril_mutex_unlock(&data->hub->pending_ops_mutex); 429 426 427 free(arg); 430 428 431 429 return EOK; … … 441 439 * @return Error code. 442 440 */ 443 static int create_add_device_fibril(usb_hub_ info_t *hub, size_t port,441 static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_info_t *hub, 444 442 usb_speed_t speed) 445 443 { 444 assert(hub); 445 assert(port); 446 446 struct add_device_phase1 *data 447 447 = malloc(sizeof (struct add_device_phase1)); … … 453 453 data->speed = speed; 454 454 455 usb_hub_port_t *the_port = hub->ports + port; 456 457 fibril_mutex_lock(&the_port->mutex); 458 the_port->reset_completed = false; 459 fibril_mutex_unlock(&the_port->mutex); 455 fibril_mutex_lock(&port->mutex); 456 port->reset_completed = false; 457 fibril_mutex_unlock(&port->mutex); 460 458 461 459 fid_t fibril = fibril_create(add_device_phase1_worker_fibril, data); … … 465 463 } 466 464 fibril_mutex_lock(&hub->pending_ops_mutex); 467 hub->pending_ops_count++;465 ++hub->pending_ops_count; 468 466 fibril_mutex_unlock(&hub->pending_ops_mutex); 469 467 fibril_add_ready(fibril);
Note:
See TracChangeset
for help on using the changeset viewer.