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