Changeset 659ca07 in mainline for uspace/drv/root/root.c
- Timestamp:
- 2011-02-14T22:22:54Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 34588a80
- Parents:
- cd0684d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/root/root.c
rcd0684d r659ca07 45 45 #include <stdlib.h> 46 46 #include <str.h> 47 #include <str_error.h> 47 48 #include <ctype.h> 48 49 #include <macros.h> … … 84 85 static int add_virtual_root_fun(device_t *dev) 85 86 { 87 const char *name = VIRTUAL_FUN_NAME; 88 function_t *fun; 89 int rc; 90 86 91 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, 88 93 VIRTUAL_FUN_MATCH_SCORE, VIRTUAL_FUN_MATCH_ID); 89 94 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; 94 118 } 95 119 … … 104 128 char *platform; 105 129 size_t platform_size; 106 int res; 130 131 const char *name = PLATFORM_FUN_NAME; 132 function_t *fun; 133 int rc; 107 134 108 135 /* Get platform name from sysinfo. */ … … 133 160 PLATFORM_FUN_MATCH_SCORE, match_id); 134 161 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; 139 184 } 140 185
Note:
See TracChangeset
for help on using the changeset viewer.