Changeset 73a5857 in mainline for uspace/drv/bus/usb/xhci/rh.c


Ignore:
Timestamp:
2018-01-31T23:31:05Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
53fdf8c
Parents:
2ca5a198
Message:

usbhost: add joinable_fibril utility

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/rh.c

    r2ca5a198 r73a5857  
    9696        }
    9797
    98         fid_t fid = fibril_create(&rh_worker, rh);
    99         if (!fid) {
     98        rh->event_worker = joinable_fibril_create(&rh_worker, rh);
     99        if (!rh->event_worker) {
    100100                free(rh->ports);
    101101                return err;
     
    113113        xhci_sw_ring_init(&rh->event_ring, rh->max_ports);
    114114
    115         hc->event_fibril_completion.active = true;
    116         fibril_mutex_initialize(&hc->event_fibril_completion.guard);
    117         fibril_condvar_initialize(&hc->event_fibril_completion.cv);
    118 
    119         fibril_add_ready(fid);
     115        joinable_fibril_start(rh->event_worker);
    120116
    121117        return EOK;
     
    132128
    133129        xhci_sw_ring_stop(&rh->event_ring);
    134 
    135         // TODO: completion_wait
    136         fibril_mutex_lock(&rh->event_fibril_completion.guard);
    137         while (rh->event_fibril_completion.active)
    138                 fibril_condvar_wait(&rh->event_fibril_completion.cv,
    139                     &rh->event_fibril_completion.guard);
    140         fibril_mutex_unlock(&rh->event_fibril_completion.guard);
     130        joinable_fibril_join(rh->event_worker);
    141131        xhci_sw_ring_fini(&rh->event_ring);
    142132        return EOK;
     
    332322        }
    333323
    334         // TODO: completion_complete
    335         fibril_mutex_lock(&rh->event_fibril_completion.guard);
    336         rh->event_fibril_completion.active = false;
    337         fibril_condvar_broadcast(&rh->event_fibril_completion.cv);
    338         fibril_mutex_unlock(&rh->event_fibril_completion.guard);
    339 
    340         return EOK;
     324        return 0;
    341325}
    342326
Note: See TracChangeset for help on using the changeset viewer.