Changeset fc51296 in mainline for uspace/drv/root/root.c
- Timestamp:
- 2011-03-31T17:37:25Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3acb285a
- Parents:
- 9b415c9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/root/root.c
r9b415c9 rfc51296 52 52 53 53 #include <ddf/driver.h> 54 #include <ddf/log.h> 54 55 #include <devman.h> 55 56 #include <ipc/devman.h> … … 89 90 int rc; 90 91 91 printf(NAME ": adding new function for virtual devices.\n");92 printf(NAME ": function node is `%s' (%d %s)\n", name,92 ddf_msg(LVL_DEBUG, "Adding new function for virtual devices. " 93 "Function node is `%s' (%d %s)\n", name, 93 94 VIRTUAL_FUN_MATCH_SCORE, VIRTUAL_FUN_MATCH_ID); 94 95 95 96 fun = ddf_fun_create(dev, fun_inner, name); 96 97 if (fun == NULL) { 97 printf(NAME ": errorcreating function %s\n", name);98 ddf_msg(LVL_ERROR, "Failed creating function %s\n", name); 98 99 return ENOMEM; 99 100 } … … 102 103 VIRTUAL_FUN_MATCH_SCORE); 103 104 if (rc != EOK) { 104 printf(NAME ": erroradding match IDs to function %s\n", name);105 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s\n", name); 105 106 ddf_fun_destroy(fun); 106 107 return rc; … … 109 110 rc = ddf_fun_bind(fun); 110 111 if (rc != EOK) { 111 printf(NAME ": errorbinding function %s: %s\n", name,112 ddf_msg(LVL_ERROR, "Failed binding function %s: %s\n", name, 112 113 str_error(rc)); 113 114 ddf_fun_destroy(fun); … … 136 137 platform = sysinfo_get_data("platform", &platform_size); 137 138 if (platform == NULL) { 138 printf(NAME ":Failed to obtain platform name.\n");139 ddf_msg(LVL_ERROR, "Failed to obtain platform name.\n"); 139 140 return ENOENT; 140 141 } … … 143 144 platform = realloc(platform, platform_size + 1); 144 145 if (platform == NULL) { 145 printf(NAME ":Memory allocation failed.\n");146 ddf_msg(LVL_ERROR, "Memory allocation failed.\n"); 146 147 return ENOMEM; 147 148 } … … 151 152 /* Construct match ID. */ 152 153 if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) { 153 printf(NAME ":Memory allocation failed.\n");154 ddf_msg(LVL_ERROR, "Memory allocation failed.\n"); 154 155 return ENOMEM; 155 156 } 156 157 157 158 /* Add function. */ 158 printf(NAME ": adding platform function\n");159 printf(NAME ": function node is `%s' (%d %s)\n", PLATFORM_FUN_NAME,160 PLATFORM_FUN_MATCH_SCORE,match_id);159 ddf_msg(LVL_DEBUG, "Adding platform function. Function node is `%s' " 160 " (%d %s)\n", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE, 161 match_id); 161 162 162 163 fun = ddf_fun_create(dev, fun_inner, name); 163 164 if (fun == NULL) { 164 printf(NAME ": error creating function %s\n", name);165 ddf_msg(LVL_ERROR, "Error creating function %s\n", name); 165 166 return ENOMEM; 166 167 } … … 168 169 rc = ddf_fun_add_match_id(fun, match_id, PLATFORM_FUN_MATCH_SCORE); 169 170 if (rc != EOK) { 170 printf(NAME ": error adding match IDs to function %s\n", name); 171 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s\n", 172 name); 171 173 ddf_fun_destroy(fun); 172 174 return rc; … … 175 177 rc = ddf_fun_bind(fun); 176 178 if (rc != EOK) { 177 printf(NAME ": errorbinding function %s: %s\n", name,179 ddf_msg(LVL_ERROR, "Failed binding function %s: %s\n", name, 178 180 str_error(rc)); 179 181 ddf_fun_destroy(fun); … … 191 193 static int root_add_device(ddf_dev_t *dev) 192 194 { 193 printf(NAME ":root_add_device, device handle=%" PRIun "\n",195 ddf_msg(LVL_DEBUG, "root_add_device, device handle=%" PRIun "\n", 194 196 dev->handle); 195 197 … … 204 206 int res = add_platform_fun(dev); 205 207 if (EOK != res) 206 printf(NAME ": failed to addchild device for platform.\n");208 ddf_msg(LVL_ERROR, "Failed adding child device for platform.\n"); 207 209 208 210 return res; … … 212 214 { 213 215 printf(NAME ": HelenOS root device driver\n"); 216 217 ddf_log_init(NAME, LVL_ERROR); 214 218 return ddf_driver_main(&root_driver); 215 219 }
Note:
See TracChangeset
for help on using the changeset viewer.