Changes in uspace/drv/test/test1/test1.c [0c0f823b:267f235] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/test/test1/test1.c
r0c0f823b r267f235 145 145 ddf_fun_t *fun_a; 146 146 test1_t *test1; 147 int rc; 148 147 const char *dev_name; 148 int rc; 149 150 dev_name = ddf_dev_get_name(dev); 149 151 ddf_msg(LVL_DEBUG, "dev_add(name=\"%s\", handle=%d)", 150 dev ->name, (int) dev->handle);152 dev_name, (int) ddf_dev_get_handle(dev)); 151 153 152 154 test1 = ddf_dev_data_alloc(dev, sizeof(test1_t)); 153 155 if (test1 == NULL) { 154 156 ddf_msg(LVL_ERROR, "Failed allocating soft state.\n"); 155 return ENOMEM; 157 rc = ENOMEM; 158 goto error; 156 159 } 157 160 … … 159 162 if (fun_a == NULL) { 160 163 ddf_msg(LVL_ERROR, "Failed creating function 'a'."); 161 return ENOMEM; 164 rc = ENOMEM; 165 goto error; 162 166 } 163 167 … … 168 172 ddf_msg(LVL_ERROR, "Failed binding function 'a'."); 169 173 ddf_fun_destroy(fun_a); 170 return rc;174 goto error; 171 175 } 172 176 173 177 ddf_fun_add_to_category(fun_a, "virtual"); 174 178 175 if (str_cmp(dev ->name, "null") == 0) {176 fun_a->ops = &char_device_ops;179 if (str_cmp(dev_name, "null") == 0) { 180 ddf_fun_set_ops(fun_a, &char_device_ops); 177 181 ddf_fun_add_to_category(fun_a, "virt-null"); 178 } else if (str_cmp(dev ->name, "test1") == 0) {182 } else if (str_cmp(dev_name, "test1") == 0) { 179 183 (void) register_fun_verbose(dev, 180 184 "cloning myself ;-)", "clone", … … 183 187 "cloning myself twice ;-)", "clone", 184 188 "virtual&test1", 10, EEXISTS, NULL); 185 } else if (str_cmp(dev ->name, "clone") == 0) {189 } else if (str_cmp(dev_name, "clone") == 0) { 186 190 (void) register_fun_verbose(dev, 187 191 "run by the same task", "child", … … 189 193 } 190 194 191 ddf_msg(LVL_DEBUG, "Device `%s' accepted.", dev->name); 192 193 return EOK; 195 ddf_msg(LVL_DEBUG, "Device `%s' accepted.", dev_name); 196 return EOK; 197 error: 198 return rc; 194 199 } 195 200 … … 232 237 static int test1_dev_remove(ddf_dev_t *dev) 233 238 { 234 test1_t *test1 = (test1_t *)d ev->driver_data;239 test1_t *test1 = (test1_t *)ddf_dev_data_get(dev); 235 240 int rc; 236 241 … … 260 265 static int test1_dev_gone(ddf_dev_t *dev) 261 266 { 262 test1_t *test1 = (test1_t *)d ev->driver_data;267 test1_t *test1 = (test1_t *)ddf_dev_data_get(dev); 263 268 int rc; 264 269 … … 301 306 { 302 307 printf(NAME ": HelenOS test1 virtual device driver\n"); 303 ddf_log_init(NAME , LVL_ERROR);308 ddf_log_init(NAME); 304 309 return ddf_driver_main(&test1_driver); 305 310 }
Note:
See TracChangeset
for help on using the changeset viewer.