Changes in uspace/lib/c/generic/devman.c [8983273:64d2b10] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/devman.c
r8983273 r64d2b10 28 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 29 */ 30 31 30 31 /** @addtogroup libc 32 32 * @{ 33 33 */ … … 37 37 #include <str.h> 38 38 #include <stdio.h> 39 #include <ipc/ipc.h>40 39 #include <ipc/services.h> 41 40 #include <ipc/devman.h> 42 41 #include <devman.h> 43 42 #include <async.h> 43 #include <fibril_synch.h> 44 44 #include <errno.h> 45 45 #include <malloc.h> … … 50 50 static int devman_phone_client = -1; 51 51 52 static FIBRIL_MUTEX_INITIALIZE(devman_phone_mutex); 53 52 54 int devman_get_phone(devman_interface_t iface, unsigned int flags) 53 55 { 54 56 switch (iface) { 55 57 case DEVMAN_DRIVER: 56 if (devman_phone_driver >= 0) 58 fibril_mutex_lock(&devman_phone_mutex); 59 if (devman_phone_driver >= 0) { 60 fibril_mutex_unlock(&devman_phone_mutex); 57 61 return devman_phone_driver; 62 } 58 63 59 64 if (flags & IPC_FLAG_BLOCKING) … … 64 69 SERVICE_DEVMAN, DEVMAN_DRIVER, 0); 65 70 71 fibril_mutex_unlock(&devman_phone_mutex); 66 72 return devman_phone_driver; 67 73 case DEVMAN_CLIENT: 68 if (devman_phone_client >= 0) 74 fibril_mutex_lock(&devman_phone_mutex); 75 if (devman_phone_client >= 0) { 76 fibril_mutex_unlock(&devman_phone_mutex); 69 77 return devman_phone_client; 70 71 if (flags & IPC_FLAG_BLOCKING) 78 } 79 80 if (flags & IPC_FLAG_BLOCKING) { 72 81 devman_phone_client = async_connect_me_to_blocking( 73 82 PHONE_NS, SERVICE_DEVMAN, DEVMAN_CLIENT, 0); 74 else83 } else { 75 84 devman_phone_client = async_connect_me_to(PHONE_NS, 76 85 SERVICE_DEVMAN, DEVMAN_CLIENT, 0); 77 86 } 87 88 fibril_mutex_unlock(&devman_phone_mutex); 78 89 return devman_phone_client; 79 90 default: … … 104 115 async_set_client_connection(conn); 105 116 106 sysarg_t callback_phonehash; 107 ipc_connect_to_me(phone, 0, 0, 0, &callback_phonehash); 117 async_connect_to_me(phone, 0, 0, 0, NULL); 108 118 async_wait_for(req, &retval); 109 119 … … 210 220 case DEVMAN_DRIVER: 211 221 if (devman_phone_driver >= 0) { 212 ipc_hangup(devman_phone_driver);222 async_hangup(devman_phone_driver); 213 223 devman_phone_driver = -1; 214 224 } … … 216 226 case DEVMAN_CLIENT: 217 227 if (devman_phone_client >= 0) { 218 ipc_hangup(devman_phone_client);228 async_hangup(devman_phone_client); 219 229 devman_phone_client = -1; 220 230 }
Note:
See TracChangeset
for help on using the changeset viewer.