Changeset fb7e5a9a in mainline for uspace/drv/test/test1/test1.c


Ignore:
Timestamp:
2011-09-06T20:03:31Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
038b289, f7d6b30
Parents:
7a46bfe (diff), 7e9fce6 (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 mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/test/test1/test1.c

    r7a46bfe rfb7e5a9a  
    4242static int test1_add_device(ddf_dev_t *dev);
    4343static int test1_dev_remove(ddf_dev_t *dev);
     44static int test1_dev_gone(ddf_dev_t *dev);
    4445static int test1_fun_online(ddf_fun_t *fun);
    4546static int test1_fun_offline(ddf_fun_t *fun);
     
    4849        .add_device = &test1_add_device,
    4950        .dev_remove = &test1_dev_remove,
     51        .dev_gone = &test1_dev_gone,
    5052        .fun_online = &test1_fun_online,
    5153        .fun_offline = &test1_fun_offline
     
    213215}
    214216
     217static int fun_unbind(ddf_fun_t *fun, const char *name)
     218{
     219        int rc;
     220
     221        ddf_msg(LVL_DEBUG, "fun_unbind(%p, '%s')", fun, name);
     222        rc = ddf_fun_unbind(fun);
     223        if (rc != EOK) {
     224                ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
     225                return rc;
     226        }
     227
     228        ddf_fun_destroy(fun);
     229        return EOK;
     230}
     231
    215232static int test1_dev_remove(ddf_dev_t *dev)
    216233{
     
    234251        if (test1->child != NULL) {
    235252                rc = fun_remove(test1->child, "child");
     253                if (rc != EOK)
     254                        return rc;
     255        }
     256
     257        return EOK;
     258}
     259
     260static int test1_dev_gone(ddf_dev_t *dev)
     261{
     262        test1_t *test1 = (test1_t *)dev->driver_data;
     263        int rc;
     264
     265        ddf_msg(LVL_DEBUG, "test1_dev_remove(%p)", dev);
     266
     267        if (test1->fun_a != NULL) {
     268                rc = fun_unbind(test1->fun_a, "a");
     269                if (rc != EOK)
     270                        return rc;
     271        }
     272
     273        if (test1->clone != NULL) {
     274                rc = fun_unbind(test1->clone, "clone");
     275                if (rc != EOK)
     276                        return rc;
     277        }
     278
     279        if (test1->child != NULL) {
     280                rc = fun_unbind(test1->child, "child");
    236281                if (rc != EOK)
    237282                        return rc;
Note: See TracChangeset for help on using the changeset viewer.