Changeset e0df6c2 in mainline


Ignore:
Timestamp:
2011-02-12T03:04:40Z (14 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

Location:
uspace/drv/uhci-hcd
Files:
3 edited

Legend:

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

    rd6115e5 re0df6c2  
    134134         */
    135135        sleep(5);
    136         usb_log_enable(USB_LOG_LEVEL_DEBUG2, NAME);
     136        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    137137
    138138        return driver_main(&uhci_driver);
  • 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/**
  • uspace/drv/uhci-hcd/transfer_list.h

    rd6115e5 re0df6c2  
    3535#define DRV_UHCI_TRANSFER_LIST_H
    3636
     37#include <fibril_synch.h>
     38
    3739#include "uhci_struct/queue_head.h"
    3840
     
    4143typedef struct transfer_list
    4244{
     45        fibril_mutex_t guard;
    4346        queue_head_t *queue_head;
    4447        uint32_t queue_head_pa;
     
    5154
    5255void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next);
    53 
    5456
    5557static inline void transfer_list_fini(transfer_list_t *instance)
Note: See TracChangeset for help on using the changeset viewer.