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

Changeset 53a9d02 in mainline


Ignore:
Timestamp:
2018-01-11T09:17:43Z (4 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master
Children:
30fc56f
Parents:
17783bf
Message:

usb: fix errors introduced by recent changes

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/ehci_bus.c

    r17783bf r53a9d02  
    101101        ehci_bus_t *bus = (ehci_bus_t *) bus_base;
    102102        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    103         assert(fibril_mutex_is_locked(&bus_base->guard));
    104103
    105104        const int err = usb2_bus_ops.endpoint_register(ep);
  • uspace/drv/bus/usb/xhci/hc.c

    r17783bf r53a9d02  
    745745        usb_log_debug2("Obtained USB address: %d.\n", dev->base.address);
    746746
    747         /* From now on, the device is officially online, yay! */
    748         fibril_mutex_lock(&dev->base.guard);
    749         dev->base.online = true;
    750         fibril_mutex_unlock(&dev->base.guard);
    751 
    752747        return EOK;
    753748
  • uspace/lib/usbhost/src/bus.c

    r17783bf r53a9d02  
    109109                return ENOTSUP;
    110110
    111         if (dev->online) {
    112                 fibril_mutex_unlock(&dev->guard);
     111        if (dev->online)
    113112                return EINVAL;
    114         }
    115113
    116114        const int r = ops->device_enumerate(dev);
    117         if (!r) {
    118                 dev->online = true;
    119 
     115        if (r)
     116                return r;
     117
     118        dev->online = true;
     119
     120        if (dev->hub) {
    120121                fibril_mutex_lock(&dev->hub->guard);
    121122                list_append(&dev->link, &dev->hub->devices);
     
    123124        }
    124125
    125         return r;
     126        return EOK;
    126127}
    127128
     
    192193
    193194        /* Remove our device from our hub's children. */
    194         fibril_mutex_lock(&dev->hub->guard);
    195         list_remove(&dev->link);
    196         fibril_mutex_unlock(&dev->hub->guard);
     195        if (dev->hub) {
     196                fibril_mutex_lock(&dev->hub->guard);
     197                list_remove(&dev->link);
     198                fibril_mutex_unlock(&dev->hub->guard);
     199        }
    197200
    198201        /*
  • uspace/lib/usbhost/src/usb2_bus.c

    r17783bf r53a9d02  
    106106 *
    107107 * Reserve address, configure the control EP, issue a SET_ADDRESS command.
    108  * Configure the device with the new address, mark the device as online.
     108 * Configure the device with the new address,
    109109 */
    110110static int address_device(device_t *dev)
     
    160160                goto err_address;
    161161        }
    162         endpoint_del_ref(default_ep);
    163162
    164163        dev->address = address;
     
    173172        }
    174173
    175         /* From now on, the device is officially online, yay! */
    176         fibril_mutex_lock(&dev->guard);
    177         dev->online = true;
    178         fibril_mutex_unlock(&dev->guard);
    179 
    180174        return EOK;
    181175
    182176err_default_control_ep:
    183177        bus_endpoint_remove(default_ep);
    184         endpoint_del_ref(default_ep);
    185178err_address:
    186179        release_address(bus, address);
     
    235228{
    236229        usb2_bus_t *bus = bus_to_usb2_bus(ep->device->bus);
    237         assert(fibril_mutex_is_locked(&bus->base.guard));
     230        assert(fibril_mutex_is_locked(&ep->device->guard));
    238231        assert(ep);
    239232
Note: See TracChangeset for help on using the changeset viewer.