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