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