Changeset e0df6c2 in mainline for uspace/drv/uhci-hcd/transfer_list.c


Ignore:
Timestamp:
2011-02-12T03:04:40Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
67b6fc5
Parents:
d6115e5
Message:

Fix: properly check whether the removed batch is the first in the list
Add mutex to guard tranfser list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/transfer_list.c

    rd6115e5 re0df6c2  
    5252        queue_head_init(instance->queue_head);
    5353        list_initialize(&instance->batch_list);
     54        fibril_mutex_initialize(&instance->guard);
    5455        return EOK;
    5556}
     
    7677        batch->qh->next_queue = instance->queue_head->next_queue;
    7778
     79        fibril_mutex_lock(&instance->guard);
     80
    7881        if (instance->queue_head->element == instance->queue_head->next_queue) {
    7982                /* there is nothing scheduled */
     
    8285                usb_log_debug2("Added batch(%p) to queue %s first.\n",
    8386                        batch, instance->name);
     87                fibril_mutex_unlock(&instance->guard);
    8488                return;
    8589        }
     
    9498        usb_log_debug2("Added batch(%p) to queue %s last, first is %p.\n",
    9599                batch, instance->name, first );
     100        fibril_mutex_unlock(&instance->guard);
    96101}
    97102/*----------------------------------------------------------------------------*/
     
    105110
    106111        /* I'm the first one here */
    107         if (batch->link.next == &instance->batch_list) {
     112        if (batch->link.prev == &instance->batch_list) {
    108113                usb_log_debug("Removing tracer %p was first, next element %x.\n",
    109114                        batch, batch->qh->next_queue);
     
    121126{
    122127        assert(instance);
     128        fibril_mutex_lock(&instance->guard);
    123129        link_t *current = instance->batch_list.next;
    124130        while (current != &instance->batch_list) {
     
    132138                current = next;
    133139        }
     140        fibril_mutex_unlock(&instance->guard);
    134141}
    135142/**
Note: See TracChangeset for help on using the changeset viewer.