Changeset dd143621 in mainline


Ignore:
Timestamp:
2011-05-28T15:09:21Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a066122c, b59ec8c
Parents:
af6136d
Message:

Fix seizure of default address in unplugged hub

This revision shall fix following scenario

  • hub is attached to the host
  • second hub has several devices connected to it bus is not connected to the host
  • second hub is plugged to the first one
  • device discovery takes place
  • second hub is unplugged

Before this fix, the hub might fail to return the default address
because it might wait for ever for completion of port reset
(waiting for change on status pipe that would send no more data).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/usbhub.c

    raf6136d rdd143621  
    487487
    488488        fibril_mutex_lock(&hub->pending_ops_mutex);
     489
     490        /* The device is dead. However there might be some pending operations
     491         * that we need to wait for.
     492         * One of them is device adding in progress.
     493         * The respective fibril is probably waiting for status change
     494         * in port reset (port enable) callback.
     495         * Such change would never come (otherwise we would not be here).
     496         * Thus, we would flush all pending port resets.
     497         */
     498        if (hub->pending_ops_count > 0) {
     499                fibril_mutex_lock(&hub->port_mutex);
     500                size_t port;
     501                for (port = 0; port < hub->port_count; port++) {
     502                        usb_hub_port_t *the_port = hub->ports + port;
     503                        fibril_mutex_lock(&the_port->reset_mutex);
     504                        the_port->reset_completed = true;
     505                        the_port->reset_okay = false;
     506                        fibril_condvar_broadcast(&the_port->reset_cv);
     507                        fibril_mutex_unlock(&the_port->reset_mutex);
     508                }
     509                fibril_mutex_unlock(&hub->port_mutex);
     510        }
     511        /* And now wait for them. */
    489512        while (hub->pending_ops_count > 0) {
    490513                fibril_condvar_wait(&hub->pending_ops_cv,
Note: See TracChangeset for help on using the changeset viewer.