Ignore:
File:
1 edited

Legend:

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

    raf6b5157 rebcb05a  
    3636#include <str_error.h>
    3737#include <ddf/driver.h>
     38#include <ddf/log.h>
    3839
    3940#define NAME "test2"
     
    6465        int rc;
    6566
    66         printf(NAME ": registering function `%s': %s.\n", name, message);
     67        ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
    6768
    6869        fun = ddf_fun_create(parent, fun_inner, name);
    6970        if (fun == NULL) {
    70                 printf(NAME ": error creating function %s\n", name);
     71                ddf_msg(LVL_ERROR, "Failed creating function %s", name);
    7172                return ENOMEM;
    7273        }
     
    7475        rc = ddf_fun_add_match_id(fun, match_id, match_score);
    7576        if (rc != EOK) {
    76                 printf(NAME ": error adding match IDs to function %s\n", name);
     77                ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
     78                    name);
    7779                ddf_fun_destroy(fun);
    7880                return rc;
     
    8183        rc = ddf_fun_bind(fun);
    8284        if (rc != EOK) {
    83                 printf(NAME ": error binding function %s: %s\n", name,
     85                ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
    8486                    str_error(rc));
    8587                ddf_fun_destroy(fun);
     
    8789        }
    8890
    89         printf(NAME ": registered child device `%s'\n", name);
     91        ddf_msg(LVL_NOTE, "Registered child device `%s'", name);
    9092        return EOK;
    9193}
     
    111113        fun_a = ddf_fun_create(dev, fun_exposed, "a");
    112114        if (fun_a == NULL) {
    113                 printf(NAME ": error creating function 'a'.\n");
     115                ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
    114116                return ENOMEM;
    115117        }
     
    117119        rc = ddf_fun_bind(fun_a);
    118120        if (rc != EOK) {
    119                 printf(NAME ": error binding function 'a'.\n");
     121                ddf_msg(LVL_ERROR, "Failed binding function 'a'.");
    120122                return rc;
    121123        }
     
    128130static int test2_add_device(ddf_dev_t *dev)
    129131{
    130         printf(NAME ": test2_add_device(name=\"%s\", handle=%d)\n",
     132        ddf_msg(LVL_DEBUG, "test2_add_device(name=\"%s\", handle=%d)",
    131133            dev->name, (int) dev->handle);
    132134
     
    134136                fid_t postpone = fibril_create(postponed_birth, dev);
    135137                if (postpone == 0) {
    136                         printf(NAME ": fibril_create() error\n");
     138                        ddf_msg(LVL_ERROR, "fibril_create() failed.");
    137139                        return ENOMEM;
    138140                }
     
    149151{
    150152        printf(NAME ": HelenOS test2 virtual device driver\n");
     153        ddf_log_init(NAME, LVL_ERROR);
    151154        return ddf_driver_main(&test2_driver);
    152155}
Note: See TracChangeset for help on using the changeset viewer.