Changeset 659ca07 in mainline for uspace/drv/root/root.c


Ignore:
Timestamp:
2011-02-14T22:22:54Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
34588a80
Parents:
cd0684d
Message:

Remove register_function_wrapper() (this time for real).

File:
1 edited

Legend:

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

    rcd0684d r659ca07  
    4545#include <stdlib.h>
    4646#include <str.h>
     47#include <str_error.h>
    4748#include <ctype.h>
    4849#include <macros.h>
     
    8485static int add_virtual_root_fun(device_t *dev)
    8586{
     87        const char *name = VIRTUAL_FUN_NAME;
     88        function_t *fun;
     89        int rc;
     90
    8691        printf(NAME ": adding new function for virtual devices.\n");
    87         printf(NAME ":   function node is `%s' (%d %s)\n", VIRTUAL_FUN_NAME,
     92        printf(NAME ":   function node is `%s' (%d %s)\n", name,
    8893            VIRTUAL_FUN_MATCH_SCORE, VIRTUAL_FUN_MATCH_ID);
    8994
    90         int res = register_function_wrapper(dev, VIRTUAL_FUN_NAME,
    91             VIRTUAL_FUN_MATCH_ID, VIRTUAL_FUN_MATCH_SCORE);
    92 
    93         return res;
     95        fun = ddf_fun_create(dev, fun_inner, name);
     96        if (fun == NULL) {
     97                printf(NAME ": error creating function %s\n", name);
     98                return ENOMEM;
     99        }
     100
     101        rc = ddf_fun_add_match_id(fun, VIRTUAL_FUN_MATCH_ID,
     102            VIRTUAL_FUN_MATCH_SCORE);
     103        if (rc != EOK) {
     104                printf(NAME ": error adding match IDs to function %s\n", name);
     105                ddf_fun_destroy(fun);
     106                return rc;
     107        }
     108
     109        rc = ddf_fun_bind(fun);
     110        if (rc != EOK) {
     111                printf(NAME ": error binding function %s: %s\n", name,
     112                    str_error(rc));
     113                ddf_fun_destroy(fun);
     114                return rc;
     115        }
     116
     117        return EOK;
    94118}
    95119
     
    104128        char *platform;
    105129        size_t platform_size;
    106         int res;
     130
     131        const char *name = PLATFORM_FUN_NAME;
     132        function_t *fun;
     133        int rc;
    107134
    108135        /* Get platform name from sysinfo. */
     
    133160            PLATFORM_FUN_MATCH_SCORE, match_id);
    134161
    135         res = register_function_wrapper(dev, PLATFORM_FUN_NAME,
    136             match_id, PLATFORM_FUN_MATCH_SCORE);
    137 
    138         return res;
     162        fun = ddf_fun_create(dev, fun_inner, name);
     163        if (fun == NULL) {
     164                printf(NAME ": error creating function %s\n", name);
     165                return ENOMEM;
     166        }
     167
     168        rc = ddf_fun_add_match_id(fun, match_id, PLATFORM_FUN_MATCH_SCORE);
     169        if (rc != EOK) {
     170                printf(NAME ": error adding match IDs to function %s\n", name);
     171                ddf_fun_destroy(fun);
     172                return rc;
     173        }
     174
     175        rc = ddf_fun_bind(fun);
     176        if (rc != EOK) {
     177                printf(NAME ": error binding function %s: %s\n", name,
     178                    str_error(rc));
     179                ddf_fun_destroy(fun);
     180                return rc;
     181        }
     182
     183        return EOK;
    139184}
    140185
Note: See TracChangeset for help on using the changeset viewer.