Changes in uspace/srv/devman/devman.c [45059d6b:d0dd7b5] in mainline
- File:
-
- 1 edited
-
uspace/srv/devman/devman.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
r45059d6b rd0dd7b5 548 548 549 549 fibril_mutex_lock(&driver->driver_mutex); 550 551 async_exch_t *exch = async_exchange_begin(driver->sess); 552 async_sess_t *sess = async_connect_me_to(EXCHANGE_SERIALIZE, exch, 553 DRIVER_DEVMAN, 0, 0); 554 async_exchange_end(exch); 555 556 if (!sess) { 557 fibril_mutex_unlock(&driver->driver_mutex); 558 return; 559 } 550 560 551 561 /* … … 573 583 fibril_mutex_unlock(&driver->driver_mutex); 574 584 575 add_device( driver, dev, tree);585 add_device(sess, driver, dev, tree); 576 586 577 587 /* … … 593 603 link = driver->devices.head.next; 594 604 } 605 606 async_hangup(sess); 595 607 596 608 /* … … 706 718 * @param node The device's node in the device tree. 707 719 */ 708 void add_device(driver_t *drv, dev_node_t *dev, dev_tree_t *tree) 720 void add_device(async_sess_t *sess, driver_t *drv, dev_node_t *dev, 721 dev_tree_t *tree) 709 722 { 710 723 /* … … 723 736 } 724 737 725 async_exch_t *exch = async_exchange_begin( drv->sess);738 async_exch_t *exch = async_exchange_begin(sess); 726 739 727 740 ipc_call_t answer; … … 793 806 fibril_mutex_unlock(&drv->driver_mutex); 794 807 795 /* Notify the driver about the new device. */ 796 if (is_running) 797 add_device(drv, dev, tree); 808 if (is_running) { 809 /* Notify the driver about the new device. */ 810 async_exch_t *exch = async_exchange_begin(drv->sess); 811 async_sess_t *sess = async_connect_me_to(EXCHANGE_SERIALIZE, exch, 812 DRIVER_DEVMAN, 0, 0); 813 async_exchange_end(exch); 814 815 if (sess) { 816 add_device(sess, drv, dev, tree); 817 async_hangup(sess); 818 } 819 } 798 820 799 821 return true; … … 897 919 return dev; 898 920 } 899 900 /** Get list of device functions. */901 int dev_get_functions(dev_tree_t *tree, dev_node_t *dev,902 devman_handle_t *hdl_buf, size_t buf_size, size_t *act_size)903 {904 size_t act_cnt;905 size_t buf_cnt;906 907 assert(fibril_rwlock_is_locked(&tree->rwlock));908 909 buf_cnt = buf_size / sizeof(devman_handle_t);910 911 act_cnt = list_count(&dev->functions);912 *act_size = act_cnt * sizeof(devman_handle_t);913 914 if (buf_size % sizeof(devman_handle_t) != 0)915 return EINVAL;916 917 size_t pos = 0;918 list_foreach(dev->functions, item) {919 fun_node_t *fun =920 list_get_instance(item, fun_node_t, dev_functions);921 922 if (pos < buf_cnt)923 hdl_buf[pos] = fun->handle;924 pos++;925 }926 927 return EOK;928 }929 930 921 931 922 /* Function nodes */ … … 1154 1145 char *rel_path = path; 1155 1146 char *next_path_elem = NULL; 1156 bool cont = (rel_path[1] != '\0');1147 bool cont = true; 1157 1148 1158 1149 while (cont && fun != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.
