Changeset 8351f9a4 in mainline for uspace/drv/bus/usb/usbhub/port.c


Ignore:
Timestamp:
2015-08-25T04:17:36Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b4b534ac
Parents:
691130cf
Message:

usbhub: Rework port reset a bit.

return error if port reset did not end up with enabled port

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port.c

    r691130cf r8351f9a4  
    175175                } else {
    176176                        /* Handle the case we were in reset */
    177                         usb_hub_port_reset_fail(port);
     177                        //usb_hub_port_reset_fail(port);
    178178                        /* If enabled change was reported leave the removal
    179179                         * to that handler, it shall ACK the change too. */
     
    353353{
    354354        if (enable) {
    355                 const int rc =
     355                int rc =
    356356                    usb_hub_port_set_feature(port, USB_HUB_FEATURE_PORT_RESET);
    357357                if (rc != EOK) {
    358                         usb_log_error("(%p-%u): Port reset failed: %s.\n",
     358                        usb_log_error("(%p-%u): Port reset request failed: %s.",
    359359                            hub, port->port_number, str_error(rc));
    360360                        return rc;
     
    363363                fibril_mutex_lock(&port->mutex);
    364364                port->reset_status = IN_RESET;
    365                 while (port->reset_status == IN_RESET) {
    366                         fibril_condvar_wait(&port->reset_cv,
    367                             &port->mutex);
    368                 }
     365                while (port->reset_status == IN_RESET)
     366                        fibril_condvar_wait(&port->reset_cv, &port->mutex);
     367                rc = port->reset_status == RESET_OK ? EOK : ESTALL;
    369368                fibril_mutex_unlock(&port->mutex);
    370                 return port->reset_status == RESET_OK ? EOK : ESTALL;
     369                return rc;
    371370        } else {
    372371                return usb_hub_port_clear_feature(port,
     
    394393        free(arg);
    395394
    396         usb_log_debug("(%p-%u): New device detected.", hub,
    397             port->port_number);
     395        usb_log_debug("(%p-%u): New device sequence.", hub, port->port_number);
    398396
    399397        async_exch_t *exch = usb_device_bus_exchange_begin(hub->usb_device);
Note: See TracChangeset for help on using the changeset viewer.