Ignore:
Timestamp:
2012-08-21T10:04:16Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
67edca6
Parents:
0da6c04 (diff), 6a97f2e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with upstream (lp:~wtachi/helenos/bithenge)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/infrastructure/rootmac/rootmac.c

    r0da6c04 r5e718d9  
    4444#define NAME  "rootmac"
    4545
    46 /** Obtain function soft-state from DDF function node */
    47 #define ROOTMAC_FUN(fnode) \
    48         ((rootmac_fun_t *) (fnode)->driver_data)
    49 
    5046typedef struct {
    5147        hw_resource_list_t hw_resources;
     
    8076static ddf_dev_ops_t rootmac_fun_ops;
    8177
     78/** Obtain function soft-state from DDF function node */
     79static rootmac_fun_t *rootmac_fun(ddf_fun_t *fnode)
     80{
     81        return ddf_fun_data_get(fnode);
     82}
     83
    8284static bool rootmac_add_fun(ddf_dev_t *dev, const char *name,
    83     const char *str_match_id, rootmac_fun_t *fun)
     85    const char *str_match_id, rootmac_fun_t *fun_proto)
    8486{
    8587        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
    8688       
    8789        ddf_fun_t *fnode = NULL;
    88         match_id_t *match_id = NULL;
     90        int rc;
    8991       
    9092        /* Create new device. */
     
    9395                goto failure;
    9496       
    95         fnode->driver_data = fun;
     97        rootmac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootmac_fun_t));
     98        *fun = *fun_proto;
    9699       
    97         /* Initialize match id list */
    98         match_id = create_match_id();
    99         if (match_id == NULL)
     100        /* Add match ID */
     101        rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
     102        if (rc != EOK)
    100103                goto failure;
    101104       
    102         match_id->id = str_match_id;
    103         match_id->score = 100;
    104         add_match_id(&fnode->match_ids, match_id);
    105        
    106105        /* Set provided operations to the device. */
    107         fnode->ops = &rootmac_fun_ops;
     106        ddf_fun_set_ops(fnode, &rootmac_fun_ops);
    108107       
    109108        /* Register function. */
     
    116115       
    117116failure:
    118         if (match_id != NULL)
    119                 match_id->id = NULL;
    120        
    121117        if (fnode != NULL)
    122118                ddf_fun_destroy(fnode);
     
    162158static hw_resource_list_t *rootmac_get_resources(ddf_fun_t *fnode)
    163159{
    164         rootmac_fun_t *fun = ROOTMAC_FUN(fnode);
     160        rootmac_fun_t *fun = rootmac_fun(fnode);
    165161        assert(fun != NULL);
    166162       
Note: See TracChangeset for help on using the changeset viewer.