Changes in uspace/srv/devman/devman.c [b72efe8:c7bbf029] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
rb72efe8 rc7bbf029 466 466 fibril_mutex_lock(&drivers_list->drivers_mutex); 467 467 468 list_foreach(drivers_list->drivers, link) { 468 link_t *link = drivers_list->drivers.next; 469 while (link != &drivers_list->drivers) { 469 470 drv = list_get_instance(link, driver_t, drivers); 470 471 score = get_match_score(drv, node); … … 473 474 best_drv = drv; 474 475 } 476 link = link->next; 475 477 } 476 478 … … 534 536 driver_t *res = NULL; 535 537 driver_t *drv = NULL; 538 link_t *link; 536 539 537 540 fibril_mutex_lock(&drv_list->drivers_mutex); 538 541 539 list_foreach(drv_list->drivers, link) { 542 link = drv_list->drivers.next; 543 while (link != &drv_list->drivers) { 540 544 drv = list_get_instance(link, driver_t, drivers); 541 545 if (str_cmp(drv->name, drv_name) == 0) { … … 543 547 break; 544 548 } 549 550 link = link->next; 545 551 } 546 552 … … 558 564 dev_node_t *dev; 559 565 link_t *link; 566 int phone; 560 567 561 568 log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")", … … 563 570 564 571 fibril_mutex_lock(&driver->driver_mutex); 565 566 async_exch_t *exch = async_exchange_begin(driver->sess); 567 async_sess_t *sess = async_connect_me_to(EXCHANGE_SERIALIZE, exch, 568 DRIVER_DEVMAN, 0, 0); 569 async_exchange_end(exch); 570 571 if (!sess) { 572 573 phone = async_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0); 574 575 if (phone < 0) { 572 576 fibril_mutex_unlock(&driver->driver_mutex); 573 577 return; … … 578 582 * that has not been passed to the driver. 579 583 */ 580 link = driver->devices. head.next;581 while (link != &driver->devices .head) {584 link = driver->devices.next; 585 while (link != &driver->devices) { 582 586 dev = list_get_instance(link, dev_node_t, driver_devices); 583 587 if (dev->passed_to_driver) { … … 598 602 fibril_mutex_unlock(&driver->driver_mutex); 599 603 600 add_device( sess, driver, dev, tree);604 add_device(phone, driver, dev, tree); 601 605 602 606 /* … … 616 620 * Restart the cycle to go through all devices again. 617 621 */ 618 link = driver->devices. head.next;619 } 620 621 async_hangup( sess);622 link = driver->devices.next; 623 } 624 625 async_hangup(phone); 622 626 623 627 /* … … 669 673 list_initialize(&drv->devices); 670 674 fibril_mutex_initialize(&drv->driver_mutex); 671 drv-> sess = NULL;675 drv->phone = -1; 672 676 } 673 677 … … 733 737 * @param node The device's node in the device tree. 734 738 */ 735 void add_device(async_sess_t *sess, driver_t *drv, dev_node_t *dev, 736 dev_tree_t *tree) 739 void add_device(int phone, driver_t *drv, dev_node_t *dev, dev_tree_t *tree) 737 740 { 738 741 /* … … 743 746 drv->name, dev->pfun->name); 744 747 748 sysarg_t rc; 749 ipc_call_t answer; 750 745 751 /* Send the device to the driver. */ 746 752 devman_handle_t parent_handle; … … 750 756 parent_handle = 0; 751 757 } 752 753 async_exch_t *exch = async_exchange_begin(sess); 754 755 ipc_call_t answer; 756 aid_t req = async_send_2(exch, DRIVER_ADD_DEVICE, dev->handle, 758 759 aid_t req = async_send_2(phone, DRIVER_ADD_DEVICE, dev->handle, 757 760 parent_handle, &answer); 758 761 759 /* Send the device name to the driver. */760 sysarg_t rc = async_data_write_start(exch, dev->pfun->name,762 /* Send the device's name to the driver. */ 763 rc = async_data_write_start(phone, dev->pfun->name, 761 764 str_size(dev->pfun->name) + 1); 762 763 async_exchange_end(exch);764 765 765 if (rc != EOK) { 766 766 /* TODO handle error */ … … 823 823 if (is_running) { 824 824 /* Notify the driver about the new device. */ 825 async_exch_t *exch = async_exchange_begin(drv->sess); 826 async_sess_t *sess = async_connect_me_to(EXCHANGE_SERIALIZE, exch, 827 DRIVER_DEVMAN, 0, 0); 828 async_exchange_end(exch); 829 830 if (sess) { 831 add_device(sess, drv, dev, tree); 832 async_hangup(sess); 825 int phone = async_connect_me_to(drv->phone, DRIVER_DEVMAN, 0, 0); 826 if (phone >= 0) { 827 add_device(phone, drv, dev, tree); 828 async_hangup(phone); 833 829 } 834 830 } … … 1181 1177 1182 1178 fun_node_t *fun; 1183 1184 list_foreach(dev->functions, link) { 1179 link_t *link; 1180 1181 for (link = dev->functions.next; 1182 link != &dev->functions; 1183 link = link->next) { 1185 1184 fun = list_get_instance(link, fun_node_t, dev_functions); 1186 1185 … … 1376 1375 { 1377 1376 dev_class_t *cl; 1378 1379 list_foreach(class_list->classes, link) { 1377 link_t *link = class_list->classes.next; 1378 1379 while (link != &class_list->classes) { 1380 1380 cl = list_get_instance(link, dev_class_t, link); 1381 1381 if (str_cmp(cl->name, class_name) == 0) { 1382 1382 return cl; 1383 1383 } 1384 link = link->next; 1384 1385 } 1385 1386 … … 1397 1398 assert(dev_name != NULL); 1398 1399 1399 list_foreach(dev_class->devices, link) { 1400 link_t *link; 1401 for (link = dev_class->devices.next; 1402 link != &dev_class->devices; 1403 link = link->next) { 1400 1404 dev_class_info_t *dev = list_get_instance(link, 1401 1405 dev_class_info_t, link);
Note:
See TracChangeset
for help on using the changeset viewer.