Changeset f8e8738 in mainline for uspace/drv/root/root.c


Ignore:
Timestamp:
2011-04-07T20:22:40Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fee6381
Parents:
61257f4 (diff), a82889e (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:

Changes from development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/root/root.c

    r61257f4 rf8e8738  
    5252
    5353#include <ddf/driver.h>
     54#include <ddf/log.h>
    5455#include <devman.h>
    5556#include <ipc/devman.h>
     
    8990        int rc;
    9091
    91         printf(NAME ": adding new function for virtual devices.\n");
    92         printf(NAME ":   function node is `%s' (%d %s)\n", name,
     92        ddf_msg(LVL_DEBUG, "Adding new function for virtual devices. "
     93            "Function node is `%s' (%d %s)", name,
    9394            VIRTUAL_FUN_MATCH_SCORE, VIRTUAL_FUN_MATCH_ID);
    9495
    9596        fun = ddf_fun_create(dev, fun_inner, name);
    9697        if (fun == NULL) {
    97                 printf(NAME ": error creating function %s\n", name);
     98                ddf_msg(LVL_ERROR, "Failed creating function %s", name);
    9899                return ENOMEM;
    99100        }
     
    102103            VIRTUAL_FUN_MATCH_SCORE);
    103104        if (rc != EOK) {
    104                 printf(NAME ": error adding match IDs to function %s\n", name);
     105                ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
     106                    name);
    105107                ddf_fun_destroy(fun);
    106108                return rc;
     
    109111        rc = ddf_fun_bind(fun);
    110112        if (rc != EOK) {
    111                 printf(NAME ": error binding function %s: %s\n", name,
     113                ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
    112114                    str_error(rc));
    113115                ddf_fun_destroy(fun);
     
    136138        platform = sysinfo_get_data("platform", &platform_size);
    137139        if (platform == NULL) {
    138                 printf(NAME ": Failed to obtain platform name.\n");
     140                ddf_msg(LVL_ERROR, "Failed to obtain platform name.");
    139141                return ENOENT;
    140142        }
     
    143145        platform = realloc(platform, platform_size + 1);
    144146        if (platform == NULL) {
    145                 printf(NAME ": Memory allocation failed.\n");
     147                ddf_msg(LVL_ERROR, "Memory allocation failed.");
    146148                return ENOMEM;
    147149        }
     
    151153        /* Construct match ID. */
    152154        if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) {
    153                 printf(NAME ": Memory allocation failed.\n");
     155                ddf_msg(LVL_ERROR, "Memory allocation failed.");
    154156                return ENOMEM;
    155157        }
    156158
    157159        /* Add function. */
    158         printf(NAME ": adding platform function\n");
    159         printf(NAME ":   function node is `%s' (%d %s)\n", PLATFORM_FUN_NAME,
    160             PLATFORM_FUN_MATCH_SCORE, match_id);
     160        ddf_msg(LVL_DEBUG, "Adding platform function. Function node is `%s' "
     161            " (%d %s)", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE,
     162            match_id);
    161163
    162164        fun = ddf_fun_create(dev, fun_inner, name);
    163165        if (fun == NULL) {
    164                 printf(NAME ": error creating function %s\n", name);
     166                ddf_msg(LVL_ERROR, "Error creating function %s", name);
    165167                return ENOMEM;
    166168        }
     
    168170        rc = ddf_fun_add_match_id(fun, match_id, PLATFORM_FUN_MATCH_SCORE);
    169171        if (rc != EOK) {
    170                 printf(NAME ": error adding match IDs to function %s\n", name);
     172                ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
     173                    name);
    171174                ddf_fun_destroy(fun);
    172175                return rc;
     
    175178        rc = ddf_fun_bind(fun);
    176179        if (rc != EOK) {
    177                 printf(NAME ": error binding function %s: %s\n", name,
     180                ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
    178181                    str_error(rc));
    179182                ddf_fun_destroy(fun);
     
    191194static int root_add_device(ddf_dev_t *dev)
    192195{
    193         printf(NAME ": root_add_device, device handle=%" PRIun "\n",
     196        ddf_msg(LVL_DEBUG, "root_add_device, device handle=%" PRIun,
    194197            dev->handle);
    195198
     
    204207        int res = add_platform_fun(dev);
    205208        if (EOK != res)
    206                 printf(NAME ": failed to add child device for platform.\n");
     209                ddf_msg(LVL_ERROR, "Failed adding child device for platform.");
    207210
    208211        return res;
     
    212215{
    213216        printf(NAME ": HelenOS root device driver\n");
     217
     218        ddf_log_init(NAME, LVL_ERROR);
    214219        return ddf_driver_main(&root_driver);
    215220}
Note: See TracChangeset for help on using the changeset viewer.