Rev 3343 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3343 | Rev 3397 | ||
---|---|---|---|
Line 168... | Line 168... | ||
168 | int phone_alloc(void) |
168 | int phone_alloc(void) |
169 | { |
169 | { |
170 | int i; |
170 | int i; |
171 | 171 | ||
172 | spinlock_lock(&TASK->lock); |
172 | spinlock_lock(&TASK->lock); |
173 | - | ||
174 | for (i = 0; i < IPC_MAX_PHONES; i++) { |
173 | for (i = 0; i < IPC_MAX_PHONES; i++) { |
175 | if (TASK->phones[i].state == IPC_PHONE_HUNGUP && |
174 | if (TASK->phones[i].state == IPC_PHONE_HUNGUP && |
176 | atomic_get(&TASK->phones[i].active_calls) == 0) |
175 | atomic_get(&TASK->phones[i].active_calls) == 0) |
177 | TASK->phones[i].state = IPC_PHONE_FREE; |
176 | TASK->phones[i].state = IPC_PHONE_FREE; |
178 | 177 | ||
Line 181... | Line 180... | ||
181 | break; |
180 | break; |
182 | } |
181 | } |
183 | } |
182 | } |
184 | spinlock_unlock(&TASK->lock); |
183 | spinlock_unlock(&TASK->lock); |
185 | 184 | ||
186 | if (i >= IPC_MAX_PHONES) |
185 | if (i == IPC_MAX_PHONES) |
187 | return -1; |
186 | return -1; |
- | 187 | ||
188 | return i; |
188 | return i; |
189 | } |
189 | } |
190 | 190 | ||
191 | /** Mark a phone structure free. |
191 | /** Mark a phone structure free. |
192 | * |
192 | * |