Changes in uspace/lib/drv/generic/driver.c [ca48672:fafb8e5] in mainline
- File:
-
- 1 edited
-
uspace/lib/drv/generic/driver.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
rca48672 rfafb8e5 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda3 2 * Copyright (c) 2010 Lenka Trochtova 3 * Copyright (c) 2011 Jiri Svoboda 4 4 * All rights reserved. 5 5 * … … 237 237 } 238 238 239 static void driver_dev_quiesce(ipc_call_t *icall)240 {241 devman_handle_t devh = ipc_get_arg1(icall);242 ddf_fun_t *fun;243 link_t *link;244 245 fibril_mutex_lock(&devices_mutex);246 ddf_dev_t *dev = driver_get_device(devh);247 if (dev != NULL)248 dev_add_ref(dev);249 fibril_mutex_unlock(&devices_mutex);250 251 if (dev == NULL) {252 async_answer_0(icall, ENOENT);253 return;254 }255 256 errno_t rc;257 258 if (driver->driver_ops->dev_quiesce != NULL) {259 rc = driver->driver_ops->dev_quiesce(dev);260 } else {261 /*262 * If the driver does not implement quiesce, we will263 * simply request all subordinate functions to quiesce.264 */265 fibril_mutex_lock(&functions_mutex);266 link = list_first(&functions);267 while (link != NULL) {268 fun = list_get_instance(link, ddf_fun_t, link);269 if (fun->dev == dev)270 ddf_fun_quiesce(fun);271 link = list_next(link, &functions);272 }273 fibril_mutex_unlock(&functions_mutex);274 rc = EOK;275 }276 277 dev_del_ref(dev);278 async_answer_0(icall, rc);279 }280 281 239 static void driver_fun_online(ipc_call_t *icall) 282 240 { … … 399 357 case DRIVER_DEV_GONE: 400 358 driver_dev_gone(&call); 401 break;402 case DRIVER_DEV_QUIESCE:403 driver_dev_quiesce(&call);404 359 break; 405 360 case DRIVER_FUN_ONLINE: … … 948 903 } 949 904 950 /** Quiesce function.951 *952 * @param fun Function to quiesce953 *954 * @return EOK on success or an error code955 *956 */957 errno_t ddf_fun_quiesce(ddf_fun_t *fun)958 {959 assert(fun->bound == true);960 961 errno_t res = devman_drv_fun_quiesce(fun->handle);962 if (res != EOK)963 return res;964 965 return EOK;966 }967 968 905 /** Add single match ID to inner function. 969 906 * … … 1034 971 } 1035 972 1036 /** Wait for function to enter stable state.1037 *1038 * @param fun Function1039 * @return EOK on success or an error code1040 */1041 errno_t ddf_fun_wait_stable(ddf_fun_t *fun)1042 {1043 return devman_drv_fun_wait_stable(fun->handle);1044 }1045 1046 973 errno_t ddf_driver_main(const driver_t *drv) 1047 974 { 1048 port_id_t drv_port;1049 port_id_t devman_port;1050 1051 975 /* 1052 976 * Remember the driver structure - driver_ops will be called by generic … … 1059 983 * incoming connections. 1060 984 */ 1061 errno_t rc = async_create_port(INTERFACE_DDF_DRIVER, 1062 driver_connection_driver, NULL, &drv_port); 985 port_id_t port; 986 errno_t rc = async_create_port(INTERFACE_DDF_DRIVER, driver_connection_driver, 987 NULL, &port); 1063 988 if (rc != EOK) { 1064 989 printf("Error: Failed to create driver port.\n"); … … 1067 992 1068 993 rc = async_create_port(INTERFACE_DDF_DEVMAN, driver_connection_devman, 1069 NULL, & devman_port);994 NULL, &port); 1070 995 if (rc != EOK) { 1071 996 printf("Error: Failed to create devman port.\n"); 1072 async_port_destroy(drv_port);1073 997 return rc; 1074 998 } … … 1081 1005 "(%s).\n", (rc == EEXIST) ? "driver already started" : 1082 1006 str_error(rc)); 1083 async_port_destroy(devman_port); 1084 async_port_destroy(drv_port); 1007 1085 1008 return rc; 1086 1009 } … … 1090 1013 if (rc != EOK) { 1091 1014 printf("Error: Failed returning task value.\n"); 1092 // XXX devman_driver_unregister1093 async_port_destroy(devman_port);1094 async_port_destroy(drv_port);1095 1015 return rc; 1096 1016 }
Note:
See TracChangeset
for help on using the changeset viewer.
