Ignore:
File:
1 edited

Legend:

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

    r79ae36dd rb72efe8  
    139139find_interrupt_context_by_id(interrupt_context_list_t *list, int id)
    140140{
     141        interrupt_context_t *ctx;
     142       
    141143        fibril_mutex_lock(&list->mutex);
    142144       
    143         link_t *link = list->contexts.next;
    144         interrupt_context_t *ctx;
    145        
    146         while (link != &list->contexts) {
     145        list_foreach(list->contexts, link) {
    147146                ctx = list_get_instance(link, interrupt_context_t, link);
    148147                if (ctx->id == id) {
     
    150149                        return ctx;
    151150                }
    152                 link = link->next;
    153151        }
    154152       
     
    160158find_interrupt_context(interrupt_context_list_t *list, ddf_dev_t *dev, int irq)
    161159{
     160        interrupt_context_t *ctx;
     161       
    162162        fibril_mutex_lock(&list->mutex);
    163163       
    164         link_t *link = list->contexts.next;
    165         interrupt_context_t *ctx;
    166        
    167         while (link != &list->contexts) {
     164        list_foreach(list->contexts, link) {
    168165                ctx = list_get_instance(link, interrupt_context_t, link);
    169166                if (ctx->irq == irq && ctx->dev == dev) {
     
    171168                        return ctx;
    172169                }
    173                 link = link->next;
    174170        }
    175171       
     
    231227}
    232228
    233 static ddf_fun_t *driver_get_function(link_t *functions, devman_handle_t handle)
     229static ddf_fun_t *driver_get_function(list_t *functions, devman_handle_t handle)
    234230{
    235231        ddf_fun_t *fun = NULL;
    236232       
    237233        fibril_mutex_lock(&functions_mutex);
    238         link_t *link = functions->next;
    239        
    240         while (link != functions) {
     234       
     235        list_foreach(*functions, link) {
    241236                fun = list_get_instance(link, ddf_fun_t, link);
    242237                if (fun->handle == handle) {
     
    244239                        return fun;
    245240                }
    246                
    247                 link = link->next;
    248241        }
    249242       
     
    361354                        if (default_handler != NULL) {
    362355                                (*default_handler)(fun, callid, &call);
    363                                 break;
     356                                continue;
    364357                        }
    365358                       
     
    372365                            driver->name, iface_idx);
    373366                        async_answer_0(callid, ENOTSUP);
    374                         break;
     367                        continue;
    375368                }
    376369               
     
    384377                            "with id %d.\n", handle, iface_idx);
    385378                        async_answer_0(callid, ENOTSUP);
    386                         break;
     379                        continue;
    387380                }
    388381               
     
    403396                            "invalid interface method.", driver->name);
    404397                        async_answer_0(callid, ENOTSUP);
    405                         break;
     398                        continue;
    406399                }
    407400               
     
    413406                 */
    414407                (*iface_method_ptr)(fun, ops, callid, &call);
    415                 break;
    416408        }
    417409}
     
    428420
    429421/** Function for handling connections to device driver. */
    430 static void driver_connection(ipc_callid_t iid, ipc_call_t *icall)
     422static void driver_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    431423{
    432424        /* Select interface */
Note: See TracChangeset for help on using the changeset viewer.