Ignore:
File:
1 edited

Legend:

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

    rf0da4eb2 r7e752b2  
    4545#include <ctype.h>
    4646#include <macros.h>
     47#include <inttypes.h>
    4748
    4849#include <driver.h>
     
    119120}
    120121
    121 /** Create virtual USB host controller device.
    122  * Note that the virtual HC is actually device and driver in one
    123  * task.
    124  *
    125  * @param parent Parent device.
    126  * @return Error code.
    127  */
    128 static int add_virtual_usb_host_controller(device_t *parent)
    129 {
    130         printf(NAME ": adding virtual host contoller.\n");
    131 
    132         int rc;
    133         device_t *vhc = NULL;
    134         match_id_t *match_id = NULL;
    135 
    136         vhc = create_device();
    137         if (vhc == NULL) {
    138                 rc = ENOMEM;
    139                 goto failure;
    140         }
    141 
    142         vhc->name = "vhc";
    143         printf(NAME ": the new device's name is %s.\n", vhc->name);
    144 
    145         /* Initialize match id list. */
    146         match_id = create_match_id();
    147         if (match_id == NULL) {
    148                 rc = ENOMEM;
    149                 goto failure;
    150         }
    151 
    152         match_id->id = "usb&hc=vhc";
    153         match_id->score = 100;
    154         add_match_id(&vhc->match_ids, match_id);
    155 
    156         /* Register child device. */
    157         rc = child_device_register(vhc, parent);
    158         if (rc != EOK)
    159                 goto failure;
    160 
    161         return EOK;
    162 
    163 failure:
    164         if (match_id != NULL)
    165                 match_id->id = NULL;
    166 
    167         if (vhc != NULL) {
    168                 vhc->name = NULL;
    169                 delete_device(vhc);
    170         }
    171 
    172         return rc;
    173 }
    174 
    175122/** Get the root device.
    176123 *
     
    180127static int root_add_device(device_t *dev)
    181128{
    182         printf(NAME ": root_add_device, device handle = %d\n", dev->handle);
     129        printf(NAME ": root_add_device, device handle=%" PRIun "\n",
     130            dev->handle);
    183131       
    184132        /* Register root device's children. */
     
    187135                printf(NAME ": failed to add child device for platform.\n");
    188136       
    189         /* Register virtual USB host controller. */
    190         int rc = add_virtual_usb_host_controller(dev);
    191         if (EOK != rc) {
    192                 printf(NAME ": failed to add child device - virtual USB HC.\n");
    193         }
    194 
    195137        return res;
    196138}
Note: See TracChangeset for help on using the changeset viewer.