Changes in uspace/lib/c/generic/devman.c [96b02eb9:622dea8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/devman.c
r96b02eb9 r622dea8 42 42 #include <devman.h> 43 43 #include <async.h> 44 #include <fibril_synch.h> 44 45 #include <errno.h> 45 46 #include <malloc.h> … … 50 51 static int devman_phone_client = -1; 51 52 53 static FIBRIL_MUTEX_INITIALIZE(devman_phone_mutex); 54 52 55 int devman_get_phone(devman_interface_t iface, unsigned int flags) 53 56 { 54 57 switch (iface) { 55 58 case DEVMAN_DRIVER: 56 if (devman_phone_driver >= 0) 59 fibril_mutex_lock(&devman_phone_mutex); 60 if (devman_phone_driver >= 0) { 61 fibril_mutex_unlock(&devman_phone_mutex); 57 62 return devman_phone_driver; 63 } 58 64 59 65 if (flags & IPC_FLAG_BLOCKING) 60 devman_phone_driver = ipc_connect_me_to_blocking(PHONE_NS, 66 devman_phone_driver = async_connect_me_to_blocking( 67 PHONE_NS, SERVICE_DEVMAN, DEVMAN_DRIVER, 0); 68 else 69 devman_phone_driver = async_connect_me_to(PHONE_NS, 61 70 SERVICE_DEVMAN, DEVMAN_DRIVER, 0); 62 else 63 devman_phone_driver = ipc_connect_me_to(PHONE_NS, 64 SERVICE_DEVMAN, DEVMAN_DRIVER, 0); 65 71 72 fibril_mutex_unlock(&devman_phone_mutex); 66 73 return devman_phone_driver; 67 74 case DEVMAN_CLIENT: 68 if (devman_phone_client >= 0) 75 fibril_mutex_lock(&devman_phone_mutex); 76 if (devman_phone_client >= 0) { 77 fibril_mutex_unlock(&devman_phone_mutex); 69 78 return devman_phone_client; 79 } 70 80 71 81 if (flags & IPC_FLAG_BLOCKING) 72 devman_phone_client = ipc_connect_me_to_blocking(PHONE_NS, 82 devman_phone_client = async_connect_me_to_blocking( 83 PHONE_NS, SERVICE_DEVMAN, DEVMAN_CLIENT, 0); 84 else 85 devman_phone_client = async_connect_me_to(PHONE_NS, 73 86 SERVICE_DEVMAN, DEVMAN_CLIENT, 0); 74 else 75 devman_phone_client = ipc_connect_me_to(PHONE_NS, 76 SERVICE_DEVMAN, DEVMAN_CLIENT, 0); 77 87 fibril_mutex_unlock(&devman_phone_mutex); 88 89 fibril_mutex_unlock(&devman_phone_mutex); 78 90 return devman_phone_client; 79 91 default: … … 230 242 231 243 if (flags & IPC_FLAG_BLOCKING) { 232 phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN,244 phone = async_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN, 233 245 DEVMAN_CONNECT_TO_DEVICE, handle); 234 246 } else { 235 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAN,247 phone = async_connect_me_to(PHONE_NS, SERVICE_DEVMAN, 236 248 DEVMAN_CONNECT_TO_DEVICE, handle); 237 249 } … … 245 257 246 258 if (flags & IPC_FLAG_BLOCKING) { 247 phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN,259 phone = async_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN, 248 260 DEVMAN_CONNECT_TO_PARENTS_DEVICE, handle); 249 261 } else { 250 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAN,262 phone = async_connect_me_to(PHONE_NS, SERVICE_DEVMAN, 251 263 DEVMAN_CONNECT_TO_PARENTS_DEVICE, handle); 252 264 }
Note:
See TracChangeset
for help on using the changeset viewer.