Changeset 442fa6b in mainline for uspace/drv/bus/usb/usbhub/usbhub.c


Ignore:
Timestamp:
2011-09-23T14:17:59Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3b617579
Parents:
c0587d90
Message:

usbhub: More functions use new usb_hub_port_t elements.

Use per port mutex, for more than just waiting for reset to complete.
Remove shared port_mutex from the hub structure.

File:
1 edited

Legend:

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

    rc0587d90 r442fa6b  
    187187                const bool change = (change_bitmap[port / 8] >> (port % 8)) & 1;
    188188                if (change) {
    189                         usb_hub_process_port_interrupt(hub, port);
     189                        usb_hub_port_process_interrupt(hub, port);
    190190                }
    191191        }
     
    217217        info->ports = NULL;
    218218        info->port_count = -1;
    219         fibril_mutex_initialize(&info->port_mutex);
    220219        fibril_mutex_initialize(&info->pending_ops_mutex);
    221220        fibril_condvar_initialize(&info->pending_ops_cv);
     
    289288                for (port = 1; port <= hub_info->port_count; ++port) {
    290289                        usb_log_debug("Powering port %zu.\n", port);
    291                         opResult = usb_hub_set_port_feature(
     290                        opResult = usb_hub_port_set_feature(
    292291                            &hub_info->ports[port], USB_HUB_FEATURE_PORT_POWER);
    293292                        if (opResult != EOK) {
     
    365364                 * switch them all off to prevent damage. */
    366365                //TODO Consider ganged power switching here.
     366                //TODO Hub should have turned the ports off already,
     367                //this is redundant.
    367368                size_t port;
    368369                for (port = 1; port <= hub_info->port_count; ++port) {
    369                         const int opResult = usb_hub_clear_port_feature(
     370                        const int opResult = usb_hub_port_clear_feature(
    370371                            &hub_info->ports[port], USB_HUB_FEATURE_PORT_POWER);
    371372                        if (opResult != EOK) {
     
    381382                size_t port;
    382383                for (port = 1; port <= hub_info->port_count; ++port) {
    383                         const int opResult = usb_hub_set_port_feature(
     384                        const int opResult = usb_hub_port_set_feature(
    384385                            &hub_info->ports[port], USB_HUB_FEATURE_PORT_POWER);
    385386                        if (opResult != EOK) {
     
    478479         */
    479480        if (hub->pending_ops_count > 0) {
    480                 fibril_mutex_lock(&hub->port_mutex);
    481481                size_t port;
    482482                for (port = 0; port < hub->port_count; port++) {
    483                         usb_hub_port_t *the_port = hub->ports + port;
    484                         fibril_mutex_lock(&the_port->reset_mutex);
    485                         the_port->reset_completed = true;
    486                         the_port->reset_okay = false;
    487                         fibril_condvar_broadcast(&the_port->reset_cv);
    488                         fibril_mutex_unlock(&the_port->reset_mutex);
     483                        usb_hub_port_reset_fail(&hub->ports[port]);
    489484                }
    490                 fibril_mutex_unlock(&hub->port_mutex);
    491485        }
    492486        /* And now wait for them. */
Note: See TracChangeset for help on using the changeset viewer.