Changeset 1a5b252 in mainline for uspace/srv/devman/devman.c
- Timestamp:
- 2011-08-21T11:54:15Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8cc4ddb
- Parents:
- e64df9a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
re64df9a r1a5b252 483 483 } 484 484 485 /** Detach driver from device. 486 * 487 * @param node The device's node in the device tree. 488 * @param drv The driver. 489 */ 490 void detach_driver(dev_node_t *dev) 491 { 492 /* XXX need lock on dev */ 493 driver_t *drv = dev->drv; 494 495 assert(drv != NULL); 496 log_msg(LVL_DEBUG, "detach_driver(dev=\"%s\",drv=\"%s\")", 497 dev->pfun->pathname, drv->name); 498 499 fibril_mutex_lock(&drv->driver_mutex); 500 501 dev->drv = NULL; 502 list_remove(&dev->driver_devices); 503 504 fibril_mutex_unlock(&drv->driver_mutex); 505 } 506 485 507 /** Start a driver 486 508 * … … 726 748 727 749 ipc_call_t answer; 728 aid_t req = async_send_2(exch, DRIVER_ ADD_DEVICE, dev->handle,750 aid_t req = async_send_2(exch, DRIVER_DEV_ADD, dev->handle, 729 751 parent_handle, &answer); 730 752 … … 800 822 } 801 823 824 int driver_dev_remove(dev_node_t *dev) 825 { 826 async_exch_t *exch; 827 sysarg_t retval; 828 driver_t *drv; 829 830 assert(dev != NULL); 831 log_msg(LVL_DEBUG, "driver_dev_remove(%p)", dev); 832 drv = dev->drv; 833 834 exch = async_exchange_begin(drv->sess); 835 retval = async_req_1_0(exch, DRIVER_DEV_REMOVE, dev->handle); 836 async_exchange_end(exch); 837 838 return retval; 839 840 } 841 842 int driver_fun_online(fun_node_t *fun) 843 { 844 async_exch_t *exch; 845 sysarg_t retval; 846 driver_t *drv; 847 848 log_msg(LVL_DEBUG, "driver_fun_online(%p)", fun); 849 if (fun->dev == NULL) { 850 /* XXX root function? */ 851 return EINVAL; 852 } 853 854 drv = fun->dev->drv; 855 856 exch = async_exchange_begin(drv->sess); 857 retval = async_req_1_0(exch, DRIVER_FUN_ONLINE, fun->handle); 858 loc_exchange_end(exch); 859 860 return retval; 861 } 862 863 int driver_fun_offline(fun_node_t *fun) 864 { 865 async_exch_t *exch; 866 sysarg_t retval; 867 driver_t *drv; 868 869 log_msg(LVL_DEBUG, "driver_fun_offline(%p)", fun); 870 if (fun->dev == NULL) { 871 /* XXX root function? */ 872 return EINVAL; 873 } 874 875 drv = fun->dev->drv; 876 877 exch = async_exchange_begin(drv->sess); 878 retval = async_req_1_0(exch, DRIVER_FUN_OFFLINE, fun->handle); 879 loc_exchange_end(exch); 880 881 return retval; 882 883 } 884 802 885 /** Initialize the device tree. 803 886 * … … 1065 1148 } 1066 1149 1150 /** Remove device from device tree. 1151 * 1152 * @param tree Device tree 1153 * @param dev Device node 1154 */ 1155 void remove_dev_node(dev_tree_t *tree, dev_node_t *dev) 1156 { 1157 assert(tree != NULL); 1158 assert(dev != NULL); 1159 assert(fibril_rwlock_is_write_locked(&tree->rwlock)); 1160 1161 log_msg(LVL_DEBUG, "remove_dev_node(dev=%p)", dev); 1162 1163 /* Remove node from the handle-to-node map. */ 1164 unsigned long key = dev->handle; 1165 hash_table_remove(&tree->devman_devices, &key, 1); 1166 1167 /* Unlink from parent function. */ 1168 dev->pfun->child = NULL; 1169 dev->pfun = NULL; 1170 } 1171 1172 1067 1173 /** Insert new function into device tree. 1068 1174 * … … 1127 1233 if (fun->dev != NULL) 1128 1234 list_remove(&fun->dev_functions); 1235 1236 fun->dev = NULL; 1129 1237 } 1130 1238
Note:
See TracChangeset
for help on using the changeset viewer.