Changeset e4f8c77 in mainline for uspace/lib/drv/generic/driver.c


Ignore:
Timestamp:
2011-07-13T22:39:18Z (13 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e6910c8
Parents:
5974661 (diff), 8ecef91 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge libposix.

File:
1 edited

Legend:

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

    r5974661 re4f8c77  
    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       
     
    324317        }
    325318       
     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       
    326325        /*
    327326         * TODO - if the client is not a driver, check whether it is allowed to
     
    361360                        if (default_handler != NULL) {
    362361                                (*default_handler)(fun, callid, &call);
    363                                 break;
     362                                continue;
    364363                        }
    365364                       
     
    372371                            driver->name, iface_idx);
    373372                        async_answer_0(callid, ENOTSUP);
    374                         break;
     373                        continue;
    375374                }
    376375               
     
    384383                            "with id %d.\n", handle, iface_idx);
    385384                        async_answer_0(callid, ENOTSUP);
    386                         break;
     385                        continue;
    387386                }
    388387               
     
    403402                            "invalid interface method.", driver->name);
    404403                        async_answer_0(callid, ENOTSUP);
    405                         break;
     404                        continue;
    406405                }
    407406               
     
    413412                 */
    414413                (*iface_method_ptr)(fun, ops, callid, &call);
    415                 break;
    416414        }
    417415}
     
    428426
    429427/** Function for handling connections to device driver. */
    430 static void driver_connection(ipc_callid_t iid, ipc_call_t *icall)
     428static void driver_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    431429{
    432430        /* Select interface */
Note: See TracChangeset for help on using the changeset viewer.