Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c9467b0 in mainline


Ignore:
Timestamp:
2013-01-07T17:30:03Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
a5a470c
Parents:
e6becb9
Message:

usbhub: Fix after porting to new usb ops.

Check attached handle instead of attached device function.
Release default address after successful enumeration.
Decrease pending ops count after device enumeration.

Remove attached_device member.
usb_hub_port_fini is safe to call on ports withou attached devices.

Location:
uspace/drv/bus/usb/usbhub
Files:
3 edited

Legend:

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

    re6becb9 rc9467b0  
    6666{
    6767        assert(port);
    68         if (port->attached_device.fun)
     68        if (port->attached_handle != USB_DEVICE_HANDLE_INVALID)
    6969                return usb_hub_port_device_gone(port, hub);
    7070        return EOK;
     
    471471        }
    472472
    473         usb_log_fatal("reserving default address\n");
    474 
    475473        /* Reserve default address */
    476474        int ret;
    477475        while ((ret = usb_reserve_default_address(exch, speed)) == ENOENT) {
    478                 usb_log_fatal("reserving default address %d\n", ret);
    479476                async_usleep(1000000);
    480477        }
     
    507504                                    "Failed to release default address\n");
    508505                }
     506        } else {
     507                if (usb_release_default_address(exch) != EOK)
     508                        usb_log_warning("Failed to release default address\n");
    509509        }
    510510        async_exchange_end(exch);
     511
     512        fibril_mutex_lock(&hub->pending_ops_mutex);
     513        assert(hub->pending_ops_count > 0);
     514        --hub->pending_ops_count;
     515        fibril_condvar_signal(&hub->pending_ops_cv);
     516        fibril_mutex_unlock(&hub->pending_ops_mutex);
     517
    511518        return ret;
    512519#if 0
  • uspace/drv/bus/usb/usbhub/port.h

    re6becb9 rc9467b0  
    6161        usb_device_handle_t attached_handle;
    6262
    63         /** Information about attached device. */
    64         usb_hub_attached_device_t attached_device;
    6563} usb_hub_port_t;
    6664
     
    7371{
    7472        assert(port);
    75         port->attached_device.address = -1;
    76         port->attached_device.fun = NULL;
    7773        port->port_number = port_number;
    7874        port->control_pipe = control_pipe;
  • uspace/drv/bus/usb/usbhub/usbhub.c

    re6becb9 rc9467b0  
    200200
    201201        for (size_t port = 0; port < hub->port_count; ++port) {
    202                 if (hub->ports[port].attached_device.fun) {
    203                         const int ret =
    204                             usb_hub_port_fini(&hub->ports[port], hub);
    205                         if (ret != EOK)
    206                                 return ret;
    207                 }
     202                const int ret = usb_hub_port_fini(&hub->ports[port], hub);
     203                if (ret != EOK)
     204                        return ret;
    208205        }
    209206        free(hub->ports);
Note: See TracChangeset for help on using the changeset viewer.