Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    rb72efe8 r9934f7d  
    139139find_interrupt_context_by_id(interrupt_context_list_t *list, int id)
    140140{
     141        fibril_mutex_lock(&list->mutex);
     142       
     143        link_t *link = list->contexts.next;
    141144        interrupt_context_t *ctx;
    142145       
    143         fibril_mutex_lock(&list->mutex);
    144        
    145         list_foreach(list->contexts, link) {
     146        while (link != &list->contexts) {
    146147                ctx = list_get_instance(link, interrupt_context_t, link);
    147148                if (ctx->id == id) {
     
    149150                        return ctx;
    150151                }
     152                link = link->next;
    151153        }
    152154       
     
    158160find_interrupt_context(interrupt_context_list_t *list, ddf_dev_t *dev, int irq)
    159161{
     162        fibril_mutex_lock(&list->mutex);
     163       
     164        link_t *link = list->contexts.next;
    160165        interrupt_context_t *ctx;
    161166       
    162         fibril_mutex_lock(&list->mutex);
    163        
    164         list_foreach(list->contexts, link) {
     167        while (link != &list->contexts) {
    165168                ctx = list_get_instance(link, interrupt_context_t, link);
    166169                if (ctx->irq == irq && ctx->dev == dev) {
     
    168171                        return ctx;
    169172                }
     173                link = link->next;
    170174        }
    171175       
     
    227231}
    228232
    229 static ddf_fun_t *driver_get_function(list_t *functions, devman_handle_t handle)
     233static ddf_fun_t *driver_get_function(link_t *functions, devman_handle_t handle)
    230234{
    231235        ddf_fun_t *fun = NULL;
    232236       
    233237        fibril_mutex_lock(&functions_mutex);
    234        
    235         list_foreach(*functions, link) {
     238        link_t *link = functions->next;
     239       
     240        while (link != functions) {
    236241                fun = list_get_instance(link, ddf_fun_t, link);
    237242                if (fun->handle == handle) {
     
    239244                        return fun;
    240245                }
     246               
     247                link = link->next;
    241248        }
    242249       
Note: See TracChangeset for help on using the changeset viewer.