Changes in uspace/drv/isa/isa.c [fc51296:af6b5157] in mainline


Ignore:
File:
1 edited

Legend:

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

    rfc51296 raf6b5157  
    5353
    5454#include <ddf/driver.h>
    55 #include <ddf/log.h>
    5655#include <ops/hw_res.h>
    5756
     
    135134        fd = open(conf_path, O_RDONLY);
    136135        if (fd < 0) {
    137                 ddf_msg(LVL_ERROR, "Unable to open %s\n", conf_path);
     136                printf(NAME ": unable to open %s\n", conf_path);
    138137                goto cleanup;
    139138        }
     
    142141
    143142        len = lseek(fd, 0, SEEK_END);
    144         lseek(fd, 0, SEEK_SET);
     143        lseek(fd, 0, SEEK_SET); 
    145144        if (len == 0) {
    146                 ddf_msg(LVL_ERROR, "Configuration file '%s' is empty.\n",
    147                     conf_path);
     145                printf(NAME ": fun_conf_read error: configuration file '%s' "
     146                    "is empty.\n", conf_path);
    148147                goto cleanup;
    149148        }
     
    151150        buf = malloc(len + 1);
    152151        if (buf == NULL) {
    153                 ddf_msg(LVL_ERROR, "Memory allocation failed.\n");
     152                printf(NAME ": fun_conf_read error: memory allocation failed.\n");
    154153                goto cleanup;
    155154        }
    156155
    157156        if (0 >= read(fd, buf, len)) {
    158                 ddf_msg(LVL_ERROR, "Unable to read file '%s'.\n", conf_path);
     157                printf(NAME ": fun_conf_read error: unable to read file '%s'.\n",
     158                    conf_path);
    159159                goto cleanup;
    160160        }
     
    252252                fun->hw_resources.count++;
    253253
    254                 ddf_msg(LVL_NOTE, "Added irq 0x%x to function %s\n", irq,
     254                printf(NAME ": added irq 0x%x to function %s\n", irq,
    255255                    fun->fnode->name);
    256256        }
     
    270270                fun->hw_resources.count++;
    271271
    272                 ddf_msg(LVL_NOTE, "Added io range (addr=0x%x, size=0x%x) to "
     272                printf(NAME ": added io range (addr=0x%x, size=0x%x) to "
    273273                    "function %s\n", (unsigned int) addr, (unsigned int) len,
    274274                    fun->fnode->name);
     
    331331        score = (int)strtol(val, &end, 10);
    332332        if (val == end) {
    333                 ddf_msg(LVL_ERROR, "Cannot read match score for function "
    334                     "%s.\n", fun->fnode->name);
     333                printf(NAME " : error - could not read match score for "
     334                    "function %s.\n", fun->fnode->name);
    335335                return;
    336336        }
     
    339339        get_match_id(&id, val);
    340340        if (id == NULL) {
    341                 ddf_msg(LVL_ERROR, "Cannot read match ID for function %s.\n",
    342                     fun->fnode->name);
     341                printf(NAME " : error - could not read match id for "
     342                    "function %s.\n", fun->fnode->name);
    343343                return;
    344344        }
    345345
    346         ddf_msg(LVL_DEBUG, "Adding match id '%s' with score %d to "
    347             "function %s\n", id, score, fun->fnode->name);
     346        printf(NAME ": adding match id '%s' with score %d to function %s\n", id,
     347            score, fun->fnode->name);
    348348
    349349        rc = ddf_fun_add_match_id(fun->fnode, id, score);
    350         if (rc != EOK) {
    351                 ddf_msg(LVL_ERROR, "Failed adding match ID: %s\n",
    352                     str_error(rc));
    353         }
     350        if (rc != EOK)
     351                printf(NAME ": error adding match ID: %s\n", str_error(rc));
    354352}
    355353
     
    377375        if (!prop_parse(fun, line, "io_range", &fun_parse_io_range) &&
    378376            !prop_parse(fun, line, "irq", &fun_parse_irq) &&
    379             !prop_parse(fun, line, "match", &fun_parse_match_id)) {
    380 
    381                 ddf_msg(LVL_ERROR, "Undefined device property at line '%s'\n",
    382                     line);
     377            !prop_parse(fun, line, "match", &fun_parse_match_id))
     378        {
     379            printf(NAME " error undefined device property at line '%s'\n",
     380                line);
    383381        }
    384382}
     
    441439        fun->fnode->ops = &isa_fun_ops;
    442440
    443         ddf_msg(LVL_DEBUG, "Binding function %s.\n", fun->fnode->name);
     441        printf(NAME ": Binding function %s.\n", fun->fnode->name);
    444442
    445443        /* XXX Handle error */
     
    469467static int isa_add_device(ddf_dev_t *dev)
    470468{
    471         ddf_msg(LVL_DEBUG, "isa_add_device, device handle = %d\n",
     469        printf(NAME ": isa_add_device, device handle = %d\n",
    472470            (int) dev->handle);
    473471
    474472        /* Make the bus device more visible. Does not do anything. */
    475         ddf_msg(LVL_DEBUG, "Adding a 'ctl' function\n");
     473        printf(NAME ": adding a 'ctl' function\n");
    476474
    477475        ddf_fun_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl");
    478476        if (ctl == NULL) {
    479                 ddf_msg(LVL_ERROR, "Failed creating control function.\n");
     477                printf(NAME ": Error creating control function.\n");
    480478                return EXDEV;
    481479        }
    482480
    483481        if (ddf_fun_bind(ctl) != EOK) {
    484                 ddf_msg(LVL_ERROR, "Failed binding control function.\n");
     482                printf(NAME ": Error binding control function.\n");
    485483                return EXDEV;
    486484        }
     
    488486        /* Add functions as specified in the configuration file. */
    489487        isa_functions_add(dev);
    490         ddf_msg(LVL_NOTE, "Finished enumerating legacy functions\n");
     488        printf(NAME ": finished the enumeration of legacy functions\n");
    491489
    492490        return EOK;
     
    495493static void isa_init()
    496494{
    497         ddf_log_init(NAME, LVL_ERROR);
    498495        isa_fun_ops.interfaces[HW_RES_DEV_IFACE] = &isa_fun_hw_res_ops;
    499496}
Note: See TracChangeset for help on using the changeset viewer.