Changeset 1fe9bf6 in mainline for uspace/drv/root/root.c


Ignore:
Timestamp:
2010-11-21T17:13:32Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
31860b7
Parents:
8b3bff5 (diff), 4087a33 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged updates from HelenOS mainline + changes from branch

/vojtechhorky/ddf_proposal/

File:
1 edited

Legend:

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

    r8b3bff5 r1fe9bf6  
    7272static int add_platform_child(device_t *parent)
    7373{
     74        return EOK;
    7475        printf(NAME ": adding new child for platform device.\n");
    7576       
     
    119120}
    120121
     122/** Create virtual USB host controller device.
     123 * Note that the virtual HC is actually device and driver in one
     124 * task.
     125 *
     126 * @param parent Parent device.
     127 * @return Error code.
     128 */
     129static int add_virtual_usb_host_controller(device_t *parent)
     130{
     131        printf(NAME ": adding virtual host contoller.\n");
     132
     133        int rc;
     134        device_t *vhc = NULL;
     135        match_id_t *match_id = NULL;
     136
     137        vhc = create_device();
     138        if (vhc == NULL) {
     139                rc = ENOMEM;
     140                goto failure;
     141        }
     142
     143        vhc->name = "vhc";
     144        printf(NAME ": the new device's name is %s.\n", vhc->name);
     145
     146        /* Initialize match id list. */
     147        match_id = create_match_id();
     148        if (match_id == NULL) {
     149                rc = ENOMEM;
     150                goto failure;
     151        }
     152
     153        match_id->id = "usb&hc=vhc";
     154        match_id->score = 100;
     155        add_match_id(&vhc->match_ids, match_id);
     156
     157        /* Register child device. */
     158        rc = child_device_register(vhc, parent);
     159        if (rc != EOK)
     160                goto failure;
     161
     162        return EOK;
     163
     164failure:
     165        if (match_id != NULL)
     166                match_id->id = NULL;
     167
     168        if (vhc != NULL) {
     169                vhc->name = NULL;
     170                delete_device(vhc);
     171        }
     172
     173        return rc;
     174}
     175
    121176/** Get the root device.
    122177 *
     
    133188                printf(NAME ": failed to add child device for platform.\n");
    134189       
     190        /* Register virtual USB host controller. */
     191        int rc = add_virtual_usb_host_controller(dev);
     192        if (EOK != rc) {
     193                printf(NAME ": failed to add child device - virtual USB HC.\n");
     194        }
     195
    135196        return res;
    136197}
Note: See TracChangeset for help on using the changeset viewer.