Ignore:
File:
1 edited

Legend:

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

    rff65e91 r79ae36dd  
    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       
     
    317324        }
    318325       
    319         if (fun->conn_handler != NULL) {
    320                 /* Driver has a custom connection handler. */
    321                 (*fun->conn_handler)(iid, icall, (void *)fun);
    322                 return;
    323         }
    324        
    325326        /*
    326327         * TODO - if the client is not a driver, check whether it is allowed to
     
    360361                        if (default_handler != NULL) {
    361362                                (*default_handler)(fun, callid, &call);
    362                                 continue;
     363                                break;
    363364                        }
    364365                       
     
    371372                            driver->name, iface_idx);
    372373                        async_answer_0(callid, ENOTSUP);
    373                         continue;
     374                        break;
    374375                }
    375376               
     
    383384                            "with id %d.\n", handle, iface_idx);
    384385                        async_answer_0(callid, ENOTSUP);
    385                         continue;
     386                        break;
    386387                }
    387388               
     
    402403                            "invalid interface method.", driver->name);
    403404                        async_answer_0(callid, ENOTSUP);
    404                         continue;
     405                        break;
    405406                }
    406407               
     
    412413                 */
    413414                (*iface_method_ptr)(fun, ops, callid, &call);
     415                break;
    414416        }
    415417}
     
    426428
    427429/** Function for handling connections to device driver. */
    428 static void driver_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     430static void driver_connection(ipc_callid_t iid, ipc_call_t *icall)
    429431{
    430432        /* Select interface */
Note: See TracChangeset for help on using the changeset viewer.