Changeset 74b852b in mainline for uspace/drv/bus/usb/xhci/commands.c


Ignore:
Timestamp:
2017-10-21T19:33:09Z (8 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5fd9c30
Parents:
f45c78f
Message:

Added synchronization to command list.

File:
1 edited

Legend:

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

    rf45c78f r74b852b  
    6767
    6868        list_initialize(&hc->commands);
     69
     70        fibril_mutex_initialize(&hc->commands_mtx);
     71
    6972        return EOK;
    7073}
     
    126129static inline xhci_cmd_t *get_command(xhci_hc_t *hc, uint64_t phys)
    127130{
     131        fibril_mutex_lock(&hc->commands_mtx);
     132
    128133        link_t *cmd_link = list_first(&hc->commands);
    129134
     
    139144        if (cmd_link != NULL) {
    140145                list_remove(cmd_link);
     146                fibril_mutex_unlock(&hc->commands_mtx);
    141147
    142148                return list_get_instance(cmd_link, xhci_cmd_t, link);
    143149        }
    144150
     151        fibril_mutex_unlock(&hc->commands_mtx);
    145152        return NULL;
    146153}
     
    151158        assert(cmd);
    152159
     160        fibril_mutex_lock(&hc->commands_mtx);
    153161        list_append(&cmd->link, &hc->commands);
     162        fibril_mutex_unlock(&hc->commands_mtx);
    154163
    155164        xhci_trb_ring_enqueue(&hc->command_ring, &cmd->trb, &cmd->trb_phys);
Note: See TracChangeset for help on using the changeset viewer.