Changeset b72efe8 in mainline for uspace/srv/devman
- Timestamp:
- 2011-06-19T14:38:59Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 74464e8
- Parents:
- 1d1bb0f
- Location:
- uspace/srv/devman
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
r1d1bb0f rb72efe8 466 466 fibril_mutex_lock(&drivers_list->drivers_mutex); 467 467 468 link_t *link = drivers_list->drivers.next; 469 while (link != &drivers_list->drivers) { 468 list_foreach(drivers_list->drivers, link) { 470 469 drv = list_get_instance(link, driver_t, drivers); 471 470 score = get_match_score(drv, node); … … 474 473 best_drv = drv; 475 474 } 476 link = link->next;477 475 } 478 476 … … 536 534 driver_t *res = NULL; 537 535 driver_t *drv = NULL; 538 link_t *link;539 536 540 537 fibril_mutex_lock(&drv_list->drivers_mutex); 541 538 542 link = drv_list->drivers.next; 543 while (link != &drv_list->drivers) { 539 list_foreach(drv_list->drivers, link) { 544 540 drv = list_get_instance(link, driver_t, drivers); 545 541 if (str_cmp(drv->name, drv_name) == 0) { … … 547 543 break; 548 544 } 549 550 link = link->next;551 545 } 552 546 … … 584 578 * that has not been passed to the driver. 585 579 */ 586 link = driver->devices. next;587 while (link != &driver->devices ) {580 link = driver->devices.head.next; 581 while (link != &driver->devices.head) { 588 582 dev = list_get_instance(link, dev_node_t, driver_devices); 589 583 if (dev->passed_to_driver) { … … 622 616 * Restart the cycle to go through all devices again. 623 617 */ 624 link = driver->devices. next;618 link = driver->devices.head.next; 625 619 } 626 620 … … 1187 1181 1188 1182 fun_node_t *fun; 1189 link_t *link; 1190 1191 for (link = dev->functions.next; 1192 link != &dev->functions; 1193 link = link->next) { 1183 1184 list_foreach(dev->functions, link) { 1194 1185 fun = list_get_instance(link, fun_node_t, dev_functions); 1195 1186 … … 1385 1376 { 1386 1377 dev_class_t *cl; 1387 link_t *link = class_list->classes.next; 1388 1389 while (link != &class_list->classes) { 1378 1379 list_foreach(class_list->classes, link) { 1390 1380 cl = list_get_instance(link, dev_class_t, link); 1391 1381 if (str_cmp(cl->name, class_name) == 0) { 1392 1382 return cl; 1393 1383 } 1394 link = link->next;1395 1384 } 1396 1385 … … 1408 1397 assert(dev_name != NULL); 1409 1398 1410 link_t *link; 1411 for (link = dev_class->devices.next; 1412 link != &dev_class->devices; 1413 link = link->next) { 1399 list_foreach(dev_class->devices, link) { 1414 1400 dev_class_info_t *dev = list_get_instance(link, 1415 1401 dev_class_info_t, link); -
uspace/srv/devman/devman.h
r1d1bb0f rb72efe8 96 96 /** List of device ids for device-to-driver matching. */ 97 97 match_id_list_t match_ids; 98 /** Pointer to the linked list of devices controlled by this driver. */99 li nk_t devices;98 /** List of devices controlled by this driver. */ 99 list_t devices; 100 100 101 101 /** … … 108 108 typedef struct driver_list { 109 109 /** List of drivers */ 110 li nk_t drivers;110 list_t drivers; 111 111 /** Fibril mutex for list of drivers. */ 112 112 fibril_mutex_t drivers_mutex; … … 130 130 131 131 /** List of device functions. */ 132 li nk_t functions;132 list_t functions; 133 133 /** Driver of this device. */ 134 134 driver_t *drv; … … 170 170 match_id_list_t match_ids; 171 171 172 /** The list of device classes to which this device function belongs. */173 li nk_t classes;172 /** List of device classes to which this device function belongs. */ 173 list_t classes; 174 174 /** Devmap handle if the device function is registered by devmap. */ 175 175 devmap_handle_t devmap_handle; … … 228 228 * this class. 229 229 */ 230 li nk_t devices;230 list_t devices; 231 231 232 232 /** … … 280 280 typedef struct class_list { 281 281 /** List of classes. */ 282 li nk_t classes;282 list_t classes; 283 283 284 284 /** -
uspace/srv/devman/match.c
r1d1bb0f rb72efe8 59 59 int get_match_score(driver_t *drv, dev_node_t *dev) 60 60 { 61 link_t *drv_head = &drv->match_ids.ids ;62 link_t *dev_head = &dev->pfun->match_ids.ids ;61 link_t *drv_head = &drv->match_ids.ids.head; 62 link_t *dev_head = &dev->pfun->match_ids.ids.head; 63 63 64 if (list_empty(drv_head) || list_empty(dev_head)) 64 if (list_empty(&drv->match_ids.ids) || 65 list_empty(&dev->pfun->match_ids.ids)) { 65 66 return 0; 67 } 66 68 67 69 /* … … 70 72 int highest_score = 0; 71 73 72 link_t *drv_link = drv->match_ids.ids. next;74 link_t *drv_link = drv->match_ids.ids.head.next; 73 75 while (drv_link != drv_head) { 74 76 link_t *dev_link = dev_head->next;
Note:
See TracChangeset
for help on using the changeset viewer.