Changeset 73a5857 in mainline for uspace/drv/bus/usb/xhci/hc.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/hc.c

    r2ca5a198 r73a5857  
    277277                goto err_cmd;
    278278
    279         fid_t fid = fibril_create(&event_worker, hc);
    280         if (!fid)
     279        hc->event_worker = joinable_fibril_create(&event_worker, hc);
     280        if (!hc->event_worker)
    281281                goto err_bus;
    282282
    283         // TODO: completion_reset
    284         hc->event_fibril_completion.active = true;
    285         fibril_mutex_initialize(&hc->event_fibril_completion.guard);
    286         fibril_condvar_initialize(&hc->event_fibril_completion.cv);
    287 
    288283        xhci_sw_ring_init(&hc->sw_ring, PAGE_SIZE / sizeof(xhci_trb_t));
    289284
    290         fibril_add_ready(fid);
     285        joinable_fibril_start(hc->event_worker);
    291286
    292287        return EOK;
     
    598593        }
    599594
    600         // TODO: completion_complete
    601         fibril_mutex_lock(&hc->event_fibril_completion.guard);
    602         hc->event_fibril_completion.active = false;
    603         fibril_condvar_broadcast(&hc->event_fibril_completion.cv);
    604         fibril_mutex_unlock(&hc->event_fibril_completion.guard);
    605 
    606         return EOK;
     595        return 0;
    607596}
    608597
     
    688677{
    689678        xhci_sw_ring_stop(&hc->sw_ring);
    690 
    691         // TODO: completion_wait
    692         fibril_mutex_lock(&hc->event_fibril_completion.guard);
    693         while (hc->event_fibril_completion.active)
    694                 fibril_condvar_wait(&hc->event_fibril_completion.cv,
    695                     &hc->event_fibril_completion.guard);
    696         fibril_mutex_unlock(&hc->event_fibril_completion.guard);
     679        joinable_fibril_join(hc->event_worker);
    697680        xhci_sw_ring_fini(&hc->sw_ring);
    698681
Note: See TracChangeset for help on using the changeset viewer.