Changeset 2be2506a in mainline


Ignore:
Timestamp:
2012-08-31T17:32:38Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0cf5246
Parents:
96e01fbc
Message:

amdm37x: Fix compile breakage.

File:
1 edited

Legend:

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

    r96e01fbc r2be2506a  
    3535/** @file
    3636 */
     37#define _DDF_DATA_IMPLANT
    3738
    3839#include <ddf/driver.h>
     
    4950
    5051#define NAME  "rootamdm37x"
    51 
    52 /** Obtain function soft-state from DDF function node */
    53 #define ROOTARM_FUN(fnode) \
    54         ((rootamdm37x_fun_t *) (fnode)->driver_data)
    5552
    5653typedef struct {
     
    258255        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
    259256       
    260         ddf_fun_t *fnode = NULL;
    261         match_id_t *match_id = NULL;
    262        
    263         /* Create new device. */
    264         fnode = ddf_fun_create(dev, fun_inner, name);
     257        /* Create new device function. */
     258        ddf_fun_t *fnode = ddf_fun_create(dev, fun_inner, name);
    265259        if (fnode == NULL)
    266                 goto failure;
    267        
    268         fnode->driver_data = (void*)fun;
    269        
    270         /* Initialize match id list */
    271         match_id = create_match_id();
    272         if (match_id == NULL)
    273                 goto failure;
    274        
    275         match_id->id = str_match_id;
    276         match_id->score = 100;
    277         add_match_id(&fnode->match_ids, match_id);
     260                return ENOMEM;
     261       
     262       
     263        /* Add match id */
     264        if (ddf_fun_add_match_id(fnode, str_match_id, 100) != EOK) {
     265                // TODO This will try to free our data!
     266                ddf_fun_destroy(fnode);
     267                return false;
     268        }
    278269       
    279270        /* Set provided operations to the device. */
    280         fnode->ops = &rootamdm37x_fun_ops;
     271        ddf_fun_data_implant(fnode, (void*)fun);
     272        ddf_fun_set_ops(fnode, &rootamdm37x_fun_ops);
    281273       
    282274        /* Register function. */
    283275        if (ddf_fun_bind(fnode) != EOK) {
    284276                ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
    285                 goto failure;
     277                ddf_fun_destroy(fnode);
     278                return false;
    286279        }
    287280       
    288281        return true;
    289        
    290 failure:
    291         if (match_id != NULL)
    292                 match_id->id = NULL;
    293        
    294         if (fnode != NULL) {
    295                 fnode->driver_data = NULL;
    296                 ddf_fun_destroy(fnode);
    297         }
    298        
    299         ddf_msg(LVL_ERROR, "Failed adding function '%s'.", name);
    300        
    301         return false;
    302282}
    303283
     
    349329static hw_resource_list_t *rootamdm37x_get_resources(ddf_fun_t *fnode)
    350330{
    351         rootamdm37x_fun_t *fun = ROOTARM_FUN(fnode);
     331        rootamdm37x_fun_t *fun = ddf_fun_data_get(fnode);
    352332        assert(fun != NULL);
    353333        return &fun->hw_resources;
Note: See TracChangeset for help on using the changeset viewer.