Changeset 63b4f90 in mainline for uspace/drv/root/root.c
- Timestamp:
- 2010-11-19T18:36:29Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 91db50ac
- Parents:
- 3f0a7971
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/root/root.c
r3f0a7971 r63b4f90 119 119 } 120 120 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 121 175 /** Get the root device. 122 176 * … … 133 187 printf(NAME ": failed to add child device for platform.\n"); 134 188 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 135 195 return res; 136 196 }
Note:
See TracChangeset
for help on using the changeset viewer.