Changeset bf1fb9f in mainline
- Timestamp:
- 2009-06-03T18:45:53Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bbdbf86
- Parents:
- 40313e4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/sysipc.c
r40313e4 rbf1fb9f 337 337 } 338 338 339 static void phones_lock(phone_t *p1, phone_t *p2) 340 { 341 if (p1 < p2) { 342 mutex_lock(&p1->lock); 343 mutex_lock(&p2->lock); 344 } else if (p1 > p2) { 345 mutex_lock(&p2->lock); 346 mutex_lock(&p1->lock); 347 } else { 348 mutex_lock(&p1->lock); 349 } 350 } 351 352 static void phones_unlock(phone_t *p1, phone_t *p2) 353 { 354 mutex_unlock(&p1->lock); 355 if (p1 != p2) 356 mutex_unlock(&p2->lock); 357 } 358 339 359 /** Called before the request is sent. 340 360 * … … 356 376 GET_CHECK_PHONE(cloned_phone, IPC_GET_ARG1(call->data), 357 377 return ENOENT); 358 if (cloned_phone < phone) { 359 mutex_lock(&cloned_phone->lock); 360 mutex_lock(&phone->lock); 361 } else if (cloned_phone > phone) { 362 mutex_lock(&phone->lock); 363 mutex_lock(&cloned_phone->lock); 364 } else { 365 mutex_lock(&phone->lock); 366 } 378 phones_lock(cloned_phone, phone); 367 379 if ((cloned_phone->state != IPC_PHONE_CONNECTED) || 368 380 phone->state != IPC_PHONE_CONNECTED) { 369 if (cloned_phone != phone) 370 mutex_unlock(&cloned_phone->lock); 371 mutex_unlock(&phone->lock); 381 phones_unlock(cloned_phone, phone); 372 382 return EINVAL; 373 383 } … … 380 390 newphid = phone_alloc(phone->callee->task); 381 391 if (newphid < 0) { 382 if (cloned_phone != phone) 383 mutex_unlock(&cloned_phone->lock); 384 mutex_unlock(&phone->lock); 392 phones_unlock(cloned_phone, phone); 385 393 return ELIMIT; 386 394 } 387 395 ipc_phone_connect(&phone->callee->task->phones[newphid], 388 396 cloned_phone->callee); 389 if (cloned_phone != phone) 390 mutex_unlock(&cloned_phone->lock); 391 mutex_unlock(&phone->lock); 397 phones_unlock(cloned_phone, phone); 392 398 /* Set the new phone for the callee. */ 393 399 IPC_SET_ARG1(call->data, newphid);
Note:
See TracChangeset
for help on using the changeset viewer.