Changes in uspace/drv/infrastructure/rootmac/rootmac.c [56fd7cf:3795f9c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/infrastructure/rootmac/rootmac.c
r56fd7cf r3795f9c 44 44 #define NAME "rootmac" 45 45 46 /** Obtain function soft-state from DDF function node */ 47 #define ROOTMAC_FUN(fnode) \ 48 ((rootmac_fun_t *) (fnode)->driver_data) 49 46 50 typedef struct { 47 51 hw_resource_list_t hw_resources; … … 76 80 static ddf_dev_ops_t rootmac_fun_ops; 77 81 78 /** Obtain function soft-state from DDF function node */79 static rootmac_fun_t *rootmac_fun(ddf_fun_t *fnode)80 {81 return ddf_fun_data_get(fnode);82 }83 84 82 static bool rootmac_add_fun(ddf_dev_t *dev, const char *name, 85 const char *str_match_id, rootmac_fun_t *fun _proto)83 const char *str_match_id, rootmac_fun_t *fun) 86 84 { 87 85 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); 88 86 89 87 ddf_fun_t *fnode = NULL; 90 int rc;88 match_id_t *match_id = NULL; 91 89 92 90 /* Create new device. */ … … 95 93 goto failure; 96 94 97 rootmac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootmac_fun_t)); 98 *fun = *fun_proto; 95 fnode->driver_data = fun; 99 96 100 /* Add match ID*/101 rc = ddf_fun_add_match_id(fnode, str_match_id, 100);102 if ( rc != EOK)97 /* Initialize match id list */ 98 match_id = create_match_id(); 99 if (match_id == NULL) 103 100 goto failure; 104 101 102 match_id->id = str_match_id; 103 match_id->score = 100; 104 add_match_id(&fnode->match_ids, match_id); 105 105 106 /* Set provided operations to the device. */ 106 ddf_fun_set_ops(fnode, &rootmac_fun_ops);107 fnode->ops = &rootmac_fun_ops; 107 108 108 109 /* Register function. */ … … 115 116 116 117 failure: 118 if (match_id != NULL) 119 match_id->id = NULL; 120 117 121 if (fnode != NULL) 118 122 ddf_fun_destroy(fnode); … … 158 162 static hw_resource_list_t *rootmac_get_resources(ddf_fun_t *fnode) 159 163 { 160 rootmac_fun_t *fun = rootmac_fun(fnode);164 rootmac_fun_t *fun = ROOTMAC_FUN(fnode); 161 165 assert(fun != NULL); 162 166
Note:
See TracChangeset
for help on using the changeset viewer.