Changeset 703d19c in mainline


Ignore:
Timestamp:
2010-11-30T14:21:47Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2edcb63
Parents:
5bee897
Message:

A bit of refactoring

Location:
uspace
Files:
2 edited

Legend:

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

    r5bee897 r703d19c  
    4949};
    5050
     51/** Register child and inform user about it.
     52 *
     53 * @param parent Parent device.
     54 * @param message Message for the user.
     55 * @param name Device name.
     56 * @param match_id Device match id.
     57 * @param score Device match score.
     58 */
     59static void register_child_verbose(device_t *parent, const char *message,
     60    const char *name, const char *match_id, int match_score)
     61{
     62        printf(NAME ": registering child device `%s': %s.\n",
     63           name, message);
     64
     65        int rc = child_device_register_wrapper(parent, name,
     66            match_id, match_score);
     67
     68        if (rc != EOK) {
     69                printf(NAME ": failed to register child `%s' (%s).\n",
     70                    name, str_error(rc));
     71        }
     72}
     73
    5174/** Callback when new device is passed to this driver.
    5275 * This function is the body of the test: it shall register new child
     
    6891static int add_device(device_t *dev)
    6992{
    70         int rc;
    7193        printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
    7294            dev->name, (int) dev->handle);
    7395
     96        add_device_to_class(dev, "virtual");
     97
    7498        if (dev->parent == NULL) {
    75                 printf(NAME ": cloning myself ;-).\n");
    76                 rc = child_device_register_wrapper(dev, "clone",
     99                register_child_verbose(dev, "cloning myself ;-)", "clone",
    77100                    "virtual&test1", 10);
    78                 if (rc != EOK) {
    79                         printf(NAME ": failed to register clone (%s).\n",
    80                             str_error(rc));
    81                 }
    82101        } else if (str_cmp(dev->name, "clone") == 0) {
    83                 printf(NAME ": registering child device run by the same task.\n");
    84                 rc = child_device_register_wrapper(dev, "child",
     102                register_child_verbose(dev, "run by the same task", "child",
    85103                    "virtual&test1&child", 10);
    86                 if (rc != EOK) {
    87                         printf(NAME ": failed to register child (%s).\n",
    88                             str_error(rc));
    89                 }
    90104        }
    91105
  • uspace/srv/devman/devman.c

    r5bee897 r703d19c  
    516516        int phone;
    517517
    518         printf(NAME ": pass_devices_to_driver\n");
     518        printf(NAME ": pass_devices_to_driver(`%s')\n", driver->name);
    519519
    520520        fibril_mutex_lock(&driver->driver_mutex);
     
    586586void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
    587587{
    588         printf(NAME ": initialize_running_driver\n");
     588        printf(NAME ": initialize_running_driver (`%s')\n", driver->name);
    589589       
    590590        /*
Note: See TracChangeset for help on using the changeset viewer.