Changeset 74b852b in mainline


Ignore:
Timestamp:
2017-10-21T19:33:09Z (6 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.

Location:
uspace/drv/bus/usb/xhci
Files:
2 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);
  • uspace/drv/bus/usb/xhci/hc.h

    rf45c78f r74b852b  
    3737#define XHCI_HC_H
    3838
     39#include <fibril_synch.h>
    3940#include <usb/host/usb_transfer_batch.h>
    4041#include "hw_struct/regs.h"
     
    8283        /* Command list */
    8384        list_t commands;
     85        fibril_mutex_t commands_mtx;
     86
    8487        list_t transfers;
    8588
Note: See TracChangeset for help on using the changeset viewer.