Changeset 97a62fe in mainline for uspace/drv/isa/isa.c


Ignore:
Timestamp:
2011-02-14T21:41:50Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cd0684d
Parents:
7df0477e
Message:

Refactor create_function(), delete_function() and register_function() into
ddf_fun_create(), ddf_fun_destroy() and ddf_fun_bind(). This is not just
a rename.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/isa/isa.c

    r7df0477e r97a62fe  
    106106};
    107107
    108 static isa_fun_t *isa_fun_create()
     108static isa_fun_t *isa_fun_create(device_t *dev, const char *name)
    109109{
    110110        isa_fun_t *fun = calloc(1, sizeof(isa_fun_t));
     
    112112                return NULL;
    113113
    114         function_t *fnode = create_function();
     114        function_t *fnode = ddf_fun_create(dev, fun_inner, name);
    115115        if (fnode == NULL) {
    116116                free(fun);
     
    417417                return NULL;
    418418
    419         isa_fun_t *fun = isa_fun_create();
     419        isa_fun_t *fun = isa_fun_create(dev, fun_name);
    420420        if (fun == NULL) {
    421421                free(fun_name);
    422422                return NULL;
    423423        }
    424 
    425         function_t *fnode = fun->fnode;
    426         fnode->name = fun_name;
    427         fnode->ftype = fun_inner;
    428424
    429425        /* Allocate buffer for the list of hardware resources of the device. */
     
    447443
    448444        /* Set device operations to the device. */
    449         fnode->ops = &isa_fun_ops;
    450 
    451         printf(NAME ": register_function(fun, dev); function is %s.\n",
    452             fnode->name);
    453         register_function(fnode, dev);
     445        fun->fnode->ops = &isa_fun_ops;
     446
     447        printf(NAME ": Binding function %s.\n", fun->fnode->name);
     448
     449        /* XXX Handle error */
     450        (void) ddf_fun_bind(fun->fnode);
    454451
    455452        return fun_conf;
     
    482479        printf(NAME ": adding a 'ctl' function\n");
    483480
    484         function_t *ctl = create_function();
    485         ctl->ftype = fun_exposed;
    486         ctl->name = "ctl";
    487         register_function(ctl, dev);
     481        function_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl");
     482        if (ctl == NULL) {
     483                printf(NAME ": Error creating control function.\n");
     484                return EXDEV;
     485        }
     486
     487        if (ddf_fun_bind(ctl) != EOK) {
     488                printf(NAME ": Error binding control function.\n");
     489                return EXDEV;
     490        }
    488491
    489492        /* Add functions as specified in the configuration file. */
Note: See TracChangeset for help on using the changeset viewer.