Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    rb72efe8 r45059d6b  
    314314                    " %" PRIun " was found.\n", driver->name, handle);
    315315                async_answer_0(iid, ENOENT);
     316                return;
     317        }
     318       
     319        if (fun->conn_handler != NULL) {
     320                /* Driver has a custom connection handler. */
     321                (*fun->conn_handler)(iid, icall, (void *)fun);
    316322                return;
    317323        }
     
    422428static void driver_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    423429{
     430        sysarg_t conn_type;
     431
     432        if (iid == 0) {
     433                /* Callback connection from devman */
     434                /* XXX Use separate handler for this type of connection */
     435                conn_type = DRIVER_DEVMAN;
     436        } else {
     437                conn_type = IPC_GET_ARG1(*icall);
     438        }
     439
    424440        /* Select interface */
    425         switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
     441        switch (conn_type) {
    426442        case DRIVER_DEVMAN:
    427443                /* Handle request from device manager */
     
    576592int ddf_fun_bind(ddf_fun_t *fun)
    577593{
     594        assert(fun->bound == false);
    578595        assert(fun->name != NULL);
    579596       
     
    592609}
    593610
     611/** Unbind a function node.
     612 *
     613 * Unbind the specified function from the system. This effectively makes
     614 * the function invisible to the system.
     615 *
     616 * @param fun           Function to bind
     617 * @return              EOK on success or negative error code
     618 */
     619int ddf_fun_unbind(ddf_fun_t *fun)
     620{
     621        int res;
     622       
     623        assert(fun->bound == true);
     624       
     625        add_to_functions_list(fun);
     626        res = devman_remove_function(fun->handle);
     627        if (res != EOK)
     628                return res;
     629
     630        remove_from_functions_list(fun);
     631       
     632        fun->bound = false;
     633        return EOK;
     634}
     635
    594636/** Add single match ID to inner function.
    595637 *
     
    614656                return ENOMEM;
    615657       
    616         match_id->id = match_id_str;
     658        match_id->id = str_dup(match_id_str);
    617659        match_id->score = 90;
    618660       
     
    629671}
    630672
    631 /** Add exposed function to class.
     673/** Add exposed function to category.
    632674 *
    633675 * Must only be called when the function is bound.
    634676 */
    635 int ddf_fun_add_to_class(ddf_fun_t *fun, const char *class_name)
     677int ddf_fun_add_to_category(ddf_fun_t *fun, const char *cat_name)
    636678{
    637679        assert(fun->bound == true);
    638680        assert(fun->ftype == fun_exposed);
    639681       
    640         return devman_add_device_to_class(fun->handle, class_name);
     682        return devman_add_device_to_category(fun->handle, cat_name);
    641683}
    642684
Note: See TracChangeset for help on using the changeset viewer.