Changes in uspace/lib/usbdev/src/pipepriv.c [79ae36dd:160b75e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipepriv.c
r79ae36dd r160b75e 44 44 void pipe_start_transaction(usb_pipe_t *pipe) 45 45 { 46 fibril_mutex_lock(&pipe->hc_ sess_mutex);46 fibril_mutex_lock(&pipe->hc_phone_mutex); 47 47 } 48 48 … … 53 53 void pipe_end_transaction(usb_pipe_t *pipe) 54 54 { 55 fibril_mutex_unlock(&pipe->hc_ sess_mutex);55 fibril_mutex_unlock(&pipe->hc_phone_mutex); 56 56 } 57 57 … … 85 85 { 86 86 pipe_acquire(pipe); 87 87 88 88 if (pipe->refcount == 0) { 89 89 /* Need to open the phone by ourselves. */ 90 async_sess_t *sess = 91 devman_device_connect(EXCHANGE_SERIALIZE, pipe->wire->hc_handle, 0); 92 if (!sess) { 90 int phone = devman_device_connect(pipe->wire->hc_handle, 0); 91 if (phone < 0) { 93 92 if (hide_failure) { 94 93 pipe->refcount_soft++; 95 pipe_release(pipe); 96 return EOK; 94 phone = EOK; 97 95 } 98 99 96 pipe_release(pipe); 100 return ENOMEM;97 return phone; 101 98 } 102 103 99 /* 104 100 * No locking is needed, refcount is zero and whole pipe 105 101 * mutex is locked. 106 102 */ 107 108 pipe->hc_sess = sess; 103 pipe->hc_phone = phone; 109 104 } 110 111 105 pipe->refcount++; 106 112 107 pipe_release(pipe); 113 108 114 109 return EOK; 115 110 } … … 122 117 { 123 118 pipe_acquire(pipe); 124 125 119 if (pipe->refcount_soft > 0) { 126 120 pipe->refcount_soft--; … … 128 122 return; 129 123 } 130 131 124 assert(pipe->refcount > 0); 132 133 125 pipe->refcount--; 134 135 126 if (pipe->refcount == 0) { 136 127 /* We were the last users, let's hang-up. */ 137 async_hangup(pipe->hc_ sess);138 pipe->hc_ sess = NULL;128 async_hangup(pipe->hc_phone); 129 pipe->hc_phone = -1; 139 130 } 140 141 131 pipe_release(pipe); 142 132 }
Note:
See TracChangeset
for help on using the changeset viewer.