Changeset cd0684d in mainline for uspace/drv/test1/test1.c
- Timestamp:
- 2011-02-14T22:14:52Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 659ca07
- Parents:
- 97a62fe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/test1/test1.c
r97a62fe rcd0684d 55 55 * @param score Device match score. 56 56 */ 57 static voidregister_fun_verbose(device_t *parent, const char *message,57 static int register_fun_verbose(device_t *parent, const char *message, 58 58 const char *name, const char *match_id, int match_score) 59 59 { 60 printf(NAME ": registering child device `%s': %s.\n",61 name, message);60 function_t *fun; 61 int rc; 62 62 63 int rc = register_function_wrapper(parent, name, 64 match_id, match_score); 63 printf(NAME ": registering function `%s': %s.\n", name, message); 65 64 66 if (rc == EOK) { 67 printf(NAME ": registered function `%s'.\n", name); 68 } else { 69 printf(NAME ": failed to register function `%s' (%s).\n", 70 name, str_error(rc)); 65 fun = ddf_fun_create(parent, fun_inner, name); 66 if (fun == NULL) { 67 printf(NAME ": error creating function %s\n", name); 68 return ENOMEM; 71 69 } 70 71 rc = ddf_fun_add_match_id(fun, match_id, match_score); 72 if (rc != EOK) { 73 printf(NAME ": error adding match IDs to function %s\n", name); 74 ddf_fun_destroy(fun); 75 return rc; 76 } 77 78 rc = ddf_fun_bind(fun); 79 if (rc != EOK) { 80 printf(NAME ": error binding function %s: %s\n", name, 81 str_error(rc)); 82 ddf_fun_destroy(fun); 83 return rc; 84 } 85 86 printf(NAME ": registered child device `%s'\n", name); 87 return EOK; 72 88 } 73 89 … … 115 131 add_function_to_class(fun_a, "virt-null"); 116 132 } else if (str_cmp(dev->name, "test1") == 0) { 117 register_fun_verbose(dev, "cloning myself ;-)", "clone",133 (void) register_fun_verbose(dev, "cloning myself ;-)", "clone", 118 134 "virtual&test1", 10); 119 135 } else if (str_cmp(dev->name, "clone") == 0) { 120 register_fun_verbose(dev, "run by the same task", "child",136 (void) register_fun_verbose(dev, "run by the same task", "child", 121 137 "virtual&test1&child", 10); 122 138 }
Note:
See TracChangeset
for help on using the changeset viewer.