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

Changeset ddbd088 in mainline


Ignore:
Timestamp:
2018-01-29T15:13:13Z (4 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial
Children:
ee0ffa6
Parents:
1bab1c8
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-29 15:13:10)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-29 15:13:13)
Message:

ehci: fix invalid synchronization

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

Legend:

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

    r1bab1c8 rddbd088  
    100100 */
    101101int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
    102     const char *name)
     102    fibril_mutex_t *guard, const char *name)
    103103{
    104104        assert(instance);
     
    127127
    128128        ehci_rh_hub_desc_init(instance, EHCI_RD(caps->hcsparams));
     129        instance->guard = guard;
    129130        instance->status_change_endpoint = NULL;
    130131
     
    152153
    153154                /* Lock the HC guard */
    154                 fibril_mutex_lock(batch->ep->guard);
     155                fibril_mutex_lock(instance->guard);
    155156                const int err = endpoint_activate_locked(batch->ep, batch);
    156157                if (err) {
     
    167168                endpoint_add_ref(batch->ep);
    168169                instance->status_change_endpoint = batch->ep;
    169                 fibril_mutex_unlock(batch->ep->guard);
     170                fibril_mutex_unlock(instance->guard);
    170171        } else {
    171172                usb_log_debug("RH(%p): BATCH(%p) virtual request complete: %s",
     
    185186int ehci_rh_interrupt(ehci_rh_t *instance)
    186187{
     188        fibril_mutex_lock(instance->guard);
    187189        endpoint_t *ep = instance->status_change_endpoint;
    188         if (!ep)
    189                 return EOK;
    190 
    191         fibril_mutex_lock(ep->guard);
     190        if (!ep) {
     191                fibril_mutex_unlock(instance->guard);
     192                return EOK;
     193        }
     194
    192195        usb_transfer_batch_t * const batch = ep->active_batch;
    193196        endpoint_deactivate_locked(ep);
    194197        instance->status_change_endpoint = NULL;
    195         fibril_mutex_unlock(ep->guard);
     198        fibril_mutex_unlock(instance->guard);
    196199
    197200        endpoint_del_ref(ep);
  • uspace/drv/bus/usb/ehci/ehci_rh.h

    r1bab1c8 rddbd088  
    6464        bool resume_flag[EHCI_MAX_PORTS];
    6565
     66        /* HC guard */
     67        fibril_mutex_t *guard;
     68
    6669        /*
    6770         * This is sort of hacky, but better than duplicating functionality.
     
    7780
    7881int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
    79     const char *name);
     82    fibril_mutex_t *guard, const char *name);
    8083int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch);
    8184int ehci_rh_interrupt(ehci_rh_t *instance);
  • uspace/drv/bus/usb/ehci/hc.c

    r1bab1c8 rddbd088  
    187187        usb_log_info("HC(%p): Initializing RH(%p).", instance, &instance->rh);
    188188        ehci_rh_init(
    189             &instance->rh, instance->caps, instance->registers, "ehci rh");
     189            &instance->rh, instance->caps, instance->registers, &instance->guard,
     190            "ehci rh");
    190191
    191192        ehci_bus_init(&instance->bus, instance);
Note: See TracChangeset for help on using the changeset viewer.