Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/main.c

    r4820360 r33fc3ae  
    432432       
    433433        fun_node_t *fun = create_fun_node();
    434         /* One reference for creation, one for us */
    435         fun_add_ref(fun);
    436434        fun_add_ref(fun);
    437435        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);
    444436       
    445437        if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) {
    446438                fibril_rwlock_write_unlock(&tree->rwlock);
    447439                dev_del_ref(pdev);
    448                 fun_busy_unlock(fun);
    449                 fun_del_ref(fun);
    450440                delete_fun_node(fun);
    451441                async_answer_0(callid, ENOMEM);
     
    460450        rc = online_function(fun);
    461451        if (rc != EOK) {
    462                 /* XXX Set some failed state? */
    463                 fun_busy_unlock(fun);
    464                 fun_del_ref(fun);
     452                /* XXX clean up */
    465453                async_answer_0(callid, rc);
    466454                return;
    467455        }
    468        
    469         fun_busy_unlock(fun);
    470         fun_del_ref(fun);
    471456       
    472457        /* Return device handle to parent's driver. */
     
    537522        }
    538523       
    539         fun_busy_lock(fun);
    540        
    541524        fibril_rwlock_read_lock(&device_tree.rwlock);
    542525        if (fun->dev == NULL || fun->dev->drv != drv) {
    543526                fibril_rwlock_read_unlock(&device_tree.rwlock);
    544                 fun_busy_unlock(fun);
    545527                fun_del_ref(fun);
    546528                async_answer_0(iid, ENOENT);
     
    551533        rc = online_function(fun);
    552534        if (rc != EOK) {
    553                 fun_busy_unlock(fun);
    554535                fun_del_ref(fun);
    555536                async_answer_0(iid, (sysarg_t) rc);
     
    557538        }
    558539       
    559         fun_busy_unlock(fun);
    560540        fun_del_ref(fun);
    561541       
     
    579559        }
    580560       
    581         fun_busy_lock(fun);
    582        
    583561        fibril_rwlock_write_lock(&device_tree.rwlock);
    584562        if (fun->dev == NULL || fun->dev->drv != drv) {
    585                 fun_busy_unlock(fun);
    586563                fun_del_ref(fun);
    587564                async_answer_0(iid, ENOENT);
     
    592569        rc = offline_function(fun);
    593570        if (rc != EOK) {
    594                 fun_busy_unlock(fun);
    595571                fun_del_ref(fun);
    596572                async_answer_0(iid, (sysarg_t) rc);
     
    598574        }
    599575       
    600         fun_busy_unlock(fun);
    601576        fun_del_ref(fun);
    602577        async_answer_0(iid, (sysarg_t) EOK);
     
    616591        }
    617592       
    618         fun_busy_lock(fun);
    619        
    620593        fibril_rwlock_write_lock(&tree->rwlock);
    621594       
     
    625598        if (fun->state == FUN_REMOVED) {
    626599                fibril_rwlock_write_unlock(&tree->rwlock);
    627                 fun_busy_unlock(fun);
    628                 fun_del_ref(fun);
    629600                async_answer_0(callid, ENOENT);
    630601                return;
     
    667638                                if (gone_rc == EOK)
    668639                                        gone_rc = ENOTSUP;
    669                                 fun_busy_unlock(fun);
    670                                 fun_del_ref(fun);
    671640                                async_answer_0(callid, gone_rc);
    672641                                return;
     
    695664                                    "service.");
    696665                                fibril_rwlock_write_unlock(&tree->rwlock);
    697                                 fun_busy_unlock(fun);
    698666                                fun_del_ref(fun);
    699667                                async_answer_0(callid, EIO);
     
    705673        remove_fun_node(&device_tree, fun);
    706674        fibril_rwlock_write_unlock(&tree->rwlock);
    707         fun_busy_unlock(fun);
    708675       
    709676        /* Delete ref added when inserting function into tree */
Note: See TracChangeset for help on using the changeset viewer.