Changeset 8b1e15ac in mainline for uspace/drv/rootvirt/rootvirt.c


Ignore:
Timestamp:
2011-02-11T22:26:36Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68414f4a
Parents:
1b367b4
Message:

Finish splitting device node: devman client in C library, drv library. Update device drivers accordingly.

File:
1 edited

Legend:

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

    r1b367b4 r8b1e15ac  
    4343#define NAME "rootvirt"
    4444
    45 /** Virtual device entry. */
     45/** Virtual function entry */
    4646typedef struct {
    47         /** Device name. */
     47        /** Function name */
    4848        const char *name;
    49         /** Device match id. */
     49        /** Function match ID */
    5050        const char *match_id;
    51 } virtual_device_t;
     51} virtual_function_t;
    5252
    53 /** List of existing virtual devices. */
    54 virtual_device_t virtual_devices[] = {
     53/** List of existing virtual functions */
     54virtual_function_t virtual_functions[] = {
    5555#include "devices.def"
    56         /* Terminating item. */
     56        /* Terminating item */
    5757        {
    5858                .name = NULL,
     
    7272};
    7373
    74 /** Add child device.
     74/** Add function to the virtual device.
    7575 *
    76  * @param parent Parent device.
    77  * @param virt_dev Virtual device to add.
    78  * @return Error code.
     76 * @param vdev          The virtual device
     77 * @param vfun          Virtual function description
     78 * @return              EOK on success or negative error code.
    7979 */
    80 static int add_child(device_t *parent, virtual_device_t *virt_dev)
     80static int add_child(device_t *vdev, virtual_function_t *vfun)
    8181{
    82         printf(NAME ": registering child device `%s' (match \"%s\")\n",
    83             virt_dev->name, virt_dev->match_id);
     82        printf(NAME ": registering function `%s' (match \"%s\")\n",
     83            vfun->name, vfun->match_id);
    8484
    85         int rc = child_device_register_wrapper(parent, virt_dev->name,
    86             virt_dev->match_id, 10);
     85        int rc = register_function_wrapper(vdev, vfun->name,
     86            vfun->match_id, 10);
    8787
    8888        if (rc == EOK) {
    8989                printf(NAME ": registered child device `%s'\n",
    90                     virt_dev->name);
     90                    vfun->name);
    9191        } else {
    9292                printf(NAME ": failed to register child device `%s': %s\n",
    93                     virt_dev->name, str_error(rc));
     93                    vfun->name, str_error(rc));
    9494        }
    9595
     
    109109        }
    110110
    111         printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
    112             dev->name, (int)dev->handle);
     111        printf(NAME ": add_device(handle=%d)\n", (int)dev->handle);
    113112       
    114113        /*
    115          * Go through all virtual devices and try to add them.
     114         * Go through all virtual functions and try to add them.
    116115         * We silently ignore failures.
    117116         */
    118         virtual_device_t *virt_dev = virtual_devices;
    119         while (virt_dev->name != NULL) {
    120                 (void) add_child(dev, virt_dev);
    121                 virt_dev++;
     117        virtual_function_t *vfun = virtual_functions;
     118        while (vfun->name != NULL) {
     119                (void) add_child(dev, vfun);
     120                vfun++;
    122121        }
    123122
Note: See TracChangeset for help on using the changeset viewer.