Changes in uspace/srv/devman/main.c [4820360:33fc3ae] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r4820360 r33fc3ae 432 432 433 433 fun_node_t *fun = create_fun_node(); 434 /* One reference for creation, one for us */435 fun_add_ref(fun);436 434 fun_add_ref(fun); 437 435 fun->ftype = ftype; 438 439 /*440 * We can lock the function here even when holding the tree because441 * we know it cannot be held by anyone else yet.442 */443 fun_busy_lock(fun);444 436 445 437 if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) { 446 438 fibril_rwlock_write_unlock(&tree->rwlock); 447 439 dev_del_ref(pdev); 448 fun_busy_unlock(fun);449 fun_del_ref(fun);450 440 delete_fun_node(fun); 451 441 async_answer_0(callid, ENOMEM); … … 460 450 rc = online_function(fun); 461 451 if (rc != EOK) { 462 /* XXX Set some failed state? */ 463 fun_busy_unlock(fun); 464 fun_del_ref(fun); 452 /* XXX clean up */ 465 453 async_answer_0(callid, rc); 466 454 return; 467 455 } 468 469 fun_busy_unlock(fun);470 fun_del_ref(fun);471 456 472 457 /* Return device handle to parent's driver. */ … … 537 522 } 538 523 539 fun_busy_lock(fun);540 541 524 fibril_rwlock_read_lock(&device_tree.rwlock); 542 525 if (fun->dev == NULL || fun->dev->drv != drv) { 543 526 fibril_rwlock_read_unlock(&device_tree.rwlock); 544 fun_busy_unlock(fun);545 527 fun_del_ref(fun); 546 528 async_answer_0(iid, ENOENT); … … 551 533 rc = online_function(fun); 552 534 if (rc != EOK) { 553 fun_busy_unlock(fun);554 535 fun_del_ref(fun); 555 536 async_answer_0(iid, (sysarg_t) rc); … … 557 538 } 558 539 559 fun_busy_unlock(fun);560 540 fun_del_ref(fun); 561 541 … … 579 559 } 580 560 581 fun_busy_lock(fun);582 583 561 fibril_rwlock_write_lock(&device_tree.rwlock); 584 562 if (fun->dev == NULL || fun->dev->drv != drv) { 585 fun_busy_unlock(fun);586 563 fun_del_ref(fun); 587 564 async_answer_0(iid, ENOENT); … … 592 569 rc = offline_function(fun); 593 570 if (rc != EOK) { 594 fun_busy_unlock(fun);595 571 fun_del_ref(fun); 596 572 async_answer_0(iid, (sysarg_t) rc); … … 598 574 } 599 575 600 fun_busy_unlock(fun);601 576 fun_del_ref(fun); 602 577 async_answer_0(iid, (sysarg_t) EOK); … … 616 591 } 617 592 618 fun_busy_lock(fun);619 620 593 fibril_rwlock_write_lock(&tree->rwlock); 621 594 … … 625 598 if (fun->state == FUN_REMOVED) { 626 599 fibril_rwlock_write_unlock(&tree->rwlock); 627 fun_busy_unlock(fun);628 fun_del_ref(fun);629 600 async_answer_0(callid, ENOENT); 630 601 return; … … 667 638 if (gone_rc == EOK) 668 639 gone_rc = ENOTSUP; 669 fun_busy_unlock(fun);670 fun_del_ref(fun);671 640 async_answer_0(callid, gone_rc); 672 641 return; … … 695 664 "service."); 696 665 fibril_rwlock_write_unlock(&tree->rwlock); 697 fun_busy_unlock(fun);698 666 fun_del_ref(fun); 699 667 async_answer_0(callid, EIO); … … 705 673 remove_fun_node(&device_tree, fun); 706 674 fibril_rwlock_write_unlock(&tree->rwlock); 707 fun_busy_unlock(fun);708 675 709 676 /* Delete ref added when inserting function into tree */
Note:
See TracChangeset
for help on using the changeset viewer.