Changes in uspace/drv/root/root.c [af6b5157:ebcb05a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/root/root.c
raf6b5157 rebcb05a 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)", 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 ": error creating function %s\n", name);98 ddf_msg(LVL_ERROR, "Failed creating function %s", name); 98 99 return ENOMEM; 99 100 } … … 102 103 VIRTUAL_FUN_MATCH_SCORE); 103 104 if (rc != EOK) { 104 printf(NAME ": error adding match IDs to function %s\n", name); 105 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", 106 name); 105 107 ddf_fun_destroy(fun); 106 108 return rc; … … 109 111 rc = ddf_fun_bind(fun); 110 112 if (rc != EOK) { 111 printf(NAME ": error binding function %s: %s\n", name,113 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name, 112 114 str_error(rc)); 113 115 ddf_fun_destroy(fun); … … 136 138 platform = sysinfo_get_data("platform", &platform_size); 137 139 if (platform == NULL) { 138 printf(NAME ": Failed to obtain platform name.\n");140 ddf_msg(LVL_ERROR, "Failed to obtain platform name."); 139 141 return ENOENT; 140 142 } … … 143 145 platform = realloc(platform, platform_size + 1); 144 146 if (platform == NULL) { 145 printf(NAME ": Memory allocation failed.\n");147 ddf_msg(LVL_ERROR, "Memory allocation failed."); 146 148 return ENOMEM; 147 149 } … … 151 153 /* Construct match ID. */ 152 154 if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) { 153 printf(NAME ": Memory allocation failed.\n");155 ddf_msg(LVL_ERROR, "Memory allocation failed."); 154 156 return ENOMEM; 155 157 } 156 158 157 159 /* 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);160 ddf_msg(LVL_DEBUG, "Adding platform function. Function node is `%s' " 161 " (%d %s)", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE, 162 match_id); 161 163 162 164 fun = ddf_fun_create(dev, fun_inner, name); 163 165 if (fun == NULL) { 164 printf(NAME ": error creating function %s\n", name);166 ddf_msg(LVL_ERROR, "Error creating function %s", name); 165 167 return ENOMEM; 166 168 } … … 168 170 rc = ddf_fun_add_match_id(fun, match_id, PLATFORM_FUN_MATCH_SCORE); 169 171 if (rc != EOK) { 170 printf(NAME ": error adding match IDs to function %s\n", name); 172 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", 173 name); 171 174 ddf_fun_destroy(fun); 172 175 return rc; … … 175 178 rc = ddf_fun_bind(fun); 176 179 if (rc != EOK) { 177 printf(NAME ": error binding function %s: %s\n", name,180 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name, 178 181 str_error(rc)); 179 182 ddf_fun_destroy(fun); … … 191 194 static int root_add_device(ddf_dev_t *dev) 192 195 { 193 printf(NAME ": root_add_device, device handle=%" PRIun "\n",196 ddf_msg(LVL_DEBUG, "root_add_device, device handle=%" PRIun, 194 197 dev->handle); 195 198 … … 204 207 int res = add_platform_fun(dev); 205 208 if (EOK != res) 206 printf(NAME ": failed to add child device for platform.\n");209 ddf_msg(LVL_ERROR, "Failed adding child device for platform."); 207 210 208 211 return res; … … 212 215 { 213 216 printf(NAME ": HelenOS root device driver\n"); 217 218 ddf_log_init(NAME, LVL_ERROR); 214 219 return ddf_driver_main(&root_driver); 215 220 }
Note:
See TracChangeset
for help on using the changeset viewer.