Changes in uspace/lib/drv/generic/driver.c [ff65e91:79ae36dd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
rff65e91 r79ae36dd 139 139 find_interrupt_context_by_id(interrupt_context_list_t *list, int id) 140 140 { 141 fibril_mutex_lock(&list->mutex); 142 143 link_t *link = list->contexts.next; 141 144 interrupt_context_t *ctx; 142 145 143 fibril_mutex_lock(&list->mutex); 144 145 list_foreach(list->contexts, link) { 146 while (link != &list->contexts) { 146 147 ctx = list_get_instance(link, interrupt_context_t, link); 147 148 if (ctx->id == id) { … … 149 150 return ctx; 150 151 } 152 link = link->next; 151 153 } 152 154 … … 158 160 find_interrupt_context(interrupt_context_list_t *list, ddf_dev_t *dev, int irq) 159 161 { 162 fibril_mutex_lock(&list->mutex); 163 164 link_t *link = list->contexts.next; 160 165 interrupt_context_t *ctx; 161 166 162 fibril_mutex_lock(&list->mutex); 163 164 list_foreach(list->contexts, link) { 167 while (link != &list->contexts) { 165 168 ctx = list_get_instance(link, interrupt_context_t, link); 166 169 if (ctx->irq == irq && ctx->dev == dev) { … … 168 171 return ctx; 169 172 } 173 link = link->next; 170 174 } 171 175 … … 227 231 } 228 232 229 static ddf_fun_t *driver_get_function(li st_t *functions, devman_handle_t handle)233 static ddf_fun_t *driver_get_function(link_t *functions, devman_handle_t handle) 230 234 { 231 235 ddf_fun_t *fun = NULL; 232 236 233 237 fibril_mutex_lock(&functions_mutex); 234 235 list_foreach(*functions, link) { 238 link_t *link = functions->next; 239 240 while (link != functions) { 236 241 fun = list_get_instance(link, ddf_fun_t, link); 237 242 if (fun->handle == handle) { … … 239 244 return fun; 240 245 } 246 247 link = link->next; 241 248 } 242 249 … … 317 324 } 318 325 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 325 326 /* 326 327 * TODO - if the client is not a driver, check whether it is allowed to … … 360 361 if (default_handler != NULL) { 361 362 (*default_handler)(fun, callid, &call); 362 continue;363 break; 363 364 } 364 365 … … 371 372 driver->name, iface_idx); 372 373 async_answer_0(callid, ENOTSUP); 373 continue;374 break; 374 375 } 375 376 … … 383 384 "with id %d.\n", handle, iface_idx); 384 385 async_answer_0(callid, ENOTSUP); 385 continue;386 break; 386 387 } 387 388 … … 402 403 "invalid interface method.", driver->name); 403 404 async_answer_0(callid, ENOTSUP); 404 continue;405 break; 405 406 } 406 407 … … 412 413 */ 413 414 (*iface_method_ptr)(fun, ops, callid, &call); 415 break; 414 416 } 415 417 } … … 426 428 427 429 /** Function for handling connections to device driver. */ 428 static void driver_connection(ipc_callid_t iid, ipc_call_t *icall , void *arg)430 static void driver_connection(ipc_callid_t iid, ipc_call_t *icall) 429 431 { 430 432 /* Select interface */
Note:
See TracChangeset
for help on using the changeset viewer.